This should work ..
> levels(catalyst$Temp)
[1] "160" "180"
> catalyst[as.character(catalyst$Temp) == "160",]
Temp Conc Cat Yield
1 160 20 A 60
3 160 40 A 54
5 160 20 B 52
7 160 40 B 45
-----Original Message-----
From: s-news-owner@lists.biostat.wustl.edu
[mailto:s-news-owner@lists.biostat.wustl.edu]On Behalf Of Martin H. H.
Stevens
Sent: Tuesday, November 21, 2000 12:00 PM
To: Mailing List S+
Subject: [S] error in dimnames?
I am running windows 98 and S+ 2000
I have a data frame, pan2, with a factor, sp. I would like to subset the
rows where the level of sp is 33
> levels(pan$sp)
[1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11"
"12" "13" "14" "15" "16" "17" "18" "19" "20" "21" "22"
[23] "23" "24" "25" "26" "27" "28" "33" "36" "51" "148"
> pan[pan$sp=="33", 1:10]
Error in dimnames(x) <- list(rn, dimnames(x)[[2]]): Component 1 of
dimnames has length 30439, should be 4
> class(pan$sp)
[1] "factor"
>
Can anyone tell me why I get an error instead of the rows where pan$sp
is "33"?
Thanks,
Henry
--
Dr. M. Henry H. Stevens
Postdoctoral Associate
Department of Ecology, Evolution, & Natural Resources
14 College Farm Road
Cook College, Rutgers University
New Brunswick, NJ 08901-8551
email: hstevens@rci.rutgers.edu
phone: 732-932-9631
fax: 732-932-8746
---------------------------------------------------------------------
This message was distributed by s-news@lists.biostat.wustl.edu. To
unsubscribe send e-mail to s-news-request@lists.biostat.wustl.edu with
the BODY of the message: unsubscribe s-news
|