[R] dropping rows
Peter Alspach
PAlspach at hortresearch.co.nz
Thu Dec 2 03:17:28 CET 2004
Tobias
I remember finding Patrick Burns' "S Poetry" (see http://www.burns-stat.com/ ) worth reading - and it covers this sort of thing nicely.
Peter Alspach
>>> Tobias Muhlhofer <t.muhlhofer at lse.ac.uk> 02/12/04 13:57:47 >>>
Thanks.
The problem is that there is extremely little on dataframes or matrices
in "An Intro to R", which I did read and I frankly don't know where else
to go.
Once I know a function like subset() exists, I can then read the help
files on it and that's fine, but I would never dream this function up
myself...
As for indexing, I DID read "An Introduction to R" and I did NOT catch
the part where it says you can use any variable in the dataframe to
index it, nor would I have thought of it by myself. From that
documentation, I only learned about using row-labels to index things...
But I am definitely thankful for the quick help given to me by people on
this list, and so I guess being RTFM'ed is a small price to pay for
figuring out how to solve the problem I need to solve.
Toby
Jeff Laake wrote:
> Here's an example:
>
> earlydata=data[data$year<1960,]
>
> Lookup help and read manuals on manipulating dataframes.
>
>
> Tobias Muhlhofer wrote:
>
>> Hi!
>>
>> Sorry for asking a trivial questions, but I can't seem to figure this
>> out.
>>
>> I have a dataframe called master containing 30-odd variables.
>>
>> In this dataframe, I have observations across these 30 variables from
>> 1930 to 2003 (I've made a "year" variable). How can I drop all rows
>> for which the year is less than 1960? I'm assuming something with
>> ifelse() but I can't quite figure it out.
>>
>> I would appreciate a suggestion of some syntax.
>>
>> Thanks!
>> Toby
>>
>> ______________________________________________
>> 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
>
>
>
>
>
--
**************************************************************************
When Thomas Edison invented the light bulb he tried over 2000
experiments before he got it to work. A young reporter asked
him how it felt to have failed so many times. He said
"I never failed once. I invented the light bulb.
It just happened to be a 2000-step process."
______________________________________________
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
______________________________________________________
The contents of this e-mail are privileged and/or confidenti...{{dropped}}
More information about the R-help
mailing list