Skip to content

Instantly share code, notes, and snippets.

steadyfish

Block or report user

Report or block steadyfish

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@steadyfish
steadyfish / Instructions_for_creating_R_packages
Last active Aug 29, 2015
Creating R packages using RStudio, Git and GitHub
View Instructions_for_creating_R_packages
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.
@steadyfish
steadyfish / dplyr_functions_programmatic_use.R
Last active Feb 3, 2017
using dplyr functions programmatically
View dplyr_functions_programmatic_use.R
# 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 ####
@steadyfish
steadyfish / GOIDataInput.R
Last active May 22, 2019
Accessing Open Data Portal (India) using APIs
View GOIDataInput.R
####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,
View FirstPostOnGeographicalMaps.R
######## 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)
}
}
You can’t perform that action at this time.