Re: [R] why is this a factor?

2013-08-29 Thread Rolf Turner
On 29/08/13 12:10, Ista Zahn wrote: On Wed, Aug 28, 2013 at 7:44 PM, Steve Lianoglou lianoglou.st...@gene.com wrote: Hi, On Wed, Aug 28, 2013 at 3:58 PM, Ista Zahn istaz...@gmail.com wrote: Or go all the way and put options(stringsAsFactors = FALSE) at the top your script or in your

Re: [R] why is this a factor?

2013-08-29 Thread Steve Lianoglou
Hi, On Thu, Aug 29, 2013 at 3:03 PM, Rolf Turner rolf.tur...@xtra.co.nz wrote: On 29/08/13 12:10, Ista Zahn wrote: On Wed, Aug 28, 2013 at 7:44 PM, Steve Lianoglou lianoglou.st...@gene.com wrote: Hi, On Wed, Aug 28, 2013 at 3:58 PM, Ista Zahn istaz...@gmail.com wrote: Or go all the way

[R] why is this a factor?

2013-08-28 Thread Ed Siefker
I have a table, and I want a new column to add some annotations to. But it ends up as a factor instead of characters, and won't let me add arbitrary text. data(iris) iris-data.frame(iris,annot=c()) iris[1,annot]-annotation Warning message: In `[-.factor`(`*tmp*`, iseq, value = annotation) :

Re: [R] why is this a factor?

2013-08-28 Thread Nordlund, Dan (DSHS/RDA)
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of Ed Siefker Sent: Wednesday, August 28, 2013 1:57 PM To: r-help@r-project.org Subject: [R] why is this a factor? I have a table, and I want a new column to add some annotations

Re: [R] why is this a factor?

2013-08-28 Thread Sarah Goslee
Hi Ed, Because that's the default for data.frame(), and a lot of people trip over it just as you did. It's an easy fix: R data(iris) R iris - data.frame(iris, annot=c(), stringsAsFactors=FALSE) R iris[1,annot]-annotation Thanks for the very useful reproducible example. Sarah On Wed, Aug 28,

Re: [R] why is this a factor?

2013-08-28 Thread arun
-help@r-project.org Cc: Sent: Wednesday, August 28, 2013 4:56 PM Subject: [R] why is this a factor? I have a table, and I want a new column to add some annotations to. But it ends up as a factor instead of characters, and won't let me add arbitrary text. data(iris) iris-data.frame(iris,annot=c

Re: [R] why is this a factor?

2013-08-28 Thread Ista Zahn
...@gmail.com To: r-help@r-project.org Cc: Sent: Wednesday, August 28, 2013 4:56 PM Subject: [R] why is this a factor? I have a table, and I want a new column to add some annotations to. But it ends up as a factor instead of characters, and won't let me add arbitrary text. data(iris) iris

Re: [R] why is this a factor?

2013-08-28 Thread Steve Lianoglou
Hi, On Wed, Aug 28, 2013 at 3:58 PM, Ista Zahn istaz...@gmail.com wrote: Or go all the way and put options(stringsAsFactors = FALSE) at the top your script or in your .Rprofile. This will prevent this kind of annoyance in the future without having to say stringsAsFactors = FALSE all the