growthPheno (version 1.0-13)

longitudinalPrime: Selects a set variables to be retained in a data frame of longitudinal data

Description

Forms the prime traits by selecting a subset of the traits in a data.frame of imaging data produced by the Lemna Tec Scanalyzer. The imaging traits to be retained are specified using the traits and labsCamerasViews arguments. Some imaging traits are divided by 10000 to convert them from pixels to kilopixels. Also added are factors and explanatory variates that might be of use in an analysis.

Usage

longitudinalPrime(data, cartId = "Snapshot.ID.Tag", 
                  imageTimes = "Snapshot.Time.Stamp", 
                  timeAfterStart = "Time.after.Planting..d.",
                  idcolumns = c("Genotype.ID","Treatment.1"), 
                  traits = list(all = c("Area", 
                                        "Boundary.Points.To.Area.Ratio", 
                                        "Caliper.Length", "Compactness", 
                                        "Convex.Hull.Area"), 
                                 side = c("Center.Of.Mass.Y", 
                                          "Max.Dist.Above.Horizon.Line")),
                  labsCamerasViews = list(all = c("SV1", "SV2", "TV"),
                                          side = c("SV1", "SV2")), 
                  smarthouse.lev = NULL, 
                  calcWaterLoss = TRUE, pixelsPERcm)

Arguments

data

A data.frame containing the columns specified by cartId, imageTimes, timeAfterStart, idcolumns, traits and cameras along with the following columns:

Smarthouse, Lane, Position, Weight.Before, Weight.After, Water.Amount,

Projected.Shoot.Area..pixels.

The defaults for the arguments to longitudinalPrime requires a data.frame containing the following columns, although not necessarily in the order given here:

Smarthouse, Lane, Position, Weight.Before, Weight.After, Water.Amount,

Projected.Shoot.Area..pixels., Area.SV1, Area.SV2, Area.TV,

Boundary.Points.To.Area.Ratio.SV1, Boundary.Points.To.Area.Ratio.SV2,

Boundary.Points.To.Area.Ratio.TV, Caliper.Length.SV1,

Caliper.Length.SV2, Caliper.Length.TV,

Compactness.SV1, Compactness.SV2, Compactness.TV,

Convex.Hull.Area.SV1, Convex.Hull.Area.SV2, Convex.Hull.Area.TV,

Center.Of.Mass.Y.SV1, Center.Of.Mass.Y.SV2,

Max.Dist.Above.Horizon.Line.SV1, Max.Dist.Above.Horizon.Line.SV2.

cartId

A character giving the name of the column that contains the unique Id for each cart.

imageTimes

A character giving the name of the column that contains the time that each cart was imaged.

timeAfterStart

A character giving the name of the column that contains the time after some nominated starting time e.g. the number of days after planting.

idcolumns

A character vector giving the names of the columns that identify differences between the plants or carts e.g. Genotype.ID, Treatment.1, Treatment.2.

traits

A character or a list whose components are characters. Each character gives the names of the columns for imaging traits whose values are required for each of the camera-view combinations given in the corresponding list component of labsCamerasViews. If labsCamerasViews or a component of labsCamerasViews is NULL, then the contents of traits or the coresponding component of traits are merely treated as the names of columns to be retained.

labsCamerasViews

A character or a list whose components are characters. Each character gives the labels of the camera-view combinations for which is required values of each of the imaging traits in the corresponding character of traits. It is assumed that the camera-view labels are appended to the trait names and separated from the trait names by a full stop (.). If labsCamerasViews or a component of labsCamerasViews is NULL, then the contents of the traits or the coresponding component of traits are merely treated as the names of columns to be retained.

smarthouse.lev

A character vector giving the levels to use for the Smarthouse factor. If NULL then the unique values in Smarthouse will be used.

calcWaterLoss

A logical indicating whether to calculate the Water.Loss. If it is FALSE, Water.Before, Water.After and Water.Amount will not be in the returned data.frame. They can be copied across by listing them in a component of traits and set the corresponding component of cameras to NULL.

pixelsPERcm

A numeric giving the number of pixels per cm for the images. No longer used.

Value

