RMprep: RMprep function

View source: R/RMprep.R

RMprepR Documentation

RMprep function

Description

This function is used to prepare data files for Rainmaker functions. Dates are transformed to as.POSIXctdates using the as.POSIXct function Multiple common date formats are included as options for tranformation The original date column is transformed to a character variable. Column header names are changed to desired names

Usage

RMprep(
  df,
  prep.type = 1,
  date.type = 1,
  dates.in = "default",
  dates.out = "pdate",
  cnames.in = "",
  cnames.new = "rain",
  tz = ""
)

Arguments

df

dataframe

prep.type

numeric 1=date to as.POSIXct 2=name change, 3=both

date.type

numeric 1=mm/dd/YYYY hh:mm, 2=YYYY-mm-ddTHH:MM, 3=RDB_example1: 2 columns, Date and Time Date=m/d/Y; time=h:mm, 4=RDB_example2: 4 columns, Year, Month, Day and Minute Date=m/d/Y; time=h:mm, 5=Lake level from Great Lakes "Tides and Currents", Date=YYYYMMDD; Time = H:MM

dates.in

string Vector of column names for date/time definition. Defaults are as follows for different date.type options date.type=1: One column name -> "GMT.Time", date.type=2: One column name -> "GMT.Time", date.type=3: two column names -> c("DATE","TIME"), date.type=4: four column names > c("YEAR","MONTH","DAY","MINUTE"), date.type=5: two column names -> c("Date","Time"), If no value is given, the defaults given above are used. Enter value as c("name1","name2",...)

dates.out

string Column name of output dates, defaults to 'pdate' which is used elsewhere in Rainmaker.

cnames.in

string Column names of the input data which should be changed.

cnames.new

string New column names for the columns specified in cnames.in.

tz

string time zone, CST6CDT for central time. For other times use values in the TZ* column here: http://en.wikipedia.org/wiki/List_of_zoneinfo_time_zones

Value

df dataframe

Examples

RDB <- cedarq
RDB2 <- RMprep(RDB,prep.type=1,date.type=3,tz="CST6CDT")
RDB <- CedarRRain
RDB2 <- RMprep(RDB,prep.type=1,date.type=1,dates.in="CST.Time",tz="CST6CDT")

USGS-R/Rainmaker documentation built on Oct. 11, 2022, 6:05 a.m.