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