[R] If Statement Help

Jorge Ivan Velez
Sun, 24 Oct 2010 02:37:31 -0000

Hi Jay,

If "x" is your data, you could use subset() to do what you want:

subset(x, Price > 100)

See ?subset for more information.

HTH,
Jorge


On Sat, Oct 23, 2010 at 9:56 PM, Jason Kwok <> wrote:

>                    Price
> 2010-10-11     99
> 2010-10-12    101
> 2010-10-13    102
> 2010-10-14    103
> 2010-10-15     99
> 2010-10-18     98
> 2010-10-19     97
> 2010-10-20    101
> 2010-10-21    101
> 2010-10-22    101
>
> I have this dataset and I only want to return instances when the Price is
>
> 100.
>
> If I use the code: Price > 100 then it will evaluate each entry as
"TRUE"
> or
> "FALSE".  What is the code to only return "TRUE"
results?
>
> Thanks,
>
> Jay
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@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.
>

	[[alternative HTML version deleted]]