Re: [R] Swap variables in data.frame

2008-06-03 Thread Rogers, James A [PGRD Groton]

Birgit Lemcke wrote:

 I have a dataframe and two of my variables are in the wrong position 
 and I would like to swap those variables. 

In addition to the other solutions posted, if you prefer to reference
the columns by name rather than by index, you could use subset() 

dat - data.frame(a = letters[1:3], b = LETTERS[1:3], c = 1:3, d = 3:1)

subset(dat, select = c(b, a, c, d))
## or equivalently, something like:
subset(dat, select = c(b:a, c:d))


--Jim 

James A. Rogers, Ph.D. 
Associate Director, Neuroscience Statistics
Pfizer Global RD New London
50 Pequot Avenue (MS 6025-B2131)
New London, CT 06320
office: (860) 732-0783
cell: (860) 501-7228
fax: (860) 686-7866

 

__
R-help@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.


Re: [R] [OT] normal (as in Guassian)

2008-03-03 Thread Rogers, James A [PGRD Groton]

As someone of partly French heritage, I would also ask how this
distribution came to be called Gaussian. It seems very unfair to de
Moivre, who discovered the distribution at least half a century earlier.
:-)


--Jim Rogers 


On Mar 2, 2008, at 7:33 AM, (Ted Harding) wrote: 

 Hi Folks, 
 Apologies to anyone who'd prefer not to see this query 
 on this list; but I'm asking because it is probably the 
 forum where I'm most likely to get a good answer! 
 
 I'm interested in the provenance of the name normal 
 distribution (for what I'd really prefer to call the 
 Gaussian distribution). 
 
 According to Wikipedia, The name normal distribution 
 was coined independently by Charles S. Peirce, Francis 
 Galton and Wilhelm Lexis around 1875. 
 
 So be it, if that was the case -- but I would like to 
 know why they chose the name normal: what did they 
 intend to convey? 
 
 As background: I'm reflecting a bit on the usage in 
 statistics of everyday language as techincal terms, 
 as in significantly different. This, for instance, 
 is likely to be misunderstood by the general publidc 
 when they encounter statements in the media. 
 
 Likewise, normally distributed would probably be 
 interpreted as distributed in the way one would 
 normally expect or, perhaps, there was nothing 
 unusual about the distribution. 
 
 Comments welcome! 
 With thanks, 
 Ted. 
 

__
R-help@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.