A data.frame containing the columns specified by cartId, imageTimes, timeAfterStart, idcolumns, traits and cameras. The defaults will result in the following columns:

  1. Smarthouse: factor with levels for the Smarthouse

  2. Lane: factor for lane number in a smarthouse

  3. Position: factor for east/west position in a lane

  4. Days: factor for the number of Days After Planting (DAP)

  5. cartId: unique code for each cart

  6. imageTimes: time at which an image was taken in POSIXct format

  7. Reps: factor indexing the replicates for each combination of the factors in idcolumns (calculated)

  8. xPosn: numeric for the Positions within a Lane (calculated)

  9. Hour: hour of the day, to 2 decimal places, at which the image was taken (calculated)

  10. xDays: numeric for the DAP that is centred by subtracting the mean of the unique days (calculated)

  11. idcolumns: the columns listed in idcolumns that have been converted to factors

  12. Weight.Before: weight of the pot before watering (only if calcWaterLoss is TRUE)

  13. Weight.After: weight of the pot after watering (only if calcWaterLoss is TRUE)

  14. Water.Amount: the weight of the water added (= Water.After - Water.Before) (calculated)

  15. Water.Loss: the difference between Weight.Before for the current imaging and the Weight.After for the previous imaging (calculated unless calcWaterLoss is FALSE)

  16. Area: the Projected.Shoot.Area..pixels. divided by 1000 (calculated)

  17. Area.SV1: the Projected.Shoot.Area from Side View 1 divided by 1000 (calculated)

  18. Area.SV2: the Projected.Shoot.Area from Side View 2 divided by 1000 (calculated)

  19. Area.TV: the Projected.Shoot.Area from Top View divided by 1000 (calculated)

  20. Boundary.To.Area.Ratio.SV1

  21. Boundary.To.Area.Ratio.SV2

  22. Boundary.To.Area.Ratio.TV

  23. Caliper.Length.SV1

  24. Caliper.Length.SV2

  25. Caliper.Length.TV

  26. Compactness.SV1 from Side View 1

  27. Compactness.SV2 from Side View 2

  28. Compactness.TV: from Top View

  29. Convex.Hull.Area.SV1: area of Side View 1 Convex Hull divided by 1000 (calculated)

  30. Convex.Hull.Area.SV2: area of Side View 2 Convex Hull divided by 1000 (calculated)

  31. Convex.Hull.TV: Convex.Hull.Area.TV divided by 1000 (calculated)

  32. Center.Of.Mass.Y.SV1: Centre of Mass from Side View 1

  33. Center.Of.Mass.Y.SV2: Centre of Mass from Side View 2

  34. Max.Dist.Above.Horizon.Line.SV1: the Max.Dist.Above.Horizon.Line.SV1 converted to cm using pixelsPERcm (calculated)

  35. Max.Dist.Above.Horizon.Line.SV2: the Max.Dist.Above.Horizon.Line.SV2 converted to cm using pixelsPERcm (calculated)

Details

The columns are copied from data, except for those columns in the list under Value that have `(calculated)' appended.

Examples

Run this code
# NOT RUN {
data(exampleData)
longiPrime.dat <- longitudinalPrime(data=raw.dat, smarthouse.lev=1)

longiPrime.dat <- longitudinalPrime(data=raw.dat, smarthouse.lev=1, 
                                    traits = list(a = "Area", c = "Compactness"),
                                    labsCamerasViews = list(all = c("SV1", "SV2", "TV"), 
                                                            t = "TV"))

longiPrime.dat <- longitudinalPrime(data=raw.dat, smarthouse.lev=1, 
                                    traits = c("Area.SV1", "Area.SV2", "Area.TV", 
                                               "Compactness.TV"),
                                    labsCamerasViews = NULL)

longiPrime.dat <- longitudinalPrime(data=raw.dat, smarthouse.lev=1, 
                                    calcWaterLoss = FALSE, 
                                    traits = list(img = c("Area", "Compactness"), 
                                                  H20 = c("Weight.Before","Weight.After",
                                                          "Water.Amount")),
                                    labsCamerasViews = list(all = c("SV1", "SV2", "TV"), 
                                                            H2O = NULL))
# }

Run the code above in your browser using DataCamp Workspace