[R] error message for function: lmer (from lme4 package)

2017-11-14 Thread Fix Ace via R-help
Dear R Community, My data have 3 conditions and each condition has 6 replicates. I am trying to fit my data for a linear mixed model using the lmer function from lme4 package to find the random effects of the replicates; however, I got the error message. Here are the example codes: >example.3=da

[R] Dates to numeric in for loop

2017-11-14 Thread Mikkel Grum
Hi Can anyone explain why a date becomes numeric when you loop over a series of dates? > dt <- Sys.Date() > dt [1] "2017-11-14" > class(dt) [1] "Date" > dts <- dt - 1:0 > class(dts) [1] "Date" > > for (i in dts) { + print(i) + print(class(i)) + print(as.Date(i, "1970-01-01")) + pr

Re: [R] error message for function: lmer (from lme4 package)

2017-11-14 Thread David Winsemius
> On Nov 14, 2017, at 5:13 AM, Fix Ace via R-help wrote: > > Dear R Community, > My data have 3 conditions and each condition has 6 replicates. I am trying to > fit my data for a linear mixed model using the lmer function from lme4 > package to find the random effects of the replicates; Bette

Re: [R] Dates to numeric in for loop

2017-11-14 Thread Jeff Newmiller
"Date" means "numeric with an attribute of class='Date' ", so what actually happened was that the for loop dropped the class attribute. In most cases using the seq_along() function lets you step through index values to extract values from your original vectors. In general, any S3 object will beh

[R] Converting a string to variable names

2017-11-14 Thread 刘瑞阳
Hi, Suppose that I want to do a series of plots with the y value for each plot as PC1, PC2, PC3… How could I accomplish this using a for loop? Suppose the code like this: For (index in seq(1,16)){ plot(x=(a given set of value),y=paste(“PC”,as.character(index),sep=“”) } But this would not work be

Re: [R] error message for function: lmer (from lme4 package)

2017-11-14 Thread Fix Ace via R-help
Hi, David, Thank you very much for getting back to me! Sorry about the messy code example. I am re-posting here (including the error message): > example.3=data.frame(levels=as.numeric(XXX[,c(4)]),replicate=rep(c("0","1","2","3","4","5"),3),conditions=c(rep("11",6),rep("12",6),rep("13",6)))> > exa

Re: [R] Converting a string to variable names

2017-11-14 Thread Jim Lemon
Hi Ruiyang, I think you want "get": For (index in seq(1,16)){ plot(x=(a given set of value),y=get(paste(“PC”,as.character(index),sep=“”))) } On Wed, Nov 15, 2017 at 7:43 AM, 刘瑞阳 wrote: > Hi, > Suppose that I want to do a series of plots with the y value for each plot as > PC1, PC2, PC3… How cou

[R] Aggregating Data

2017-11-14 Thread Jeff Reichman
R-Help I created a "shortdate" for the purpose of aggregating each var (S72 .S119) by daily sum , but not sure how to handle using a POSIXlt object. > myData$shortdate <- strftime(myData$time, format="%Y/%m/%d") > head(myData) time s72 s79 s82 s83 s116 s119 shortdate 1 2016-10-

[R] Aggregating Data

2017-11-14 Thread Jeff Reichman
R-Help Please disregard as I figure something out, unless there is a more elegant way ... myData.sum <- aggregate(x = myData[c("s72","s79","s82","s83","s116","s119")], FUN = sum, by = list(Group.date = myData$shortdate)) > head(myData.sum) Group.date s7

Re: [R] error message for function: lmer (from lme4 package)

2017-11-14 Thread Bert Gunter
Still a complete mess! Post in **plain text**. This should be an option in your email software. Please seek local help if you cannot figure out how to do this. -- Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka

Re: [R] error message for function: lmer (from lme4 package)

2017-11-14 Thread David Winsemius
> On Nov 14, 2017, at 12:49 PM, Fix Ace wrote: > > Hi, David, > > Thank you very much for getting back to me! Sorry about the messy code > example. I am re-posting here (including the error message): > > > example.3=data.frame(levels=as.numeric(XXX[,c(4)]),replicate=rep(c("0","1","2","3","4",

[R] lapply and runif issue?

2017-11-14 Thread Bert Gunter
Could someone please explain the following? I did check bug reports, but did not recognize the issue there. I am reluctant to call it a bug, as it is much more likely my misunderstanding. Ergo my request for clarification: ## As expected: > lapply(1:3, rnorm, n = 3) [[1]] [1] 2.481575 1.998182 1.

Re: [R] lapply and runif issue?

2017-11-14 Thread Ista Zahn
Hi Bert, On Tue, Nov 14, 2017 at 8:11 PM, Bert Gunter wrote: > Could someone please explain the following? I did check bug reports, but > did not recognize the issue there. I am reluctant to call it a bug, as it > is much more likely my misunderstanding. Ergo my request for clarification: > > ##

Re: [R] lapply and runif issue?

2017-11-14 Thread Bert Gunter
Thanks, Ista. That explains it. What I missed is the following "note" in ?lapply: "This means that the recorded call is always of the form FUN(X[[i]], ...), with i replaced by the current (integer or double) index. " That being the case, X[[i]] gets passed to the first available argument, which

[R] Autologistic regression in R

2017-11-14 Thread Mingke Li
Hi, I am new to autologistic regression and R. I do have questions when starting a project in which I believe autologistic regression is needed. I have a point layer whose attribute table stores the values of the dependent variable and all the independent variables. I hope to to fit an autologi

[R] NEED HELP : Association in single DTM

2017-11-14 Thread Rahul singh
I have free text data in a single text document. I create a corpus, and then a document term matrix out of it. I can create a word cloud too. But when I do word association for the same, using "findAssocs(), it always returns numeric(0). EX : findAssocs(dtm, "king" ,0.1) I re