Home > Software engineering >  loading raw file from github in R
loading raw file from github in R

Time:09-19

I am trying to load a codebook from github in R studio. The url is enter image description here

enter image description here

CodePudding user response:

There are two issues here.

First, the raw file is available at the link https://raw.githubusercontent.com/HimesGroup/BMIN503/master/DataFiles/NHANES_2007to2008_DataDictionary.md. However, read.table is not going to be able to read that file without some help: read.table is used for tab or comma delimited files, and that's a table marked up for Markdown. This comes close:

read.table("https://raw.githubusercontent.com/HimesGroup/BMIN503/master/DataFiles/NHANES_2007to2008_DataDictionary.md",
 skip = 4, sep = "|", head = TRUE)

but it will still need some cleanup, to remove the first and last columns of junk it added, and to delete the first line.

  •  Tags:  
  • r
  • Related