Re: [R] Empty data frame

From: Gabor Grothendieck <ggrothendieck_at_gmail.com>
Date: Thu, 7 Feb 2008 06:46:40 -0500

Try this assuming the first 15 are double and the next 15 are factor:

as.data.frame(rep(list(num = double(0), char = character(0)), each = 15))

2008/2/7 Jarosław Jasiewicz <jarekj_at_amu.edu.pl>:
> Gabor Grothendieck pisze:
>
> >> data.frame(a = character(0), b = double(0))
> >>
> > [1] a b
> > <0 rows> (or 0-length row.names)
> >
> >
> > On Feb 7, 2008 5:48 AM, Jarosław Jasiewicz <jarekj_at_amu.edu.pl> wrote:
> >
> >> Hi
> >> Sorry for banal question
> >> How to create empty data frame with for example 30 variables without
> >> typying: data.frame(x=1,y=1....)
> >> Jarek
> >>
> thanks but it is not what I need the problem is with 30 variables: I'd
> like to avoid typing (a=double(0), b=double(0)) etc... thirty times
>
>



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 Thu 07 Feb 2008 - 11:49:15 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 Thu 07 Feb 2008 - 12:30:12 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