andrepavlik
2013-Dec-12 04:50 UTC
[R] R problem: Error in data[2:4] : object of type 'closure' is not subsettable
Human_Rights_Excel_Data.xlsx <http://r.789695.n4.nabble.com/file/n4682042/Human_Rights_Excel_Data.xlsx> Above is the attachment for my excel data. I am having this problem: Error in data[2:4] : object of type 'closure' is not subsettable Here is my code #data<-readcsv("HumanRightsExcelData") par(mar=c(5,22,4,0.2)) COLOR<-c('red','brown4','black') barplot(log10(t(as.matrix(data[,2:4]))),beside=T,horiz=T,las=2,names.arg=t(data$X),col=COLOR,main='KilingsinGaza,\nWestBank,andIsrael',xlab='Base10totheNnumberofKillings') par(new=T,mar=c(0,0,0,0)) plot(0,0,type="n") legend("bottomleft",legend=c("Gaza","West Bank","Israel"),text.col=COLOR,bty="n",cex=1.5) When ever I type in this code barplot(log10(t(as.matrix(data[,2:4]))),beside=T,horiz=T,las=2,names.arg=t(data$X),col=COLOR,main='KilingsinGaza,\nWestBank,andIsrael',xlab='Base10totheNnumberofKillings') I get this message Error in data[2:4] : object of type 'closure' is not subsettable Can someone please help me out? Also I am terrible with R so please try and make your responses idiot proof hahahaha. -- View this message in context: http://r.789695.n4.nabble.com/R-problem-Error-in-data-2-4-object-of-type-closure-is-not-subsettable-tp4682042.html Sent from the R help mailing list archive at Nabble.com.
arun
2013-Dec-12 05:41 UTC
[R] R problem: Error in data[2:4] : object of type 'closure' is not subsettable
Hi, May be this helps: dat1 <- read.csv("Human_Rights_Excel_Data.csv") #converted .xlsx to .csv mat1 <- log10(t(as.matrix(dat1[,2:4]))) mat1[!is.finite(mat1)] <- 0 par(mar=c(5,22,4,0.2)) COLOR<-c('red','brown4','black') barplot(mat1,beside=T,horiz=T,las=2,col=COLOR,main='KilingsinGaza,\nWestBank,andIsrael',names.arg=t(dat1$X),xlab='Base10totheNnumberofKillings') par(new=T,mar=c(0,0,0,0)) plot(0,0,type="n") legend("bottomleft",legend=c("Gaza","West Bank","Israel"),text.col=COLOR,bty="n",cex=1.5) A.K. Human_Rights_Excel_Data.xlsx Above is the attachment for my excel data. I am having this problem: Error in data[2:4] : object of type 'closure' is not subsettable Here is my code #data<-readcsv("HumanRightsExcelData") par(mar=c(5,22,4,0.2)) COLOR<-c('red','brown4','black') barplot(log10(t(as.matrix(data[,2:4]))),beside=T,horiz=T,las=2,names.arg=t(data$X),col=COLOR,main='KilingsinGaza,\nWestBank,andIsrael',xlab='Base10totheNnumberofKillings') par(new=T,mar=c(0,0,0,0)) plot(0,0,type="n") legend("bottomleft",legend=c("Gaza","West Bank","Israel"),text.col=COLOR,bty="n",cex=1.5) When ever I type in this code barplot(log10(t(as.matrix(data[,2:4]))),beside=T,horiz=T,las=2,names.arg=t(data$X),col=COLOR,main='KilingsinGaza,\nWestBank,andIsrael',xlab='Base10totheNnumberofKillings') I get this message Error in data[2:4] : object of type 'closure' is not subsettable Can someone please help me out? Also I am terrible with R so please try and make your responses idiot proof hahahaha.