Re: [R] creating a data.frame from scratch

2019-04-23 Thread PIKAL Petr
R-intro which should be part of your R installation. Cheers Petr > -Original Message- > From: R-help On Behalf Of Drake Gossi > Sent: Saturday, April 20, 2019 1:40 AM > To: r-help@r-project.org > Subject: [R] creating a data.frame from scratch > > Hello everyone, &g

Re: [R] creating a data.frame from scratch

2019-04-19 Thread Jeff Newmiller
You seem to be trying to learn R ... sideways... or backwards, perhaps. Have you read An Introduction to R[1], included with every copy of the software? In particular, there are sections on data frames [2] (which should be read in the context of the discussion on lists, as it is presented. The

[R] creating a data.frame from scratch

2019-04-19 Thread Drake Gossi
Hello everyone, Is there any way to create a data.frame from scratch? other than, say, this? > structure(list(Fruit = structure(c(1L, 2L, 5L, 4L, 3L), .Label = c("apple", "banana", "kiwi", "orange", "pear"), class = "factor"), Color = structure(c(3L, 4L, 1L, 2L, 1L), .Label = c("green", "orange",

Re: [R] Creating a data.frame

2008-02-13 Thread Moshe Olshansky
Just make d <- data.frame(x,y,z). cbind forces x,y and z to be of the same type. --- Joe Trubisz <[EMAIL PROTECTED]> wrote: > OK...newbie question here. > Either I'm reading the docs wrong, or I'm totally > confused. > > Given the following: > > x<-c("aaa","bbb","ccc") > y<-rep(0,3) > z<-rep(0

Re: [R] Creating a data.frame

2008-02-13 Thread Ted Harding
On 13-Feb-08 22:17:32, Joe Trubisz wrote: > OK...newbie question here. > Either I'm reading the docs wrong, or I'm totally confused. > Given the following: > > x<-c("aaa","bbb","ccc") > y<-rep(0,3) > z<-rep(0,3) > > is.character(x) > [1] TRUE > > is.numeric(y) > [1] TRUE > > Now...I want to cre

Re: [R] Creating a data.frame

2008-02-13 Thread Andrew Robinson
Hi Joe, cbind coerces the data to be the same type. Much nicer is: d <- data.frame(x=x, y=y, z=z) Cheers Andrew On Wed, Feb 13, 2008 at 05:17:32PM -0500, Joe Trubisz wrote: > OK...newbie question here. > Either I'm reading the docs wrong, or I'm totally confused. > > Given the following: >

Re: [R] Creating a data.frame

2008-02-13 Thread Chuck Cleland
On 2/13/2008 5:17 PM, Joe Trubisz wrote: > OK...newbie question here. > Either I'm reading the docs wrong, or I'm totally confused. > > Given the following: > > x<-c("aaa","bbb","ccc") > y<-rep(0,3) > z<-rep(0,3) > > is.character(x) > [1] TRUE > > is.numeric(y) > [1] TRUE > > Now...I want to c

Re: [R] Creating a data.frame

2008-02-13 Thread Peter Alspach
quot;numeric" "numeric" HTH Peter Alspach > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Joe Trubisz > Sent: Thursday, 14 February 2008 11:18 a.m. > To: r-help@r-project.org > Subject: [R] Creating a data.frame > &g

[R] Creating a data.frame

2008-02-13 Thread Joe Trubisz
OK...newbie question here. Either I'm reading the docs wrong, or I'm totally confused. Given the following: x<-c("aaa","bbb","ccc") y<-rep(0,3) z<-rep(0,3) is.character(x) [1] TRUE is.numeric(y) [1] TRUE Now...I want to create a data frame, but keep the data types. In reading the docs, I assum