Re: [R-sig-eco] random effects in a linear mixed model

2011-08-20 Thread Christian Parker
Edgar, Based on the information provided its difficult to thoroughly answer your question. But I will assume that you have samples within each year, say weekly or monthly. Based on this I would say that you can treat the years as a random effect but I dont think that I would do it the way that you

Re: [R-sig-eco] subsetting data in R

2011-04-24 Thread Christian Parker
You are creating a new object, but the columns that are stored as factors are not being 'refactored' so you are retaining the original list of levels. To fix this you can use the factor function after you subset pa2 = subset(pa, influencia=="AID") pa2$influencia<-as.factor(pa2$influencia) On

Re: [R-sig-eco] get common sampling sites from two data sets

2011-03-17 Thread Christian Parker
Etienne Laliberté wrote: Here's one way. # create matrices x and y with some sites in common x <- matrix(1, 4, 2) ; rownames(x) <- letters[1:4] y <- matrix(1, 4, 2) ; rownames(y) <- letters[3:6] # identify which sites are in common for x and y xcommon <- rownames(x) %in% rownames(y) ycommon <-

Re: [R-sig-eco] change values of a vector selectively

2011-01-11 Thread Christian Parker
Mango, I believe what you have is the right idea. There are some things you could do that might speed it up. For example, don't search for c('B',1,2), r will need to convert those all to characters first. Instead ask if exp$marker=='0'. Another thing you could do is create an empty vector to sto

Re: [R-sig-eco] change values of a vector selectively

2011-01-11 Thread Christian Parker
On Jan 11, 2011, at 6:58 AM, "B.-Markus Schuller" wrote: > Hey, > > I have a vector containing mostly zeroes. At varying positions are markers > that mark different channels ("B", 1, 2). > > > head(exp$Marker, 100) > [1] "B" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0"

Re: [R-sig-eco] scatter plot of coordinates

2010-01-27 Thread Christian Parker
Julia, ## Lets say that you read your data in and called it x x<-read.csv("mydata.csv") ## and that dataset had 3 columns in it; date, lat and long plot(lat~long,x) ## or plot(x$lat~x$long) ## or plot(x$long, x$lat) ## for more help with the plot function (additional arguments and the like) ente

Re: [R-sig-eco] a question of Data quotation

2009-11-30 Thread Christian Parker
Zongshan, When you use cbind, R will combine them as a matrix and unfortunately the $ way of indexing columns does not work for matrices. A better way to get what you want would be like this: data<-data.frame(jan=npp$JAN,feb=npp$FEB) Hope this helps, Chris Zongshan, Li wrote: Dear

Re: [R-sig-eco] how to perform 5 level nested anova

2009-02-10 Thread Christian Parker
You just need to make sure that your factors are read as factors and not numbers. The easiest way to do that is to specify the column types right when you read in your data Try this: seedL<-read.delim("SeedL.txt.txt",colClasses=c("factor","factor","factor","factor","numeric","numeric")) cmod<-lmer