__
> From: Bert Gunter
> Sent: Tuesday, December 27, 2022 11:39 PM
> To: akshay kulkarni
> Cc: Sarah Goslee ; R help Mailing list
>
> Subject: Re: [R] error in exists.
>
> You are confused about the list hierarchy. Perhaps this will explain:
> > i <- 1
>
m: Bert Gunter
> Sent: Tuesday, December 27, 2022 11:39 PM
> To: akshay kulkarni
> Cc: Sarah Goslee ; R help Mailing list
>
> Subject: Re: [R] error in exists.
>
> You are confused about the list hierarchy. Perhaps this will explain:
> > i <- 1
> > E <-
Yours sincerely,
AKSHAY M KULKARNI
From: Bert Gunter
Sent: Tuesday, December 27, 2022 11:39 PM
To: akshay kulkarni
Cc: Sarah Goslee ; R help Mailing list
Subject: Re: [R] error in exists.
You are confused about the list hierarchy. Perhaps this will explain
reproduce it now?
>
> Thanking you,
> Yours sincerely,
> AKSHAY M KULKARNI
> ________
> From: Sarah Goslee
> Sent: Tuesday, December 27, 2022 11:20 PM
> To: akshay kulkarni
> Cc: R help Mailing list
> Subject: Re: [R] error in exists.
>
You might try `hasName` instead of `exists` since `exists` is designed
for environments and `hasName` for objects (like lists). Note that
the order of the arguments is switched between the 2 functions.
This does the same thing as Andrew Simmons' answer, but is a little bit shorter.
On Tue, Dec 27
Thanking you,
Yours sincerely,
AKSHAY M KULKARNI
From: Sarah Goslee
Sent: Tuesday, December 27, 2022 11:20 PM
To: akshay kulkarni
Cc: R help Mailing list
Subject: Re: [R] error in exists.
Hi,
I can't create the desired object using the code you provided, b
Hi,
I can't create the desired object using the code you provided, but if
I create it in two steps so that E$L[[i]]$T1A1 does exist, exist()
returns TRUE.
E <- new.env()
E$L <- list()
i <- 1
E$L[[i]]$T1A1 <- Sys.time()
# returns: Error in `*tmp*`[[i]] : subscript out of bounds
E$L[[i]] <- list(
exists() is for bindings in an environment, not for names in a list. try
"T1A1" %in% names(E$L[[i]])
instead
On Tue, Dec 27, 2022, 12:36 akshay kulkarni wrote:
> Dear members,
> I have the following code:
> > E <- new.env()
> > E$L <- list()
> > i <- 1
> > E$
Dear members,
I have the following code:
> E <- new.env()
> E$L <- list()
> i <- 1
> E$L[[i]]$T1A1 <- Sys.time()
> exists("T1A1", where = E$L[[i]])
Error in list2env(list(1, T1A1 = 1672161002.38743), NULL, ) :
attempt to use zero-length variable name
I want the
9 matches
Mail list logo