Hi Jon,
zoo is great for tasks like this, not just for na.approx. :)
I would approach the problem like this:
library(zoo)
# put lightdata into a zoo object
z <- with(lightdata, zoo(light,
as.POSIXct(paste(date, time), format="%m/%d/%y %H:%M:%S")))
# merge the above zoo object with an "empty" z
al Message-
> From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
> project.org] On Behalf Of Benstead, Jonathan
> Sent: Tuesday, February 12, 2013 12:19 AM
> To: r-help@r-project.org
> Subject: [R] Inserting rows of interpolated data
>
> Dear help list - I have light dat
Dear help list - I have light data with 5-min time-stamps. I would like to
insert four 1-min time-stamps between each row and interpolate the light data
on each new row. To do this I have come up with the following code:
lightdata <- read.table("Test_light_data.csv", header = TRUE, sep = ",") #
?rbind
df1 <- data.frame(matrix(rep(0,9),nrow=3))
names(df1) <- c("x1","x2","x3")
rbind(df,df1)
--- On Fri, 10/23/09, Ashta wrote:
> From: Ashta
> Subject: [R] Inserting rows
> To: "R help"
> Received: Friday, October 23, 2009,
Try this:
rbind(df, matrix(0, 3, 3, dimnames = list(NULL, names(df
On Fri, Oct 23, 2009 at 11:44 AM, Ashta wrote:
> Hi all,
>
> I have the data set df with three varaibles,
>
> x1 x2 x3
> 1 2 5
> 2 4 1
> 5 6 0
> 1 1 2
>
> I want to insert more rows ( eg, 3 rows with value fill
Hi all,
I have the data set df with three varaibles,
x1 x2 x3
1 2 5
2 4 1
5 6 0
1 1 2
I want to insert more rows ( eg, 3 rows with value filled with zeros)
1 2 5
2 4 1
5 6 6
1 1 2
0 0 0
0 0 0
0 0 0
Can any body help me out?
Thanks
__
6 matches
Mail list logo