winteram / IAT

Online IAT
MIT License
42 stars 48 forks source link

IATanalysis.R, running errors #16

Open mauriceflorence opened 11 years ago

mauriceflorence commented 11 years ago

Hello,

Everything has been working wonderfully thus far, but I've run into one problem. When I run the IATanalysis.R file in R studio, I receive the following lines of errors in return:

**

Error in is.data.frame(x) : (list) object cannot be coerced to type 'double' In addition: Warning messages: 1: In mean.default(subset(data.list[[i]], V1 == 3 & V6 > 300 & V6 < : argument is not numeric or logical: returning NA 2: In mean.default(subset(data.list[[i]], V1 == 6 & V6 > 300 & V6 < : argument is not numeric or logical: returning NA

rm(block4.m,block4.sd,block7.m,block7.sd,d,data.list,diff,filename,full.sd,i,iat.date,id,output.files) Warning messages: 1: In rm(block4.m, block4.sd, block7.m, block7.sd, d, data.list, diff, : object 'block4.sd' not found 2: In rm(block4.m, block4.sd, block7.m, block7.sd, d, data.list, diff, : object 'block7.sd' not found 3: In rm(block4.m, block4.sd, block7.m, block7.sd, d, data.list, diff, : object 'd' not found 4: In rm(block4.m, block4.sd, block7.m, block7.sd, d, data.list, diff, : object 'diff' not found 5: In rm(block4.m, block4.sd, block7.m, block7.sd, d, data.list, diff, : object 'full.sd' not found

setwd(paste(base.dir,"templates",fd,template.name,sep="")) write.csv(summarized, "summarized.csv")

**

To be sure, the summarized.csv file is being generated, and updated properly with each new output. However, as the above error reads, there is no data in the resulting summarized.csv file: only returned NAs.

I have not altered the IATanalysis.R file at all, so I suppose I must be running it incorrectly (a distinct possibility, since I am quite new to R!).

Any help is greatly appreciated.

Thank you.

kloliv commented 11 years ago

I am having the exact same error messages...

mauriceflorence commented 11 years ago

Have any luck yet, kloliv?

kloliv commented 11 years ago

Not yet. I went onto the "R" help forum and got some help but I do not understand the message.. (I am new to R as well)

Here is what they said. Let me know if you can make sense of it and maybe we can help each other out?

"Hi, One problem with your example dataset is that you have 11 list elements with the last one having different dimensions. I think it was based on summarized. Then, the second problem I encountered for testing is that the dataset you provided doesn't fulfill the criteria. lst1<- list(structure(list......) #output of dput

lst2<- lst1[1:10] #deleted the last list element lst3<-lapply(lst2,function(x) {x$V3<- as.character(x$V3);x}) #here if I apply one of the conditions, none of the list elements fulfill the criteria

for example

lapply(lst3,function(x) subset(x,V1==6 & V6>300 & V6<3000,select="V6"))

[1]]

[1] V6

<0 rows> (or 0-length row.names)

#

[[2]]

[1] V6

<0 rows> (or 0-length row.names)

#

[[3]]

[1] V6

<0 rows> (or 0-length row.names)

changed the V1 column

set.seed(24) lst4<- lapply(lst3,function(x) {x$V1<- sample(c(0,3,6),nrow(x),replace=TRUE);x})

I am skipping the first 2, ie. 'id' and 'iat.date' as the filenames were

not provided. res<-t(sapply(lst4,function(x) {block4<-x[with(x,V1==3 & V6>300 & V6<3000),"V6"];block7<- x[with(x,V1==6 & V6>300 & V6<3000),"V6"];block4.m<- mean(block4);block7.m<- mean(block7);block4.sd<-sd(block4);block7.sd<- sd(block7);full<- x[with(x,(V1==3|V1==6) & (V6 >300) & (V6 <3000)),"V6"]; full.sd<- sd(full);diff1<-block7.m-block4.m;d<- diff1/full.sd; c(block4.m, block4.sd,block7.m,block7.sd,diff1,full.sd,d) })) colnames(res)<- c("block4.m","block4.sd","block7.m","block7.sd","diff1"," full.sd","d")"

On Wed, Jul 3, 2013 at 8:55 AM, mauriceflorence notifications@github.comwrote:

Have any luck yet, kloliv?

— Reply to this email directly or view it on GitHubhttps://github.com/winteram/IAT/issues/16#issuecomment-20425200 .

kloliv commented 11 years ago

Have you had any luck???