[R] Odp: Svar: Re: help with simple R-question
Petr PIKAL
petr.pikal at precheza.cz
Wed Jun 6 12:10:12 CEST 2007
r-help-bounces at stat.math.ethz.ch napsal dne 06.06.2007 10:56:18:
> thanks, that works great!!
>
> just have another thing...i the same area
> What if the class is list instead of array, how can you name the first
> unrecognized column?
Hi
look in some intro manual and learn about R data structures. Matrix,
array, vector, data.frame, list and some others have some distinct
features and they sometimes can be interchanged and sometimes not. To
learn how objects are organised see str(), class(), typeof(), mode().
Regards
Petr
>
> Rina
>
> >>> John Kane <jrkrideau at yahoo.ca> 06/05/07 3:17 >>>
>
> --- Rina Miehs <rmi at danishmeat.dk> wrote:
>
> > hello
> >
> > what do i write for R to recognize both columns?
> >
> > In the R-script downunder you can see that i use
> > tapply to get my
> > information out of my data, and then i need to use
> > it as a dataframe
> > with both columns! It is like R is using the first
> > column as an
> > observationnumber or something, how can i change
> > that??
>
> It is using the names of the variables as rownames.
>
> try
> n.ant <- names(antall)
> antal1 <- data.frame(n.antal1, antal1)
>
>
> >
> > > antal1 <-tapply(l1$omlob1,l1$farid,length)
> > > antal1
> > 1437987 10000100 10007995 10008295 10008792
> > 10010203 10018703
> > 10033401
> > 2 3 3 2 3
> > 1 1
> > 2
> > 10048900 10050492 10055897 10076495 10081892
> > 10094801 10100692
> > 10101395
> > 3 1 3 3 6
> > 2 5
> > 20
> > 10101495 10101595 10104692 10113592 10113697
> > 10114297 10120797
> > 10120897
> > 1 5 4 2 6
> > 11 1
> > 4
> > 10121697 10121897 10121997 10133592 10142892
> > 10142995 10146495
> > 10150497
> > 16 3 6 1 1
> > 6 4
> > 4
> > 10150692 10157092 10157292 10164792 10170892
> > 10171795 10171895
> > 10172300
> > 5 2 4 4 4
> > 4 4
> > 1
> > 10175195 10187802 10192499 10192897 10198295
> > 10200493 10201693
> > 10211593
> > 1 2 2 3 5
> > 1 3
> > 5
> > > antal1 <- data.frame(antal1)
> > > antal1
> > antal1
> > 1437987 2
> > 10000100 3
> > 10007995 3
> > 10008295 2
> > 10008792 3
> > 10010203 NA
> > 10018703 NA
> > 10033401 2
> > 10048900 3
> > 10050492 1
> > 10055897 3
> > 10076495 3
> > 10081892 6
> > 10094801 2
> > 10100692 5
> >
> > Thanks
> > Rina
> >
> > [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > R-help at stat.math.ethz.ch mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide
> > http://www.R ( http://www.r/ )-project.org/posting-guide.html
> > and provide commented, minimal, self-contained,
> > reproducible code.
> >
>
>
>
> Get news delivered with the All new Yahoo! Mail. Enjoy RSS feeds
> right on your Mail page. Start today at
> http://mrd.mail.yahoo.com/try_beta?.intl=ca
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at stat.math.ethz.ch 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.
More information about the R-help
mailing list