Hi Oliver & Marguerite.
It looks like the file is in "csv2" format -- with the comma as the
decimal separator, and the semi-colon as column separator.
This file format can be read using read.csv2 instead of read.csv. (Or,
alternatively, you can use read.csv but then update the arguments
dec="," and sep=";".)
Hopefully this solves your problem.
All the best, Liam
Liam J. Revell
University of Massachusetts Boston [Assoc. Prof.]
Universidad Católica de la Ssma Concepción [Adj. Res.]
Web & phytools:
http://faculty.umb.edu/liam.revell/, http://www.phytools.org,
http://blog.phytools.org
Academic Director UMass Boston Chile Abroad:
https://www.umb.edu/academics/caps/international/biology_chile
U.S. COVID-19 explorer web application:
https://covid19-explorer.org/
On 12/6/2021 9:52 PM, Marguerite Butler wrote:
EXTERNAL SENDER
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://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-sig-phylo&data=04%7C01%7Cliam.revell%40umb.edu%7C4caba0752954434f0b0608d9b92cba92%7Cb97188711ee94425953c1ace1373eb38%7C0%7C1%7C637744424051280848%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000&sdata=m8Yq%2FUOXRBTsfZa9BJ%2Bv81rieHq00FbwfRMNkiQvaHM%3D&reserved=0
Searchable archive at
https://nam10.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.mail-archive.com%2Fr-sig-phylo%40r-project.org%2F&data=04%7C01%7Cliam.revell%40umb.edu%7C4caba0752954434f0b0608d9b92cba92%7Cb97188711ee94425953c1ace1373eb38%7C0%7C1%7C637744424051280848%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000&sdata=zEZn%2BQssRQcHPUZfU5lPWGO192XX0VLJGp2rJd4xAX0%3D&reserved=0
--
____________________________________________
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
https://nam10.safelinks.protection.outlook.com/?url=http%3A%2F%2Fbutlerlab.org%2F&data=04%7C01%7Cliam.revell%40umb.edu%7C4caba0752954434f0b0608d9b92cba92%7Cb97188711ee94425953c1ace1373eb38%7C0%7C1%7C637744424051280848%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000&sdata=7%2FUMuSYsSCBP9WTDIeP71I1KW%2FY6gkNsLuE%2BA8hEzTk%3D&reserved=0
https://nam10.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmanoa.hawaii.edu%2Fbiology%2Fpeople%2Fmarguerite-butler&data=04%7C01%7Cliam.revell%40umb.edu%7C4caba0752954434f0b0608d9b92cba92%7Cb97188711ee94425953c1ace1373eb38%7C0%7C1%7C637744424051280848%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000&sdata=qE73xEzLK7zy0T0lOXIo7EzZILQWbpMIqQjM2Ic6WsM%3D&reserved=0
https://nam10.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww2.hawaii.edu%2F~mbutler&data=04%7C01%7Cliam.revell%40umb.edu%7C4caba0752954434f0b0608d9b92cba92%7Cb97188711ee94425953c1ace1373eb38%7C0%7C1%7C637744424051280848%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000&sdata=5XvJFlpKc6D811hQ5fu0KMlCxXucMTRBQiCfAZ04FsU%3D&reserved=0
[[alternative HTML version deleted]]
_______________________________________________
R-sig-phylo mailing list - R-sig-phylo@r-project.org
https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-sig-phylo&data=04%7C01%7Cliam.revell%40umb.edu%7C4caba0752954434f0b0608d9b92cba92%7Cb97188711ee94425953c1ace1373eb38%7C0%7C1%7C637744424051437089%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000&sdata=NBZEchP4Bd%2BzHT1TBOqz%2BpoSanyvY3NYlSh0bjKi%2B6Y%3D&reserved=0
Searchable archive at
https://nam10.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.mail-archive.com%2Fr-sig-phylo%40r-project.org%2F&data=04%7C01%7Cliam.revell%40umb.edu%7C4caba0752954434f0b0608d9b92cba92%7Cb97188711ee94425953c1ace1373eb38%7C0%7C1%7C637744424051437089%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000&sdata=%2BVw6%2BUaHob%2By5dL67%2BWt4OqAla2Ty6sTVZNVvsxJdVU%3D&reserved=0
_______________________________________________
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/