Re: [R] empty data frame and POSIXct data types

2021-06-24 Thread Rui Barradas
iugno 2021 15.46 A: r-help@r-project.org; Stefano Sofia; r-help mailing list Oggetto: Re: [R] empty data frame and POSIXct data types 1) It _is_ a vector. Why do you think it is not a vector? 2) Your data frame has one row, with an NA in the date_POSIX column. You cannot fit a vector of length 2 a

Re: [R] empty data frame and POSIXct data types

2021-06-24 Thread Stefano Sofia
w...@dcn.davis.ca.us] Inviato: giovedì 24 giugno 2021 15.46 A: r-help@r-project.org; Stefano Sofia; r-help mailing list Oggetto: Re: [R] empty data frame and POSIXct data types 1) It _is_ a vector. Why do you think it is not a vector? 2) Your data frame has one row, with an NA in the date_POSI

Re: [R] empty data frame and POSIXct data types

2021-06-24 Thread Olivier Crouzet
Hi Stefano, my guess is that you're expecting data recycling to apply but your data frame is only one row long... therefore you can't insert a 2-row vector into a 1-row vector. Recycling won't help. You should specify the number of rows that will be required in your data frame using (e.g) rep().

Re: [R] empty data frame and POSIXct data types

2021-06-24 Thread Jeff Newmiller
1) It _is_ a vector. Why do you think it is not a vector? 2) Your data frame has one row, with an NA in the date_POSIX column. You cannot fit a vector of length 2 as a column into a data frame with only 1 row. What are you trying to do? Do you really want to end up with a 2-row data frame or a

[R] empty data frame and POSIXct data types

2021-06-24 Thread Stefano Sofia
Dear R users, I know that this question is silly (I am not a R newby) but I already wasted quite a lot of energies trying to fill in an empty data frame (with "POSIXct" "POSIXt" data type). Suppose I create mydf <- data.frame(data_POSIX=as.POSIXct(NA), value=as.numeric(NA)) day1 <- as.POSIXct("2