Hi
Structure is usefull for exchanging information and it is result of ?dput
function. I wonder if anybody would like to use it for **creating** data frames.
For creating data frames see functions like
?read.table,
?read.delim,
or other ?read.* functions.
Your questions are mainly adressed in
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
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
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
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:
>
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
Joe
d <- data.frame(x=x, y=y, z=z)
sapply(d, class)
x y z
"factor" "numeric" "numeric"
d <- data.frame(x=x, y=y, z=z, stringsAsFactors=F)
sapply(d, class)
x y z
"character" "numeric" "numeric"
HTH
Peter Alspach
> -Origin
7 matches
Mail list logo