From dwinsemius at comcast.net  Mon May 13 19:21:33 2013
From: dwinsemius at comcast.net (David Winsemius)
Date: Mon, 13 May 2013 10:21:33 -0700
Subject: [Rd] Documentation request Re: [R] recode categorial vars into
	binary data
In-Reply-To: <51893FF2.4090602@lanl.gov>
References: <A94D31B3-1F03-4D34-AEB4-57AC14091B1C@comcast.net>
	<51893FF2.4090602@lanl.gov>
Message-ID: <FC69986C-21A6-4A36-8072-9FCE81AC7BD4@comcast.net>


On May 7, 2013, at 10:54 AM, Chris Stubben wrote:

> 
>> First off, stop using cbind() when it is not needed. You will not see the reason when the columns are all numeric but you will start experiencing pain and puzzlement when the arguments are of mixed classes. The data.frame function will do what you want. (Where do people pick up this practice anyway?)
> 
> Maybe from help( data.frame)?
> 
> It's in most of the  examples and is not needed ...
> 
> L3 <- LETTERS[1:3]
>    (d <- data.frame(cbind(x=1, y=1:10), fac=sample(L3, 10, replace=TRUE)))
>        ## The same with automatic column names:
>    data.frame(cbind(  1,   1:10),     sample(L3, 10, replace=TRUE))
>    
> Chris

There are many instances of new users posting questions to R-help where they use the form:

dfrm <- data.frame(cbind(1:10, letter[1:10]) )

? and predictably get a character mode for all their columns. I was pointed to the help page for `data.frame` as one possible source of this confusion. I would like to request that the examples be changed to: 

L3 <- LETTERS[1:3]
(d <- data.frame(x = 1, y = 1:10, fac = sample(L3, 10, replace = TRUE)))

## The same with automatic column names:
data.frame( 1,   1:10,     sample(L3, 10, replace = TRUE))

--

David Winsemius
Alameda, CA, USA



[Rd] Documentation request Re: [R] recode categorial vars into binary data
David Winsemius