Message-ID: <514ACD30.1040800@bitwrit.com.au>
Date: 2013-03-21T09:04:48Z
From: Jim Lemon
Subject: boxplot
In-Reply-To: <1363855259.58591.YahooMailNeo@web121501.mail.ne1.yahoo.com>
On 03/21/2013 07:40 PM, carol white wrote:
> Hi,
> It must be an easy question but how to boxplot a subset of data:
>
> data = read.table("my_data.txt", header = T)
> boxplot(data$var1[data$loc == "nice"]~data$loc_type[data$loc == "nice"])
> #in this case, i want to display only the boxplot loc == "nice"
> #doesn't display the boxplot of only loc == "nice". It also displays loc == "mice"
>
Hi Carol,
It's them old factors sneakin' up on you. Try this:
boxplot(data$var1[data$loc == "nice"]~
as.character(data$loc_type[data$loc == "nice"]))
Jim