[R] Issues with Legend symbols

Phil Spector spector at stat.berkeley.edu
Tue Sep 28 00:11:38 CEST 2010


The expression 19:15:21:22 evaluates as follows:

> 19:15:21:22
[1] 19 20 21 22
Warning messages:
1: In 19:15:21 : numerical expression has 5 elements: only the first used
2: In 19:15:21:22 :

The expression 2:2:2:2 evaluates as follows:

> 2:2:2:2
[1] 2

I'm *guessing* you mean

> c(19,15,21,22)
[1] 19 15 21 22
and
> c(2,2,2,2)
[1] 2 2 2 2
or 
> rep(2,4)
[1] 2 2 2 2

I would ignore any other advice you got from the source that 
advised you to use expressions like 19:15:21:22 in R.

 					- Phil Spector
 					 Statistical Computing Facility
 					 Department of Statistics
 					 UC Berkeley
 					 spector at stat.berkeley.edu



On Mon, 27 Sep 2010, beloitstudent wrote:

>
> Hello forum!
> I am currently having trouble getting R to recognize one of my pch
> characters.  Here's what I have:
>
> legend(120, 40, c("SAL-arterial", "SAL-portal", "GLP-1-arterial",
> "GLP-1-portal"), bty="n", col=c("black"), pch=19:15:21:22, pt.bg="white",
> pt.cex=2:2:2:2, lty=1, lwd=2, text.col="black", cex=1.3)
>
> Now, SAL-arterial and SAL-portal should be a black circle and square,
> respectively.  GLP-1-arterial and GLP-1 portal should be a white circle and
> square respectively.
>
> The error message I am getting is
> "Warning messages:
> 1: In 19:15:21 : numerical expression has 5 elements: only the first used
> 2: In 19:15:21:22 :
>  numerical expression has 3 elements: only the first used"
>
> The SAL-arterial, GLP-1-arterial, and GLP-1-portal all are correct, however,
> SAL-portal is not recognized and a small, black circle is placed there
> instead of the black square that it should be.
> How do I get the legend to match my data?  Thanks in advance for your help!
> -- 
> View this message in context: http://r.789695.n4.nabble.com/Issues-with-Legend-symbols-tp2716308p2716308.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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.
>



More information about the R-help mailing list