s-news
[Top] [All Lists]

error in dimnames?

To: Mailing List S+ <s-news@wubios.wustl.edu>
Subject: error in dimnames?
From: "Martin H. H. Stevens" <hstevens@rci.rutgers.edu>
Date: Tue, 21 Nov 2000 15:00:07 -0500
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



<Prev in Thread] Current Thread [Next in Thread>