Stavros Macrakis wrote:
>
> You might think that you can check names(xxx) to see if the slot has been
> explicitly set, but it depends on *how* you have explicitly set the slot to
> NULL:
>
>> xxx$hello <- 3
>> xxx$hello <- NULL
>> names(xxx)
>character(0) # no name
On Tue, May 19, 2009 at 12:07 PM, routík wrote:
> > SmoothData <- list(exists=TRUE, span=0.001)
> > exists("SmoothData$span")
> FALSE
>
As others have said, this just checks for the existence of a variable with
the (strange) name "SmoothData$span".
In some sense, in R semantics, xxx$yyy *alway
Linlin Yan wrote:
> SmoothData$span is not an object which can be checked by exists(), but
> part of an object which can be checked by is.null().
>
>
is.null is unhelpful here, in that lists can contain NULL as a named
element, and retrieving a non-existent element returns NULL:
foo = list
Žroutík wrote:
>
>> SmoothData <- list(exists=TRUE, span=0.001)
>> SmoothData
>>
> $exists
> [1] TRUE
>
> $span
> [1] 0.001
>
>
>> exists("SmoothData")
>>
> TRUE
>
>
>> exists("SmoothData$span")
>>
> FALSE
>
>
'SmoothData$span' = 'foo'
exists("SmoothData$span")
Žroutík wrote:
Dear R-users,
in a minimal example exists() gives FALSE on an object which obviously does
exist. How can I check on that list object anyway else, please?
SmoothData <- list(exists=TRUE, span=0.001)
SmoothData
$exists
[1] TRUE
$span
[1] 0.001
exists("SmoothData")
On 5/19/2009 12:07 PM, Žroutík wrote:
Dear R-users,
in a minimal example exists() gives FALSE on an object which obviously does
exist. How can I check on that list object anyway else, please?
SmoothData <- list(exists=TRUE, span=0.001)
SmoothData
$exists
[1] TRUE
$span
[1] 0.001
exists("Sm
SmoothData$span is not an object which can be checked by exists(), but
part of an object which can be checked by is.null().
On Wed, May 20, 2009 at 12:07 AM, Žroutík wrote:
> Dear R-users,
>
> in a minimal example exists() gives FALSE on an object which obviously does
> exist. How can I check on
Dear R-users,
in a minimal example exists() gives FALSE on an object which obviously does
exist. How can I check on that list object anyway else, please?
> SmoothData <- list(exists=TRUE, span=0.001)
> SmoothData
$exists
[1] TRUE
$span
[1] 0.001
> exists("SmoothData")
TRUE
> exists("SmoothData
8 matches
Mail list logo