[R] Ifelse Execution

Jeff Newmiller jdnewmil at dcn.davis.ca.us
Tue Oct 2 04:11:42 CEST 2012


Ifelse is a vector function and is absolutely inappropriate for that use.
Use "if" instead.
Also, read the help for Sys.sleep... you need to tell it how long you want to sleep. You should compute how long that is from now and sleep that long.
---------------------------------------------------------------------------
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
--------------------------------------------------------------------------- 
Sent from my phone. Please excuse my brevity.

Bhupendrasinh Thakre <vickythakre at gmail.com> wrote:

>Hi Everyone,
>
>I am trying to run a time based query and need some of your help.
>Not much of data or packages.
>
>Just a simple one.
>Query I am trying to execute.
>
>ifelse ((as.numeric(as.POSIXct("2012-10-01 20:38:00"))),
>(rnorm(1,2,1)),(Sys.sleep()))
>
>Note. Why I am using as.numeric is as I have a list of time at which I
>wanted to run the command.
>
>Something like 
>
>1349142243
>1349138667
>
>Question.
>
>1. The query is running before the time reaches in both R-Studio and
>R-Terminal in Mac based System.
>2. Sys.sleep () is ineffective in putting R on sleep till the time
>comes. 
>
>
>Bhupendrasinh Thakre
>
>
>
>
>
>
>	[[alternative HTML version deleted]]
>
>______________________________________________
>R-help at r-project.org mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.




More information about the R-help mailing list