[R-sig-eco] assign unique pch characters to a string of rows

"José M. Blanco Moreno" jmblanco at ub.edu
Fri Oct 1 09:37:18 CEST 2010


  Hello,
Sometimes I have used a named vector of pch such as:
pch.vec <- c('june_2728'=1,'june_2829'=6, 
'june_29'=8,'july_01'=15,'july_14' =17)

and, suposing that these dates are stored in a vector called date, then 
use them as follows:

plot(data$sarp_avg ~data$cstar_avg, xlim=c(0,3), ylim=c(0,3.5), xlab="CSTAR LAI", ylab="SARP LAI", main="PISTACHIOS JUNE 27- JULY 14",
pch=pch.vec[date])

(a quick answer with no checking, use with caution!)




Al 30/09/2010 22:53, En/na jenna martin ha escrit:
> Hi -
>
> I am trying to assign a unique pch character to 5 different sections of one
> row.
> For example, in my data set, i would like a unique character representing
> each group of rows (one character rep's the multiple values for each date,
> so 5 unique values for 5 dates)
>
> rows 1:26 are attached to june_2728, and
> rows 27:78 are june_2829
> rows 79:104 are june_29
> rows 105:114 are july_01
> rows 115:146 are july_14
>
> I tried
>
>> plot(data$sarp_avg ~data$cstar_avg, xlim=c(0,3), ylim=c(0,3.5),
> xlab="CSTAR LAI", ylab="SARP LAI", main="PISTACHIOS JUNE 27- JULY 14",
> pch=c(1,6,8,15,17))
>
>
> but I have a feeling it is just recycling the 5 pch values, instead of
> assigning them to the specific string of rows.
>
> Thanks for any help you might have!!
>
> 	[[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-ecology mailing list
> R-sig-ecology at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology

-- 
---------------------------------------
José M. Blanco-Moreno

Dept. de Biologia Vegetal (Botànica)
Facultat de Biologia
Universitat de Barcelona
Av. Diagonal 645
08028 Barcelona
SPAIN
---------------------------------------

phone: (+34) 934 039 863
fax: (+34) 934 112 842



More information about the R-sig-ecology mailing list