[R] xmat[1, 2:3] <- NULL
mi2kelgrum at yahoo.com
Thu Jul 7 19:20:26 CEST 2005
I have a situation where I'm filling out a dataframe
from a database. Sometimes the database query doesn't
get anything, so I end up trying to place NULL in the
dataframe like below.
> temp <- NULL
> xmat <- as.data.frame(matrix(NA, 2, 3))
> xmat[1, 2:3] <- temp
Error in if (m < n * p && (n * p)%%m)
stop(gettextf("replacement has %d items, need %d", :
missing value where TRUE/FALSE needed
I can't get the programme to accept that sometimes
what the query looks for just doesn't exist, and I
just want to move on to the next calculation leaving
the dataframe with a missing value in the given cell.
It's a real show stopper and I haven't found a way
PS. I'm using dbGetQuery to query an SQLite database.
More information about the R-help