Hi Oliver, You have semicolons ; in your cells. csv is "comma separated format". It is using "," as the delimiter. Probably what is happening is the ";" is interpreted as another delimiter in R, so you have a 2 column vector in each cell. I would guess that htis will be read in as a list.
Why do you have two values in each cell? If they are important I would suggest splitting them into two columns so that you only have one value per cell. Otherwise you can read in the list, and flatten it with code. But it would probably be easier to just produce the .csv in the correct way. An easy way to do this is to read in your .csv file with a word processor and just do a search on ";" and replace with ",". Then you should get 6 columns instead of three columns with two values each. Marguerite Marguerite 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 [[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/