[R] Simple Question: adding points to a boxplot
David Winsemius
dwinsemius at comcast.net
Sat Aug 8 00:57:54 CEST 2009
On Aug 7, 2009, at 6:43 PM, Farley, Robert wrote:
> I apologize in advance for the simplicity of this question. I use R
> 2-3 times a year, and I seem to forget more in the intervening
> months than I learn during my days of panicked reading.... I HAVE
> tried looking at the help resources; I'm just not very good at
> understanding them.
>
> I have a dataframe with 18 observations of 5 different things, and a
> second dataframe with and estimate for those 5 things. I'm trying
> to add the estimated points to the boxplot of observations. I THINK
> I'm failing because I need to decompose my estimated dataframe into
> two vectors. I can't seem to figure out how to do that properly, or
> if I'm suffering from a different misunderstanding....
>
Obs1 <-read.table(textConnection(" Blue Green Red Gold Orange
1 77902 32911 117543 18245 NA
2 77294 32204 114927 18377 NA
3 75737 31484 115265 18529 NA
4 73366 31130 112371 14748 NA
5 77061 33601 118113 16910 16360
6 75177 32383 113825 14417 15492
7 76766 35697 124304 16318 16100
8 80378 36374 128091 15325 17636
9 84078 37473 138219 15769 18242
10 81704 37247 136345 15587 18700
11 84554 39134 143830 18078 21828
12 80411 37487 137583 18771 20844
13 76103 34734 131469 20329 20760
14 76246 34591 127921 18874 19531
15 72025 33645 118279 20972 21005
16 72295 35153 121752 18035 20217
17 71287 32961 121958 17768 20659
18 71778 32833 123990 17956 19004"), header=TRUE)
Est1<-read.table(textConnection(" Blue Green Red Gold Orange
1 72289 32444 107121 20900 21962"), header=TRUE)
boxplot(Obs1)
points(1:5, Est1, pch=23, col="red")
>>
>> points(Est1, pch=23, col="red")
I think you are only supplying y values with no x values:
Try:
points(1:5, Est1, pch=23, col="red")
>>
> ======================================
>
>
>
>
>
>
> Robert Farley
> Metro
> 1 Gateway Plaza
> Mail Stop 99-23-7
> Los Angeles, CA 90012-2952
> Voice: (213)922-2532
> Fax: (213)922-2868
> www.Metro.net
>
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.
David Winsemius, MD
Heritage Laboratories
West Hartford, CT
More information about the R-help
mailing list