[adegenet-forum] trouble accessing @other

Amaranta Fontcuberta amaranta.fontcuberta at unil.ch
Thu Oct 25 01:42:59 CEST 2018


Hello,

I want to subset part of the individuals of my genlight object according to
a variable stored in the @other slot. I get an error I don't understand.
I stored 3 categorical variables in the @other slot. It looks like that:
*> str(other(asocial.gl <http://asocial.gl>))*
List of 3
 $ basin : Factor w/ 3 levels "Rhine","Rhone_Valais",..: NA 2 NA 2 2 2 2 2
2 2 ...
 $ Sgeno : Factor w/ 3 levels "mm","mp","pp": 1 2 3 1 1 1 1 1 1 1 ...
 $ Spheno: Factor w/ 2 levels "M","P": 1 2 2 1 1 1 1 1 1 1 ...

When I try to subset my dataset, I get this error:
*> asocial.gl <http://asocial.gl>[asocial.gl at other$basin=="Rhone_Valais",]*
Error in .local(x, i, j, ..., drop = drop) :
  trying to get slot "n.loc" from an object of a basic class ("NULL") with
no slots

The condition seems to work well, since when I call it alone, it outputs a
list of TRUE, FALSE that corresponds well to the individuals I want to
keep.
*> asocial.gl at other$basin=="Rhone_Valais"*
  [1]    NA FALSE    NA FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
 TRUE  TRUE  TRUE
 [15]  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE
 TRUE  TRUE  TRUE
 ...

I use the same subseting command to select according to the @pop slot and
it works well.


Any help will be appreciated,

Thanks a lot in advance,

Amaranta.
----------------------------------------------------------
Amaranta Fontcuberta, assistante diplômée
Dept. Écologie et Évolution
Université de Lausanne
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/adegenet-forum/attachments/20181024/326b5e40/attachment.html>


More information about the adegenet-forum mailing list