On Thu, 23 Sep 2010, Peter Ehlers wrote:
On 2010-09-21 5:51, Nikhil Kaza wrote:
example(factor)
iris1$Species<- factor(iris1$Species, drop=T)
will get you what you need.
Hmm, doesn't work for me. ?factor does not list a 'drop='
argument.
I suspect
iris1$Species <- [iris1$Species, drop=TRUE]
was meant. See ?`[.factor` .
-Peter Ehlers
Nikhil Kaza
Asst. Professor,
City and Regional Planning
University of North Carolina
nikhil.l...@gmail.com
On Sep 21, 2010, at 7:41 AM, pdb wrote:
I'm confused, hope someone can point out what is not obvious to me.
I thought I was creating a new data frame by 'deleting' rows from an
existing dataframe - I've tried 2 methods.
But this new data frame seems to remember values from its parent -
even
though there are no occurences.
Where does it get the values versicolor and virginica from and give
then a
count of 0?
What am I missing?
Thanks in advance.
summary(iris$Species)
setosa versicolor virginica
50 50 50
nrow(iris)
[1] 150
iris1<- iris[iris$Species == 'setosa',]
nrow(iris1)
[1] 50
summary(iris1$Species)
setosa versicolor virginica
50 0 0
boxplot(Petal.Width ~ Species, data = iris1, plot=1)
iris2<- subset(iris, Species == 'setosa')
nrow(iris2)
[1] 50
summary(iris2$Species)
setosa versicolor virginica
50 0 0
boxplot(Petal.Width ~ Species, data = iris2, plot=1)
--
View this message in context:
http://r.789695.n4.nabble.com/removed-data-is-still-there-tp2548440p2548440.html
Sent from the R help mailing list archive at Nabble.com.
______________________________________________
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.
______________________________________________
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.
--
Brian D. Ripley, rip...@stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
______________________________________________
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.