Re: [R] Checking if a logical variable exists

2014-12-14 Thread Steven Yen
Thanks. This worked!! :) Fisher <- ifelse(!("Fisher" %in% names(obj$spec)), FALSE, obj$spec$Fisher) Steven At 08:43 AM 12/14/2014, Ben Tupper wrote: Hi, Does this work for you? It simply tests if the name Fisher is found among the names of the elements of spec. obj = list(spec = list) Fish

Re: [R] Checking if a logical variable exists

2014-12-14 Thread Ben Tupper
Hi, Does this work for you? It simply tests if the name Fisher is found among the names of the elements of spec. obj = list(spec = list) Fisher <- ifelse(!("Fisher" %in% names(obj$spec)), FALSE, obj$spec$Fisher) Cheers, Ben On Dec 14, 2014, at 8:07 AM, Steven Yen wrote: > My obj does not al

Re: [R] Checking if a logical variable exists

2014-12-14 Thread Duncan Murdoch
On 14/12/2014, 8:07 AM, Steven Yen wrote: > My obj does not always come with a logical variable defined. So I do > > my.foo <- function(obj,df,digits=5){ > if (!is.na("obj$spec$Fisher")) Fisher<-obj$spec$Fisher > ... > } > > This works when "Fisher" is defined in/passed from obj. When it is > no