# calcTimes

0th

Percentile

##### Calculates for a set of times, the time intervals after an origin time and the position of each within a time interval

For the column specified in imageTimes, having converted it to POSIXct if not already converted, calculates for each value the number of intervalUnits between the time and the startTime. Then the number of timePositions within the intervals is calculated for the values in imageTimes. The function difftimes is used in doing the calculations, but the results are converted to numeric. For example intervals could correspond to the number of Days after Planting and the timePositions to the hour within each day.

Keywords
manip
##### Usage
calcTimes(data, imageTimes = NULL, timeFormat = "%Y-%m-%d %H:%M",
intervals = "Time.after.Planting..d.", startTime = NULL,
intervalUnit = "days", timePositions = NULL)
##### Arguments
data

A data.frame containing any columns specified by imageTimes, intervals and timePositions.

imageTimes

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. If imageTimes is NULL then no calculations are done.

timeFormat

A character giving the POSIXct format of characters containing times, in particular imageTimes and startTime. Note that if fractions of seconds are required options(digits.secs) must be used to set the number of decimal places and timeFormat must use %OS for seconds in timeFormat.

intervals

A character giving the name of the column in data containing, as a numeric or a factor, the calculated times after startTime to be plotted on the x-axis. It is given as the number of intervalUnits between the two times. If startTime is NULL then intervals is not calculated.

startTime

A character giving the time, in the POSIXct format specified by timeFormat, to be subtracted from imageTimes to caclualte intervals. For example, it might be the day of planting or treatment. If startTime is NULL then intervals is not calculated.

intervalUnit

A character giving the name of the unit in which the values of the intervals should be expressed. It must be one of "secs", "mins", "hours" or "days".

timePositions

A character giving the name of the column in data containing, as a numeric, the value of the time position within an interval (for example, the time of imaging during the day expressed in hours plus a fraction of an hour). If timePositions is NULL then it is not calculated.

##### Value

A data.frame, being the unchaged data data.frame when imageTimes is NULL or containing either intervals and/or timePositions depending on which is not NULL.

as.POSIXct, imagetimesPlot.

• calcTimes
##### Examples
# NOT RUN {
data(exampleData)
raw.dat <- calcTimes(data = raw.dat,
imageTimes = "Snapshot.Time.Stamp", timePositions = "Hour")
# }

Documentation reproduced from package growthPheno, version 1.0-13, License: GPL (>= 2)

### Community examples

Looks like there are no examples yet.