Uses readxl
to import a sheet of imaging data produced by the
Lemna Tec Scanalyzer. Basically, the data consists of imaging data obtained from a
set of pots or carts over time. There should be a column, which by default is called
Snapshot.ID.Tag
, containing a unique identifier for each cart and a column,
which by default is labelled Snapshot.Time.Stamp
, containing
the time of imaging for each observation in a row of the sheet. Also, if
startTime
is not NULL
, calcTimes
is called to
calculate, or recalculate if already present, timeAfterStart
from
imageTimes
by subtracting a supplied startTime
.
Using cameraType
, keepCameraType
, labsCamerasViews
and
prefix2suffix
, some flexibility is provided for renaming the columns with
imaging data. For example, if the column names are prefixed with 'RGB_SV1', 'RGB_SV2'
or 'RGB_TV', the 'RGB_' can be removed and the 'SV1', 'SV2' or 'TV' become suffices.
importExcel(file, sheet="raw data", sep = ",",
cartId = "Snapshot.ID.Tag",
imageTimes = "Snapshot.Time.Stamp",
timeAfterStart = "Time.after.Planting..d.",
cameraType = "RGB", keepCameraType = FALSE,
labsCamerasViews = NULL, prefix2suffix = TRUE,
startTime = NULL,
timeFormat = "%Y-%m-%d %H:%M",
imagetimesPlot = TRUE, ...)
A data.frame
containing the data.
A character
giving the path and name of the file containing
the data.
A character
giving the name of the sheet containing
the data, that must include columns whose names are as specified by cartId
,
which uniquely indexes the carts in the experiment, and
imageTimes
, which reflects the time of the imaging from
which a particular data value was obtained. It is also assumed that a
column whose name is specified by timeAfterStart
is in the sheet or that
it will be calculated from imageTimes
using the value of
startTime
supplied in the function call.
A character
giving the separator used in a csv
file.
A character
giving the name of the column that contains
the unique Id for each cart. Note that in importing data into R, spaces
and nonalphanumeric characters in names are converted to full stops.
A character
giving the name of the column that contains
the time that each cart was imaged. Note that in importing data into R, spaces
and nonalphanumeric characters in names are converted to full stops.
A character
giving the name of the column that
contains or is to contain the difference between imageTimes
and
startTime
. The function calcTimes
is called to calculate the
differences. For example, it might contain the number of days after
planting. Note that in importing data into R, spaces
and nonalphanumeric characters in names are converted to full stops.
A character
string nominating the abbreviation used for the
cameraType. A warning will be given if no variable names include this cameraType.
A logical
specifying whether to retain the cameraType
in the
variables names. It will be the start of the prefix or suffix and separated from
the remander of the prefix or suffix by an underscore (_).
A named character
whose elements are new labels for the
camera-view combinations and the name of each element is the old label for the
camera-view combination in the data being imported. If labsCamerasViews
is NULL
, all column names beginning with cameraType
are classed as
imaging variables and the unique prefixes amongst them determined. If no imaging
variables are found then no changes are made. Note that if you want to include a
recognisable cameraType
in a camier-view label, it should be at the start
of the the label in labsCamerasViews
and separated from the rest of the
label by an underscore (_).
A logical
specifying whether the variables names with prefixed
camera-view labels are to have those prefixes transferred to become suffices.
The prefix is assumed to be all the characters up to the first full stop (.) in the
variable name and must contain cameraType
to be moved. It is generally
assumed that the characters up to the first underscore (_) are the camera type
and this is removed if keepCameraType
is FALSE
. If there is no
underscore (_), the whole prefix is moved. If labsCamerasViews
is
NULL
, all column names beginning with cameraType
are classed as
imaging variables and the unique prefixes amongst them determined.
If no imaging variables are found then no changes are made.
A character
giving the time of planting, in the POSIXct
format timeFormat, to be subtracted from imageTimes
in recalculating timeAfterStart
. If startTime
is
NULL
then timeAfterStart
is not recalculated.
A character
giving the POSIXct
format of characters
containing times, in particular imageTimes
and startTime
.
A logical
indicating whether a plot of the imaging times against
the recalculated Time.After.Planting..d.
. It aids in checking
Time.After.Planting..d.
and what occurred in imaging the plants.
allows for arguments to be passed to imagetimesPlot
. However, if
intervals
is passed an error will occur; use timeAfterStart instead.
Chris Brien
as.POSIXct
, calcTimes
, imagetimesPlot
if (FALSE) {
raw.0169.dat <- importExcel(file = "0169 analysis_20140603.xlsx",
startTime = "2013-05-23 8:00 AM")
camview.labels <- c("SF0", "SL0", "SU0", "TV0")
names(camview.labels) <- c("RGB_Side_Far_0", "RGB_Side_Lower_0",
"RGB_Side_Upper_0", "RGB_TV_0")
raw.19.dat <- suppressWarnings(importExcel(file = "./data/raw19datarow.csv",
cartId = "Snapshot.ID.Tags",
startTime = "06/10/2017 0:00 AM",
timeFormat = "%d/%m/%Y %H:M",
labsCamerasViews = camview.labels,
imagetimesPlot = FALSE))
}
Run the code above in your browser using DataLab