Hi David,
On Thursday, February 09, 2012 01:21:48 PM David Studer wrote:
> Hello everybody!
>
> Let's assume I have the following factor with it's levels:
>
> a<-factor(c(2,3,3,2,4,2,3,2,2,2,3,2,3))
> mydata<-data.frame(a)
#You need to specify levels and labels here, like this:
a <- factor(c(2
Hi
>
> Hello everybody!
>
> Let's assume I have the following factor with it's levels:
>
> a<-factor(c(2,3,3,2,4,2,3,2,2,2,3,2,3))
> mydata<-data.frame(a)
>
> When I plot the vector "a" using
>
> barplot(table(mydata$a)
>
> unfortunately the value "1" does not
> show up, as it does not appea
Hello everybody!
Let's assume I have the following factor with it's levels:
a<-factor(c(2,3,3,2,4,2,3,2,2,2,3,2,3))
mydata<-data.frame(a)
When I plot the vector "a" using
barplot(table(mydata$a)
unfortunately the value "1" does not
show up, as it does not appear in my data.
But still, it theor
Thanks for the fast response and your comments!
That works perfect!
Another little mystery solved ;)
Stefan
From: Felipe Carrillo [mailto:mazatlanmex...@yahoo.com]
Sent: Tuesday, November 01, 2011 3:54 PM
To: Schreiber, Stefan; r-help@r-project.org
Subject: Re: [R] factor level
e Interior
US Fish & Wildlife Service
California, USA
http://www.fws.gov/redbluff/rbdd_jsmp.aspx
From: "Schreiber, Stefan"
>To: r-help@r-project.org
>Sent: Tuesday, November 1, 2011 2:28 PM
>Subject: [R] factor level issue after subsetting
>
>Dear list,
>
>I cannot
first of all, the subsetting line is overly complicated.
dat.sub<-dat[dat$treat!='cont',]
will work just fine. R does exactly what you're describing. It knows
the levels of the factor. Once you remove 'cont' from the data, that
doesn't mean that the level is removed from the factor:
> df<-dat
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
> project.org] On Behalf Of Schreiber, Stefan
> Sent: Tuesday, November 01, 2011 2:29 PM
> To: r-help@r-project.org
> Subject: [R] factor level issue after subsetting
>
> Dear li
Dear list,
I cannot figure out why, after sub-setting my data, that particular item
which I don't want to plot is still in the newly created subset (please
see example below). R somehow remembers what was in the original data
set. A work around is exporting and importing the new subset. Then it's
Arthur Burke wrote:
>
> ... I get the four lines that I expected but the legend includes the
> Group level "cohort 4" .
>
> How can I get rid of "cohort 4" in Group?
>
This link might be of interest for you:
http://wiki.r-project.org/rwiki/doku.php?id=tips:data-manip:drop_unused_levels
ht
t;
Date: Wed, 27 May 2009 11:46:12
To:
Subject: [R] Factor level with no cases shows up in a plot
Consider this data structure (df1) ...
Group Year PctProf FullYr
1 Never RF 2004 87 88
2 Cohort 1 2004 83 84
3 Cohort 2 2004 84 86
4 Cohort 3 2004 87
Consider this data structure (df1) ...
Group Year PctProf FullYr
1 Never RF 2004 87 88
2 Cohort 1 2004 83 84
3 Cohort 2 2004 84 86
4 Cohort 3 2004 87 87
5 Cohort 4 2004 73 74
6 Never RF 2005 85 86
7 Cohort 1 2005 81 82
8
Dear phoebe,
See
http://cran.r-project.org/doc/FAQ/R-FAQ.html#How-do-I-convert-factors-to-numeric_003f
HTH,
Jorge
On Fri, May 1, 2009 at 4:15 PM, phoebe kong wrote:
> Hi All,
>
> I have problem about the factor features.
>
> I read in a .cvs file, a column which is supposed to be numeric, but
You need to fix this.
Bert Gunter
Nonclinical Biostatistics
467-7374
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of phoebe kong
Sent: Friday, May 01, 2009 1:16 PM
To: r-help
Subject: [R] factor level
Hi All,
I have problem a
Tell me how this works out for you. I think R is seeing your "newXaxis"
variable as a character variable because there is some non-numeric string
in there, then it converts to factor. Try setting stringsAsFactors=FALSE
in the read.csv and see if it is then read as character. If it is, try
yo
Hi All,
I have problem about the factor features.
I read in a .cvs file, a column which is supposed to be numeric, but it
becomes factor level data after reading in.
mydata[,"newXaxis"]
[1] 0 0.430010601 11.23198508 25.00940297 37.75338045
45.98289639
[7] 48.92328133 52.51142822 61
15 matches
Mail list logo