I have a GWAS data summary results that have the following information and want to extract a list of first 120 SNPs according to p-value in R. The data have following seven headers:
SNPName n_samplesize A1Allele A2Allele beta SE p_value
Code via dplyr:
library(dplyr)
dat <- read.csv(file.choose(MetaAnalysis_Results))
dat2 <- dat %>% arrange("p_value")
The error occurred at sorting
Update: This worked for me after converting the .csv to .txt file
attach(MetaAnalysis_Results)
mydata <- MetaAnalysis_Results
new <- mydata[order(p_value),]