[R] check a list that a sublist exists

Alaios alaios at yahoo.com
Tue Mar 3 11:03:11 CET 2015

Hi all,I have a list that has the following fields.
[1] "Error in if (fitcass1[[2]] == \"Error\") { : \n  Fehlender Wert, wo TRUE/FALSE nötig ist\n"
[1] "try-error"
<simpleError in if (fitcass1[[2]] == "Error") {    print(sprintf("error at fitting gamma distribution with %s periods. Mean %f %f Sd %f %f",         flag, mean1, mean2, sd1, sd2))} else {    return(fitcass1)}: Fehlender Wert, wo TRUE/FALSE nötig ist>

[1] 0

[1] 0

            pi           mu    sigma
1 0.9996796725     1.654832 127.6542
2 0.0003203275 17183.001125 302.8063

         pi.se      mu.se sigma.se
1 2.113882e-05  0.1439152 14.22274
2 2.113882e-05 38.3582148      NaN

[1] "gamma"

and so one. The content of each first level sublist are never the same. I want for each first-level sublist my list has to check fast that the current element , lets say the 79th has the $parameters.then I would keep only the numbers from the sublists that have this $parameters inside them and skip all the rest.
I tried something like exists(Mylist[[i]]$parameters) but it does not workI also tried the is.numeric(Mylist[[i]]$parameters)) but this line fails when the current sublist does not contain the $parameters field.
Can you please help me sort this out?

	[[alternative HTML version deleted]]

More information about the R-help mailing list