Re: [R] Empty Data Frame

From: Dennis Murphy <djmuser_at_gmail.com>
Date: Wed, 27 Apr 2011 02:58:31 -0700

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.
>



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. Received on Wed 27 Apr 2011 - 10:02:43 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 27 Apr 2011 - 14:30:34 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive