Re: [R] xmat[1, 2:3] - NULL

2005-07-08 Thread Mikkel Grum
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

[R] xmat[1, 2:3] - NULL

2005-07-07 Thread Mikkel Grum
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)

Re: [R] xmat[1, 2:3] - NULL

2005-07-07 Thread Marc Schwartz (via MN)
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))

Re: [R] xmat[1, 2:3] - NULL

2005-07-07 Thread Uwe Ligges
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

Re: [R] xmat[1, 2:3] - NULL

2005-07-07 Thread Patrick Burns
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

Re: [R] xmat[1, 2:3] - NULL

2005-07-07 Thread Mikkel Grum
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