Re: [R] error in exists.....

2022-12-28 Thread akshay 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: > > i <- 1 >

Re: [R] error in exists.....

2022-12-27 Thread Bert Gunter
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 <-

Re: [R] error in exists.....

2022-12-27 Thread akshay kulkarni
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

Re: [R] error in exists.....

2022-12-27 Thread Bert Gunter
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. >

Re: [R] error in exists.....

2022-12-27 Thread Greg Snow
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

Re: [R] error in exists.....

2022-12-27 Thread akshay kulkarni
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

Re: [R] error in exists.....

2022-12-27 Thread Sarah Goslee
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(

Re: [R] error in exists.....

2022-12-27 Thread Andrew Simmons
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$

[R] error in exists.....

2022-12-27 Thread akshay kulkarni
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