yeah... its early sorry about that!


df[df$A==5 & df$B==6,]


On Tue, Jan 24, 2012 at 7:38 AM, David Winsemius <dwinsemius@comcast.net>wrote:

>
> On Jan 24, 2012, at 10:08 AM, Justin Haynes wrote:
>
>  http://bit.ly/AxvW9x
>>
>> or less snidely...
>>
>> if you data is in a data.frame df:
>>
>> df[df$A==5 && df$B==6,]
>>
>> selects rows where column A is 5 and where column B is 6.
>>
>
> Julian;
>
> Just because someone tells you something on a mailing list doesn't mean
> it's correct. Consult:
>
> ?"&"
>
> --
> David.
>
>>
>>
>>
>> On Tue, Jan 24, 2012 at 6:01 AM, crimsonengineer87 <
>> julianjonreyes@gmail.com
>>
>>> wrote:
>>>
>>
>>  All,
>>>
>>> I currently have a dataset with a variety of different columns, let's
>>> say,
>>> A,B,C, and D. I'd like to run an R script that graphs only certain rows
>>> of
>>> the dataset based on what's in column A. In awk, it'd be something like:
>>>
>>> awk ' { if(A==5 && B ==6) print $0 } ' datafile | command or file
>>>
>>> Since I have just begun using R, I am unsure if awk is compatible in R or
>>> how I would use an "if' statement as suggested above. I'd like to read
>>> in a
>>> table of data, but while plotting, only plot a certain row based on
>>> certain
>>> conditions (i.e. column A==6 and etc).
>>>
>>> I would appreciate any input. And yes, I did a search of the forums, but
>>> was
>>> still confused as the implementation. Thanks in advance.
>>>
>>> Julian
>>>
>>> --
>>> View this message in context:
>>> http://r.789695.n4.nabble.com/**data-extraction-in-R-**
>>> tp4323803p4323803.html<http://r.789695.n4.nabble.com/data-extraction-in-R-tp4323803p4323803.html>
>>> Sent from the R help mailing list archive at Nabble.com.
>>>
>>> ______________________________**________________
>>> R-help@r-project.org mailing list
>>> https://stat.ethz.ch/mailman/**listinfo/r-help<https://stat.ethz.ch/mailman/listinfo/r-help>
>>> PLEASE do read the posting guide
>>> http://www.R-project.org/**posting-guide.html<http://www.R-project.org/posting-guide.html>
>>> and provide commented, minimal, self-contained, reproducible code.
>>>
>>>
>>        [[alternative HTML version deleted]]
>>
>>
>> ______________________________**________________
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/**listinfo/r-help<https://stat.ethz.ch/mailman/listinfo/r-help>
>> PLEASE do read the posting guide http://www.R-project.org/**
>> posting-guide.html <http://www.R-project.org/posting-guide.html>
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
> David Winsemius, MD
> West Hartford, CT
>
>

	[[alternative HTML version deleted]]

