[R] Empty Data Frame
Dennis Murphy
djmuser at gmail.com
Wed Apr 27 11:58:31 CEST 2011
Hi:
You could try something like
df <- data.frame( expand.grid( Week = 1:52, Year = 2002:2011 ))
dim(df)
head(df)
The first variable changes faster than the second.
HTH,
Dennis
On Wed, Apr 27, 2011 at 1:03 AM, Santosh Srinivas
<santosh.srinivas at gmail.com> wrote:
> Dear Group,
>
> Is there a more efficient way to create a data frame structure (using rep I
> guess?)
>
> require(plyr)
>
> week <- rdply(10, data.frame(week = 1:52))
> names(week) <- c("Year", "Week")
> week$Year <- week$Year + 2000
>
> Basically trying to create a year and week data frame to start appending
> data to for a ggplot.
>
> Many thanks.
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> 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