Home > OS >  How to determine the type of delim used in a txt file?
How to determine the type of delim used in a txt file?

Time:12-18

Here is my sample data: enter image description here

I want to know how should I import this txt file so that it will appear as it shows in Sublime Text

CodePudding user response:

Try read.table. No packages are used.

u <- "https://raw.githubusercontent.com/Patricklv/Txt-file/main/pgc.cross.SCZ17.2013-05.txt"
dat <- read.table(u, header = TRUE, na.strings = ".")

str(dat)

giving

'data.frame':   12 obs. of  11 variables:
 $ snpid  : chr  "rs3131972" "rs3131969" "rs3131967" "rs1048488" ...
 $ hg18chr: int  1 1 1 1 1 1 1 1 1 1 ...
 $ bp     : int  742584 744045 744197 750775 758311 769185 828418 836671 843817 844113 ...
 $ a1     : chr  "A" "A" "T" "T" ...
 $ a2     : chr  "G" "G" "C" "C" ...
 $ or     : num  1 1 1 1 1.02 ...
 $ se     : num  0.0966 0.0925 0.0991 0.0966 0.0843 ...
 $ pval   : num  0.999 0.997 0.993 0.999 0.772 ...
 $ info   : num  0.702 0.938 0.866 0.702 0.988 0.979 0.439 1.02 0.383 0.251 ...
 $ ngt    : int  0 0 0 0 0 0 0 0 0 0 ...
 $ CEUaf  : num  0.1605 0.133 NA 0.8364 0.0926 ...
  • Related