Re: [R] Help with Time

2014-11-22 Thread Raghuraman Ramachandran
Hi Boris/ David Many thanks for the kind assistance. I will try following your codes. Time has always been a slippery subject to me! Cheers On Sat, Nov 22, 2014 at 12:59 AM, David Winsemius wrote: > > On Nov 21, 2014, at 3:19 PM, David Winsemius wrote: > >> >> On Nov 21, 2014, at 2:55 PM, Ragh

Re: [R] Help with Time

2014-11-21 Thread David Winsemius
On Nov 21, 2014, at 3:19 PM, David Winsemius wrote: > > On Nov 21, 2014, at 2:55 PM, Raghuraman Ramachandran wrote: > >> Sorry I forgot to mention it clearly. I like to round it to the >> nearest 30th minute that is past. So 12:28:59 will be again 12:00:00 >> and >> 12:59:59 will be 12:30:00 et

Re: [R] Help with Time

2014-11-21 Thread Boris Steipe
Perhaps this ... roundToHalf <- function(t) { t <- as.POSIXlt(t) if (t$min < 15) { t$min <- 0 } else if (t$min < 45) { t$min <- 30 } else { t$min <- 0 t$hour <- t$hour + 1

Re: [R] Help with Time

2014-11-21 Thread David Winsemius
On Nov 21, 2014, at 2:55 PM, Raghuraman Ramachandran wrote: > Sorry I forgot to mention it clearly. I like to round it to the > nearest 30th minute that is past. So 12:28:59 will be again 12:00:00 > and > 12:59:59 will be 12:30:00 etc. Apologies for the lack of clarity in > the beginning. > Tha

Re: [R] Help with Time

2014-11-21 Thread David Winsemius
On Nov 21, 2014, at 2:52 PM, Raghuraman Ramachandran wrote: > Dear guRus > > How can I round of time in R to the nearest 30th minute please? > > For example suppose if >> Sys.time() > [1] "2014-11-21 22:49:05.59042 GMT" > then I would like a function that outputs 22:30:00. > > if Sys.time is 1

Re: [R] Help with Time

2014-11-21 Thread Raghuraman Ramachandran
Sorry I forgot to mention it clearly. I like to round it to the nearest 30th minute that is past. So 12:28:59 will be again 12:00:00 and 12:59:59 will be 12:30:00 etc. Apologies for the lack of clarity in the beginning. Many thanks Raghu On Fri, Nov 21, 2014 at 10:52 PM, Raghuraman Ramachandran

[R] Help with Time

2014-11-21 Thread Raghuraman Ramachandran
Dear guRus How can I round of time in R to the nearest 30th minute please? For example suppose if >Sys.time() [1] "2014-11-21 22:49:05.59042 GMT" then I would like a function that outputs 22:30:00. if Sys.time is 12:13:22 then I would like to get 12:00:00 etc. Any help would be appreciated. Ma

Re: [R] help with time data - R weird behaviour across machines

2012-03-06 Thread Prof Brian Ripley
What timezones are you and your colleague in? "2011-03-27 01:00:01" does not exist in some timezones, e.g. Europe/London. As ?as.POSIXlt explains, you can expect such non-existent inputs to give NA. And from ?Sys.timezone: Note that except on Windows, the operation of time zones is an

[R] help with time data - R weird behaviour across machines

2012-03-06 Thread Tiago Marques
Hello list, I was hoping I could get some help on something which is really giving me a headache. I am using R version 2.14.1 (2011-12-22) (Platform: x86_64-pc-mingw32/x64 (64-bit)) An object which is supposed to have times has a few elements listed as not times but NA's > ls() [1] "todelet

Re: [R] Help with Time Series Plot‏

2011-03-17 Thread Peter Ehlers
On 2011-03-17 16:37, Axel Urbiz wrote: Dear List, This is an embarrassing question, but I can seem to make this work…How do I change the font size on the xlab and on the numbers shown in the x-axis on the time series plot below. The arguments cex.lab and cex.axis do not seem to be 'passing' to

Re: [R] Help with Time Series Plot‏

2011-03-17 Thread Dennis Murphy
Hi: Try this: plot(ts(rnorm(100), start = 2004, freq = 12), xaxt = 'n', yaxt = 'n', xlab = '', ylab = '') axis(1, at = c(2004:2012), cex.axis = 0.7) axis(2, cex.axis = 0.7) title(xlab = 'My X lab', ylab = 'RQI', cex.lab = 0.1) The illegible dots in the region where the axis labels would nor

[R] Help with Time Series Plot‏

2011-03-17 Thread Axel Urbiz
Dear List, This is an embarrassing question, but I can seem to make this work…How do I change the font size on the xlab and on the numbers shown in the x-axis on the time series plot below. The arguments cex.lab and cex.axis do not seem to be 'passing' to the plot function. plot(ts(rnorm(100), s

[R] Help with time varying covariate-unfold function

2010-12-05 Thread Mathangi Gopalakrishnan
Hello All, I am trying to use the unfold function in RcmdrPlugin.survival library, which converts the survival data with time varying covariates to the counting process notation. The problem is somehow, the event indicator created is not correct. Below is the data, I am trying to convert:

Re: [R] Help with time in R

2010-07-21 Thread Saeed Abu Nimeh
You can use strptime to specify the format of the date and time you want, e.g. > x1<-strptime(x, "%Y-%m-%d %H:%M:%S") > x1 [1] "2010-04-02 12:00:05" > str(x1) POSIXlt[1:1], format: "2010-04-02 12:00:05" On Wed, Jul 21, 2010 at 8:02 AM, Aaditya Nanduri wrote: > Ms. Chisholm, > > If you could tel

Re: [R] Help with time in R

2010-07-21 Thread Aaditya Nanduri
Ms. Chisholm, If you could tell us how you plan to use the variables, we will have a better understanding of what you are looking for and will be able to help you. Are you looking for the time in seconds? In that case, do as Mr. Holfman says. He just skipped the part about converting the factors t

Re: [R] Help with time in R

2010-07-20 Thread David Winsemius
On Jul 20, 2010, at 8:41 AM, David Winsemius wrote: On Jul 20, 2010, at 7:33 AM, Sarah Chisholm wrote: Hi, I have a problem with the time formatting in R. I have entered time in the format "MM:SS.xyz" and R has automatically classified this as a factor, but I need it numerically. Howeve

Re: [R] Help with time in R

2010-07-20 Thread David Winsemius
On Jul 20, 2010, at 7:33 AM, Sarah Chisholm wrote: Hi, I have a problem with the time formatting in R. I have entered time in the format "MM:SS.xyz" and R has automatically classified this as a factor, but I need it numerically. However when I use as.numeric() it gives me totally differe

Re: [R] Help with time in R

2010-07-20 Thread jim holtman
> # depends on what you want to do with it. > # if you just want to convert to seconds, use the following > x <- c('12:23.45', '34:15.1', '1:34.23') > # split by the ":" > x.s <- strsplit(x, ":") > # convert > x.c <- sapply(x.s, function(a){ + as.numeric(a[1]) * 60 + as.numeric(a[2]) + }) > > >

[R] Help with time in R

2010-07-20 Thread Sarah Chisholm
Hi, I have a problem with the time formatting in R. I have entered time in the format "MM:SS.xyz" and R has automatically classified this as a factor, but I need it numerically. However when I use as.numeric() it gives me totally different numbers. Is there any way I can tell R to read thes inp

[R] help with time Series regression please

2010-01-19 Thread snowcat wong
Dear all, I am having difficulty to built a model of quarter sales of spirits data, and deciding which is the best model. The yfit2, yfit3, and yfit4 lines was not appeared right at the end. The data and script is enclosed with this email. I am using the harmonic regression model to exam

[R] Help with time series

2009-10-21 Thread ehxpieterse
Hi there, I am having trouble getting the plotting of multiple time series to work. I have used RBloomberg to download data, which I then convert to a data frame. After I have calculated my new index values, I would like to plot the new index. My problem is that I can't get the plot feature to

Re: [R] Help with time series

2009-09-28 Thread David Winsemius
On Sep 28, 2009, at 4:07 PM, steve_fried...@nps.gov wrote: Hello I'm working with a bunch of time series data. The data are downloaded from a server and stored as ascii files prior to reading them into R. After reading the data sets read into R with no problem and I can us the ts funct

[R] Help with time series

2009-09-28 Thread Steve_Friedman
Hello I'm working with a bunch of time series data. The data are downloaded from a server and stored as ascii files prior to reading them into R. After reading the data sets read into R with no problem and I can us the ts function to coerce them to time series, sometimes this works and sometime

Re: [R] help with time series

2009-01-30 Thread Gabor Grothendieck
Copy and paste this into an R session: Lines <- "Date,stage 4/2/1953,7.56 4/3/1953,7.56 4/4/1953,7.54 4/5/1953,7.53 4/6/1953,7.5 4/7/1953,7.47 4/8/1953,7.44 4/9/1953,7.41 4/10/1953,7.37 4/11/1953,7.33 4/12/1953,7.3 4/13/1953,7.26 4/14/1953,7.28 4/15/1953,7.28 4/16/1953,7.23 4/17/1953,7.47 4/18/195

Re: [R] help with time series

2009-01-30 Thread Mike Lawrence
To seperate the columns, use the "sep" argument in read.table() mystage <- read.table("C:\\Documents and Settings\\skfriedman\\Desktop\\R-scripts\\stage.txt", header = TRUE,sep=',') On Fri, Jan 30, 2009 at 4:17 PM, wrote: > > Hello everyone > > > I'm working with R 2.8.1 on a windows machine >

[R] help with time series

2009-01-30 Thread Steve_Friedman
Hello everyone I'm working with R 2.8.1 on a windows machine I have a question regarding time series analysis The first question is how does R expect the input file to be structured? I'm working with a *.txt file similar to the abbreviated one here: Date,stage 4/2/1953,7.56 4/3/1953,7.56 4/4