Thanks to a colleague, I circumvented the problem by replacing the as.factor argument by inserting:

custom.subsets(X[, c(1,2)], group = list(X[,3]))

This works!

Cheers and thanks to all who commented on this,

Oliver




On Mon, Dec 6, 2021 at 2:08 PM Oliver Betz <oliver.b...@uni-tuebingen.de>
wrote:


Dear all:

I have an issue in correctly transferring the attached data frame to a
matrix to be processed in the R package DispRity.

I am running the following script that (1) reads in the attached
dataframe from Excel, (2) tansfers it to a matrix X and (3) uses the
column "subgroup" to define the two groups I want to work on.

Her is the script I am using:

#___

library (dispRity)

#(1) Reading dataframe
Data<-read.csv2("test.csv", row.names=1, header = T,
fileEncoding="UTF-8-BOM")

#(2) converts dataframe into a matrix
X<-data.matrix(Data)

#(3)define subsets
custom.subsets(X[, c(1,2)], group = as.factor(X[, 3]))

#___

However, once I have run the third line, I am getting an error message
such as:

Error: group argument must be either a "list", a "matrix", a
"data.frame" or a "phylo" object.

____

If I change the third line into: custom.subsets(dat[, c(2,3)], group =
as.factor(dat[, 4])), the error message is as follows:

Error in X[, 4] : subscript out of bounds
___


I will be very happy if anybody can give a hint how to resolve this
problem.


My best wishes,

Oliver Betz











_______________________________________________
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/



--
____________________________________________
Marguerite A. Butler
Professor

Department of Biology
2538 McCarthy Mall, Edmondson Hall 216
Honolulu, HI 96822

Office: 808-956-4713
Dept: 808-956-8617
Lab:  808-956-5867
FAX:   808-956-4745
http://butlerlab.org
http://manoa.hawaii.edu/biology/people/marguerite-butler
http://www2.hawaii.edu/~mbutler

_______________________________________________
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/

Reply via email to