[R] indexing question

Bunny, lautloscrew.com bunny at lautloscrew.com
Tue Jan 13 10:51:16 CET 2009


Dear Thierry,

thx for your help, this exactly what i was looking for.
For other beginners reading this: dont name your data "data". My bad  
dont call it like that. use "dataset" or whatever instead.



Am 13.01.2009 um 10:38 schrieb ONKELINX, Thierry:

> Dear Bunny,
>
> You need to add a comma: data[data$particularcol ==1, ]
>
> data[put here the conditions for rows, put here conditions for  
> columns].
>
>
> HTH,
>
> Thierry
>
> ------------------------------------------------------------------------
> ----
> ir. Thierry Onkelinx
> Instituut voor natuur- en bosonderzoek / Research Institute for Nature
> and Forest
> Cel biometrie, methodologie en kwaliteitszorg / Section biometrics,
> methodology and quality assurance
> Gaverstraat 4
> 9500 Geraardsbergen
> Belgium
> tel. + 32 54/436 185
> Thierry.Onkelinx at inbo.be
> www.inbo.be
>
> To call in the statistician after the experiment is done may be no  
> more
> than asking him to perform a post-mortem examination: he may be able  
> to
> say what the experiment died of.
> ~ Sir Ronald Aylmer Fisher
>
> The plural of anecdote is not data.
> ~ Roger Brinner
>
> The combination of some data and an aching desire for an answer does  
> not
> ensure that a reasonable answer can be extracted from a given body of
> data.
> ~ John Tukey
>
> -----Oorspronkelijk bericht-----
> Van: r-help-bounces at r-project.org [mailto:r-help-bounces at r- 
> project.org]
> Namens Bunny, lautloscrew.com
> Verzonden: dinsdag 13 januari 2009 10:26
> Aan: r-help at r-project.org
> Onderwerp: [R] indexing question
>
> Hi all,
>
> i have a pretty easy indexing question, at least i believe so. The
> main reason i post it here, is that brackets and $ are hard to google.
>
> How do I index correctly, if i just want to display the whole dataset
> conditioned on the fact that some particular column equals one.
>
> I know i can do something like:   data$somecolumn[data$particularcol
> ==1] . That will show all "some column" values where the particular
> column is 1.
> Unfortunately something like : data[data$particularcol ==1] does not
> work to get the whole matrix.
>
> is there some easy way except the % in % stuff ?
>
> Thx in advance
>
> ______________________________________________
> R-help at 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.
>
> Dit bericht en eventuele bijlagen geven enkel de visie van de  
> schrijver weer
> en binden het INBO onder geen enkel beding, zolang dit bericht niet  
> bevestigd is
> door een geldig ondertekend document. The views expressed in  this  
> message
> and any annex are purely those of the writer and may not be regarded  
> as stating
> an official position of INBO, as long as the message is not  
> confirmed by a duly
> signed document.




More information about the R-help mailing list