Hi,
I’m having trouble renaming my sites in my genlight file with the gl.recode.pop function, and wonder if there is a bug? I get the same error for both my data and also bandicoot.gl or testset.gl.
I can create a draft recode table via the gl.make.recode.pop function and edit it in excel, or even RStudio. However, when I use it to run gl.recode.pop my pops are labelled as numbers. The function seems to be treating them as factors. I even get the error if I don’t edit the recode table.
I can repeat the whole process, but recoding individuals with the very similar gl.recode.ind function and have no problem.
Delving inexpertly into some of the code for these two functions, one difference I see is that @ line 83 gl.recode.ind sets stringsAsFactors=FALSE, whereas gl.recode.pop has stringsAsFactors = TRUE @ line 87. If I edit that code to be stringsAsFactors = TRUE and rerun using my edited version of the function, I seem to be able to get it to work properly.
What do you think Arthur/Bernd?
Cheers,
Olly
My code is as follows:
gl.make.recode.pop(working.gl, out.recode.file = "testpop.csv", outpath = getwd())
working.gl <- gl.recode.pop(working.gl, pop.recode = "testpop.csv", recalc = FALSE, mono.rm = FALSE, verbose = 5)
levels(working.gl$pop)
Hi Olly,
This seems to be an error that came in with R 4. Because here the default is stringsAsFactors = FALSE when using read.csv, which is not what you want in most cases from our point of view. Here I think we made a mistake and it needs be set to FALSE as you suggested.
Will be in the next update (Luis is starting the coming week 😊)
Cheers, Bernd
==============================================================================
Dr Bernd Gruber )/_
_.--..---"-,--c_
Professor Ecological Modelling \|..' ._O__)_
Tel: (02) 6206 3804 ,=. _.+ _ \..--( /
Fax: (02) 6201 2328 \\.-''_.-' \ ( \_
Institute for Applied Ecology `''' `\__ /\
Faculty of Science and Technology ')
University of Canberra ACT 2601 AUSTRALIA
Email: bernd....@canberra.edu.au
WWW: bernd-gruber
Australian Government Higher Education Provider Number CRICOS #00212K
NOTICE & DISCLAIMER: This email and any files transmitted with it may contain
confidential or copyright material and are for the attention of the addressee
only. If you have received this email in error please notify us by email
reply and delete it from your system. The University of Canberra accepts
no liability for any damage caused by any virus transmitted by this email.
==============================================================================
--
You received this message because you are subscribed to the Google Groups "dartR" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
dartr+un...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/dartr/MEAPR01MB2502641D3687DB29ABD5151EFFAA0%40MEAPR01MB2502.ausprd01.prod.outlook.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dartr/SYCPR01MB399879F1CC61908183C7BB1AD4A90%40SYCPR01MB3998.ausprd01.prod.outlook.com.