[R] Error in -c(intcol, respcol) : invalid argument to unary operator
scriptham
stewart.porteous at permarock.com
Mon Jul 20 15:47:10 CEST 2009
Hi
I am using R 2.9.1 packages as per install.packages(FrF2) recently
downloaded and installed.
I am using a made up data set where blank is just a blank column.
The data is in an excel sheet saved as a csv file.
================= START OF SHEET ===========================
response f1 f2 f3 blank response2 fone ftwo fthree
4 -1 -1 -1 4.0 lo lo lo
1 -1 -1 1 1.0 lo lo hi
3 -1 1 -1 3.0 lo hi lo
4 -1 1 1 4.0 lo hi hi
10 1 -1 -1 10.0 hi lo lo
12 1 -1 1 12.0 hi lo hi
18 1 1 -1 18.0 hi hi lo
30 1 1 1 30.0 hi hi hi
================= END OF SHEET ===========================
My entire R code is:
#============= START OF CODE =====================#
#Instructions
#*** Define the data by file part 6 *****
datafile = "F:/dat1916/Ranalysis/FrF2test.csv"
#*** Open and read the file *****
mydata = read.csv(datafile, header=TRUE, sep=",")
names(mydata)
str(mydata)
#*** Plot cube plot for interactions
attach(mydata)
cubePlot(response, f1, f2, f3, main=paste("Cube plot for ,response"),
cex.title=1.5,cex.lab=par("cex.lab"), cex.ax=par("cex.axis"),
cex.clab=1.2, size=0.3, round=NULL,
abbrev=4,y.margin.add=-0.2, modeled=TRUE)
#*** Main Effect Plot
#mydf <- data.frame(..., row.names = NULL, check.rows = TRUE, check.names =
TRUE)
mydf1 <- data.frame(mydata[1:4])
mydf2 <- data.frame(mydata[6:9])
#attach(mydata2)
mylm1 <- mydf1$response ~ mydf$f1 + mydf$f2 + mydf$f3
mylm2 <- mydf2$response2 ~ mydf$fone + mydf$ftwo + mydf$fthree
MEPlot(mylm1)
MEPlot(mylm2)
IAPlot(mylm1, main = paste("Interaction plot matrix for", respnam),
pch = c(15, 17), cex.lab = par("cex.lab"), cex = par("cex"),
cex.xax = par("cex.axis"), cex.yax = cex.xax, cex.title = 1.5,
lwd = par("lwd"), abbrev = 4, show.alias = FALSE)
#============= END OF CODE ========================#
The cube plot seems to work OK.
MEPlot and IAPlot produce the following error:
Error in -c(intcol, respcol) : invalid argument to unary operator.
It seems as though the negative 1 values are problematic but the FrF2
instructions insist on neg1 and plus1 values.
Does anyone know what I should do to overcome this please.
Many thanks
scriptham
--
View this message in context: http://www.nabble.com/Error-in--c%28intcol%2C-respcol%29-%3A-invalid-argument-to-unary-operator-tp24570224p24570224.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list