It should be character for everything. My fear with factor is that it’s converting “2”, “3”, “1” to 1, 2, 3 if those are the numbers for the factor labels. In general, I find avoiding factors makes life much easier (with exception of some of the plotting in ggplot2).
A good way to check format (I have to do this more than one might hope) is to look at an example: library(OUwie) data(tworegime) apply(trait, 2, class) Best, Brian _________________________________________ Brian O’Meara He/Him Professor, Dept. of Ecology & Evolutionary Biology University of Tennessee, Knoxville From: R-sig-phylo <r-sig-phylo-boun...@r-project.org> on behalf of Chen, Ting-Wen <ting-wen.c...@biologie.uni-goettingen.de> Date: Wednesday, October 23, 2024 at 6:16 AM To: r-sig-phylo@r-project.org <r-sig-phylo@r-project.org> Subject: [R-sig-phylo] Regime class in the OUwie input dataframe [You don't often get email from ting-wen.c...@biologie.uni-goettingen.de. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ] Dear experts in phylogenetic comparative methods, I am running the OUwie function to fit evolutionary models for traits. The help says for the input data frame: "The trait data.frame must have column entries in the following order: [,1] species names, [,2] current selective regime, and [,3] the continuous trait of interest". However, I get different optima estimates when the second column (i.e. current selective regime) of the dataframe is set as the "factor" class compared to the "character" class. I am trying to figure this out because I have changed the order of the current trait states (as factor) by manually setting the level, while the node.label in the tree is still character. I have also tried changing the node.label to factor to follow the current level of regime in taxa, but the names in the estimated optima result are even stranger. I wonder if the column in the input dataframe should be mandatory factor and can only be ordered alphabetically? However, I would prefer to (pre-)order the level of the trait states, as this would make it easier to visualise and describe the results later. Thank you very much for your help and have a nice day! Best wishes Ting-Wen -- Ph.D. Ting-Wen Chen Animal Ecology (AG Scheu) J.F. Blumenbach Institute of Zoology and Anthropology Georg August Universität Göttingen Untere Karspüle 2 D-37073 Göttingen, Germany https://www.uni-goettingen.de/en/348915.html [[alternative HTML version deleted]] _______________________________________________ R-sig-phylo mailing list - R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/ [[alternative HTML version deleted]] _______________________________________________ R-sig-phylo mailing list - R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/