Download CSV into R Studio from Github

You can use “readr” package to download CSV file and R data file from the github.

Steps

  1. Go to the github repository link where you have the CSV file

  2. Click on the raw option present on the top right of the data

  3. This will open a new window in the browser

  4. The link should be like https://raw.githubusercontent.com/..

  5. You have to use this link to download csv file from the Github

library (readr)

urlfile="https://raw.githubusercontent.com/lrjoshi/webpage/master/public/post/c159s.csv"

mydata<-read_csv(url(urlfile))
## Parsed with column specification:
## cols(
##   Experiment = col_character(),
##   Virus = col_character(),
##   Cell = col_character(),
##   MOI = col_double(),
##   hpi = col_double(),
##   Titer = col_double()
## )
#lets have a peek into the data
head(mydata)
## # A tibble: 6 x 6
##   Experiment Virus Cell    MOI   hpi Titer
##   <chr>      <chr> <chr> <dbl> <dbl> <dbl>
## 1 EXP I      C159S OFTu    0.1     0  4.75
## 2 EXP I      C159S OFTu    0.1     6  2.75
## 3 EXP I      C159S OFTu    0.1    12  2.75
## 4 EXP I      C159S OFTu    0.1    24  5   
## 5 EXP I      C159S OFTu    0.1    48  5.5 
## 6 EXP I      C159S OFTu    0.1    72  7

You can use this method to dowload R data file from the github.

Lok Raj Joshi
Lok Raj Joshi
Postdoctoral Research Fellow

My research interests include AAV gene therapy, vectored vaccine development, viral pathogenesis, diagnostic assay development,reverse genetics, viral bioinformatics.

Related