[R] R problem: Error in data[2:4] : object of type 'closure' is not subsettable
arun
smartpink111 at yahoo.com
Thu Dec 12 06:41:44 CET 2013
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.
More information about the R-help
mailing list