Skip to content
Prev 298815 / 398503 Next

list to dataframe conversion-testing for identical

HI All,

Thanks for your replies.

A.K.



----- Original Message -----
From: David Winsemius <dwinsemius at comcast.net>
To: arun <smartpink111 at yahoo.com>
Cc: R help <r-help at r-project.org>
Sent: Sunday, July 1, 2012 6:31 PM
Subject: Re: [R] list to dataframe conversion-testing for identical
On Jul 1, 2012, at 5:09 PM, David L Carlson wrote:

            
Yes, arun. If the coding had proceeded otherwise a more natural and expected result might have occurred:
? ? ?  Var1 Var2 Var3
1? 21.14076? ? A? ? 1
2? 19.53277? ? B? ? 2
3? 19.59725? ? A? ? 3
4? 19.84262? ? B? ? 4
5? 19.93251? ? A? ? 5
6? 20.92242? ? B? ? 1
7? 19.22315? ? A? ? 2
8? 19.13742? ? B? ? 3
9? 18.82441? ? A? ? 4
10 20.92661? ? B? ? 5

Whoever taught you to use 'cbind' for construction of data.frames did you a great disservice. It would seem much less problematic to have simply done this in the first place:

dat1 <- data.frame(Var1=rnorm(10,20),Var2=rep(LETTERS[1:2],5),var3=rep(1:5,2) )

--David.
David Winsemius, MD
West Hartford, CT