Thanks for this! This is even simpler than using
!is.null():
xmat - as.data.frame(matrix(NA, 2, 3))
try(xmat[i, 2:3] - dbGetQuery(...), silent = TRUE)
Best wishes,
Mikkel
--- Uwe Ligges [EMAIL PROTECTED]
wrote:
Mikkel Grum wrote:
I have a situation where I'm filling out a
dataframe
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)
On Thu, 2005-07-07 at 10:20 -0700, Mikkel Grum wrote:
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))
Mikkel Grum wrote:
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
Maybe I have it wrong, but I think you merely want:
temp - NA
Patrick Burns
Burns Statistics
[EMAIL PROTECTED]
+44 (0)20 8525 0696
http://www.burns-stat.com
(home of S Poetry and A Guide for the Unwilling S User)
Mikkel Grum wrote:
I have a situation where I'm filling out a dataframe
from a
Thanks a lot!! This was really a big help. The
following solves my problem:
xmat - as.data.frame(matrix(NA, 2, 3))
temp - dbGetQuery(...)
if (!is.null(temp)) {xmat[i, 2:3] - temp}
I'm adding data to only some columns of a larger
matrix, on a row-by-row basis.
Best wishes,
Mikkel
--- Marc