Import VCF data to R

I'm trying to import some sample VCF data I have on my desktop to Rstudio in order to follow the steps for the vcfR package (Reading VCF data) shown here. I tried importing the dataset From Text (Base) but it does not allow me to further analyze the data:

Error in strwrap(WES.vcf@meta[1:7]) :
trying to get slot "meta" from an object (class "data.frame") that is not an S4 object

Is there any way to import this data in the proper way to analyze as the website does?


Hi @roykhalife,
You'll need to import the VCF data into a dataframe using a specific import function. Run this from a script file (not the RStudio pull-down menus):

my_data <- read.vcfR("data_file_on_desktop.vcf.gz")

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.