Thanks David & Henrique,
I've been using R for over two years and always used cbind or rbind, that
was what I was taught by several folk, and on training courses, you learn
something new every day!
Cheers,
Ross
--
View this message in context:
http://r.789695.n4.nabble.com/Simple-loop-code-t
On Apr 29, 2010, at 1:42 PM, Henrique Dallazuanna wrote:
On Thu, Apr 29, 2010 at 12:05 PM, David Winsemius > wrote:
snipped
##Then bind to your data
z <- cbind(y,x)
Oooh. Not a good practice, at least for the newish useR. cbind and
rbind create matrices and as a consequence coerce a
On Thu, Apr 29, 2010 at 12:05 PM, David Winsemius wrote:
>
> On Apr 29, 2010, at 10:37 AM, RCulloch wrote:
>
>
>> Thanks Henrique,
>>
>> that works! for anyone else as slow as me, just:
>>
>> ##Assign
>> x <- factor(dat.ID$ID2, labels = 1:7)
>> ##Convert to dataframe
>> x <- as.data.frame(x)
>>
>
On Apr 29, 2010, at 10:37 AM, RCulloch wrote:
Thanks Henrique,
that works! for anyone else as slow as me, just:
##Assign
x <- factor(dat.ID$ID2, labels = 1:7)
##Convert to dataframe
x <- as.data.frame(x)
The more typical methods for converting a factor to a character vector
would be:
(
Thanks Henrique,
that works! for anyone else as slow as me, just:
##Assign
x <- factor(dat.ID$ID2, labels = 1:7)
##Convert to dataframe
x <- as.data.frame(x)
##Then bind to your data
z <- cbind(y,x)
Thanks again, I expected it to be more complicated!
Cheers,
Ross
--
View this message in
Try this:
factor(dat.ID$ID2, labels = 1:7)
On Thu, Apr 29, 2010 at 8:39 AM, RCulloch wrote:
>
> Hi fellow R Users,
>
> I find that I typically rewrite my data specific to data in columns, which
> is by no means efficient and I am struggling to break out of this bad habit
> and utalise some of t
6 matches
Mail list logo