I am trying to write a function which will take accept an argument and use the 
value of the argument to indicate the source of the data that should be 
processed in an as.POSIXct function. My attempt at writing the function is 
below:

readit <- function(species){
  no[,"NewTime"] <- 
as.POSIXct(paste(species)[,"Time"],format=("%Y-%m-%d_%H:%M:%OS"),tz="UTC")
}

If the value of species is no2, I want the function call
readit("no2")
to produce a statement:
no[,"NewTime"] <- as.POSIXct(no[,"Time"],format=("%Y-%m-%d_%H:%M:%OS"),tz="UTC")

If the value of species is co2, I want the function call
readit("co2")
to produce a statement:
no[,"NewTime"] <- 
as.POSIXct(co2[,"Time"],format=("%Y-%m-%d_%H:%M:%OS"),tz="UTC")

When I run either version of the function and the call to the function I 
receive the following error message:

Browse[1]> readit("no2")
Error during wrapup: incorrect number of dimensions
Error: no more error handlers available (recursive errors?); invoking 'abort' 
restart

Please help me fix my code

Thank you,

John

John David Sorkin M.D., Ph.D.
Professor of Medicine, University of Maryland School of Medicine;
Associate Director for Biostatistics and Informatics, Baltimore VA Medical 
Center Geriatrics Research, Education, and Clinical Center; 
Former PI Biostatistics and Informatics Core, University of Maryland School of 
Medicine Claude D. Pepper Older Americans Independence Center;
Senior Statistician University of Maryland Center for Vascular Research;

Division of Gerontology, Geriatrics and Palliative Medicine,
10 North Greene Street
GRECC (BT/18/GR)
Baltimore, MD 21201-1524
Cell phone 443-418-5382



______________________________________________
[email protected] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide https://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to