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

From: Patrick Burns <pburns_at_pburns.seanet.com>
Date: Fri 08 Jul 2005 - 04:02:38 EST

Maybe I have it wrong, but I think you merely want:

temp <- NA

Patrick Burns

Burns Statistics
patrick@burns-stat.com
+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 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
>round it.
>
>Best wishes,
>Mikkel
>
>PS. I'm using dbGetQuery to query an SQLite database.
>
>______________________________________________
>R-help@stat.math.ethz.ch mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>
>
>
>
>



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Fri Jul 08 04:08:18 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:33:21 EST