Dear list,

I'm working with a large data set, where I grouped several species in one
group (guild). Then I reshaped my data as shown below. Now, I just want to
have "Rep" only as 1 or 0.

I'm not being able to change the values of rep>=1 to 1... tried many things
and I'm not being successful!


> melting=melt(occ.data,id.var=c("guild", "Site", "Rep", "Año"),
measure.var="Pres")
> y=cast(melting, Site ~ Rep ~ guild ~ Año)
Aggregation requires fun.aggregate: length used as default

> y[1:10,,"gui4a",1:2]
, , Año = 2003

      Rep
Site   1 2 3 4 5
  1021 0 0 0 0 0
  1022 0 0 0 0 0
  1023 0 0 0 0 0
  1024 0 0 0 0 0
  1025 0 0 0 0 0
  1026 0 0 0 0 0
*  1051 3 1 2 3 5*
*  1052 4 3 5 2 3*
*  1053 4 3 3 3 2*
*  1054 1 2 1 3 0*

, , Año = 2004

      Rep
Site   1 2 3 4 5
  1021 2 5 5 5 4
  1022 6 3 2 2 2
  1023 4 1 1 2 2
  1024 0 1 2 2 0
  1025 0 1 0 1 0
  1026 2 1 0 0 1
  1051 2 1 3 1 2
  1052 2 4 1 1 2
  1053 2 4 2 2 1
  1054 4 3 3 2 3

        [[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.

Reply via email to