Using gl.read.dart() on Mac : Error in as.vector(data)

13 views
Skip to first unread message

Deane Smith

unread,
Sep 17, 2025, 9:32:37 PM (7 days ago) Sep 17
to dartR
Hi we are experiencing an error when reading in the data. I have written code that works on my windows machine. But when my student runs it on her Mac we get the following error:

Completed: utils.dart2genlight
366 rows and 81568 columns of data read
Error in as.vector(data) : 
no method for coercing the S4 class to a vector

The first 2 lines above are sharing the correct information about the data. So it is getting that far fine on the Mac. We have up to date versions of R, R-Studio, the suite of DArT packages and dependancies - the only difference I can find is that one machine is a mac and one is a windows. 

Just wondering if anyone else has had this problem on Mac? and whether there is a solution? 

Deane.

Bernd.Gruber

unread,
Sep 17, 2025, 11:12:20 PM (7 days ago) Sep 17
to da...@googlegroups.com

Hi Deane,

 

Just a guess, but can you check your individual metadata file does not have empty entries or added commas at the end. If you open it in notpade check if there are a number of commas as excel sometimes adds empty rows. If so delete those and try again.

 

Cheers, Bernd

 

 

From: da...@googlegroups.com <da...@googlegroups.com> On Behalf Of Deane Smith
Sent: Thursday, 18 September 2025 11:33 AM
To: dartR <da...@googlegroups.com>
Subject: [dartR] Using gl.read.dart() on Mac : Error in as.vector(data)

 

You don't often get email from deane...@gmail.com. Learn why this is important

--
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 visit https://groups.google.com/d/msgid/dartr/93de9a07-7de4-48f7-9b81-b401b19e7774n%40googlegroups.com.

DeaneSmith1

unread,
Sep 18, 2025, 8:40:03 PM (6 days ago) Sep 18
to da...@googlegroups.com
Thanks Bernd,
We are running it in without metadata - and assigning it in later, which is working fine for me on the Windows. I'll post the code up to the point of failure on the Mac. We are getting the student access to a windows VM that we have the code working on. But it would be interesting to figure out what's happening on the Mac.

# Install the necessary Bioconductor packages
#install.packages("devtools")
#install.packages("BiocManager")
#BiocManager::install("SNPRelate")
#BiocManager::install("snpStats",force = TRUE)

# Install dartRverse (dartRverse) & core (dartR.base, dartR.data)
#install.packages("dartRverse") #you only need to do this once

library(dartRverse)
dartRverse::dartRverse_install()

#install.packages("dartR.base")
#install.packages("dartR.popgen")
library(dartR.popgen)
dartRverse::dartRverse_install()


#Navigate to the folder with the data
path <- "C:/Users/Students/Data/DArTReport/DArT_report" 
setwd(path) 
Files <- list.files(path, pattern = ".csv") 

#Import the data
dartname <- list.files(path,"SNP_2.csv") 
dartfile <- file.path(path,dartname) 
dartfile 

mygl <- gl.read.dart(dartfile) 

Reply all
Reply to author
Forward
0 new messages