[R] extract values ​​for the dates and a new column

Jeff Newmiller jdnewmil at dcn.davis.ca.us
Wed Mar 14 17:10:55 CET 2012


The error seems clear enough to me... you are trying to mix vectors of different lengths where one length is not a multiple of the other length.

Your discussion is pretty confused though, referring to possible data frames x, x.sub, x.res and Dataset. You might benefit from reviewing ?str and ?dput for future posts.
---------------------------------------------------------------------------
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.

RMSOPS <ricardosousa2000 at clix.pt> wrote:

>
>#add column Start
>Hello
>
>Good Afternoon I am trying to create a new column in the data frame,
>the
>target is based on a column of dates to extract a value of life and add
>a
>new column to data frame
>
>f<-x.res$T-x.res$duration
>Dataset$StarEvent<-(as.character.POSIXt(f))
>
>
>x.sub$T is:
>[1] "2006-10-31 20:10:35 EST" "2006-10-31 20:11:08 EST" "2006-10-31
>20:11:21
>EST"
> [4] "2006-10-31 20:12:16 EST" "2006-10-31 20:13:20 EST" "2006-10-31
>20:13:28 EST"
>
>x$duration
>159
>234
>345
>35
>544
>
>
>Error in `$<-.data.frame`(`*tmp*`, "StarEvent", value = c("2006-10-31
>20:08:03",  : 
>  replacement has 18 rows, data has 103)
>
>--
>View this message in context:
>http://r.789695.n4.nabble.com/extract-values-for-the-dates-and-a-new-column-tp4472052p4472052.html
>Sent from the R help mailing list archive at Nabble.com.
>
>______________________________________________
>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