This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This method helps creating the proper R package directory structure using RStudio and then syncs it with the corresponding GitHub Project. | |
Sources: | |
http://www.molecularecologist.com/2013/11/using-github-with-r-and-rstudio/ | |
https://support.rstudio.com/hc/en-us/articles/200532077-Version-Control-with-Git-and-SVN | |
http://r-pkgs.had.co.nz/git.html | |
Setup a GitHub account. | |
Download and install Rstudio. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# using dplyr finctions in non-interactive mode | |
# examples | |
library(plyr) | |
library(dplyr) | |
d1 = data_frame(x = seq(1,20),y = rep(1:10,2),z = rep(1:5,4)) | |
head(d1) | |
#### single table verbs #### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
####Download the data from Government of India open data portal##### | |
w_dir = getwd() | |
source(file=file.path(w_dir,"Code/Core.R")) | |
checkAndDownload(c("XML","RCurl","RJSONIO","plyr")) | |
### Alternative - 1: Using APIs ### | |
#JSON# | |
getJSONDoc <- function(link, res_id, api_key, offset, no_elements){ | |
jsonURL = paste(link, | |
"resource_id=",res_id, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
######## Packages ######## | |
checkAndDownload<-function(packageNames) { | |
for(packageName in packageNames) { | |
if(!isInstalled(packageName)) { | |
install.packages(packageName,repos="http://lib.stat.cmu.edu/R/CRAN") | |
} | |
library(packageName,character.only=TRUE,quietly=TRUE,verbose=FALSE) | |
} | |
} |