Re: [R] [FORGED] Newbie Question on R versus Matlab/Octave versus C

2019-02-03 Thread Jeff Newmiller
Your code seems to be attempting to modify global variables from within functions... R purposely makes this hard to do. Don't fight it. Instead, use function arguments and produce function outputs with your functions. Also, the ifelse function does not control flow of execution of code... it s

Re: [R] (no subject)

2019-02-03 Thread Rui Barradas
Hello, It is just a guess but I bet that what the OP means is f <- function(x) { 2 + x^2 - x^3 } uniroot(f, lower = 1, upper = 2) To the OP: please learn how to write math in R *before* trying to solve problems. Hope this helps, Rui Barradas Às 16:07 de 02/02/2019, Berend Hasselman e

Re: [R] Why is there error in as.POSIXlt.character when using strftime()?

2019-02-03 Thread C W
Thanks lots Jeff, very clear explanation. Yes, I think I will stick with the POSIXt family of functions. On Sat, Feb 2, 2019 at 1:33 PM Jeff Newmiller wrote: > If there are no time-of-day values in your data set the the Date type is > great. However, it can be messy if you work with both Date a

Re: [R] Why is there error in as.POSIXlt.character when using strftime()?

2019-02-03 Thread C W
Also, I was able to extract date using > as.Date(dat, "%m/%d/%y") [1] "2015-07-12" "2015-07-12" "2015-07-12" "2015-07-12" "2015-07-12" [6] "2015-07-12" "2015-07-12" "2015-07-12" "2015-07-12" "2015-07-12" [11] "2015-07-12" "2015-07-12" "2015-07-12" "2015-07-12" "2015-07-12" [16] "2015-07-12" "2015

Re: [R] Why is there error in as.POSIXlt.character when using strftime()?

2019-02-03 Thread C W
Thank you all very much, very helpful! :) I'm just curious, what does strptime(), strftime(), as.POSIXlt.(), and as.POSIXct() stand for? On Sat, Feb 2, 2019 at 10:41 AM Jeff Newmiller wrote: > ... and in general, you need to specify the time zone to avoid surprises. > In many cases this can be