[R-sig-Geo] help to obtain the list of the ID
Paul Hiemstra
p.hiemstra at geo.uu.nl
Sun Mar 15 10:57:48 CET 2009
gianni lavaredo schreef:
> Thanks in advice for your time,
>
> Sorry for this simple question I am searching a function or a method to
> obtain the list of the ID. I tryed sever combination like manual or in R
> wiki
>
>
> mfDF <- data.frame(
> ID =c(1,1,1,1,2,2,2,2,2,3,3,3,3,3,3,3,3),
> value =c(2,12,25,50,100,200,6,12,50,25,50,50,6,8,90,5,8))
>
> like this
>
>
> 1 2 3
>
> Thanks and sorry
>
> Gianni
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
Hi,
Because ID is a categorical value, it is good to make it a factor (R
type for categories). Then it is also quite easy to get the levels:
mfDF <- data.frame(
ID =as.factor(c(1,1,1,1,2,2,2,2,2,3,3,3,3,3,3,3,3)),
value =c(2,12,25,50,100,200,6,12,50,25,50,50,6,8,90,5,8))
# Get a list of the possible ID's
levels(mfDF$ID)
cheers,
Paul
--
Drs. Paul Hiemstra
Department of Physical Geography
Faculty of Geosciences
University of Utrecht
Heidelberglaan 2
P.O. Box 80.115
3508 TC Utrecht
Phone: +3130 274 3113 Mon-Tue
Phone: +3130 253 5773 Wed-Fri
http://intamap.geo.uu.nl/~paul
More information about the R-sig-Geo
mailing list