{{ message }}

Instantly share code, notes, and snippets.

🏠
Working from home

# Anirudh Jayaraman anirudhjayaraman

🏠
Working from home
Created May 10, 2020
View source_patient_data_india.R
 rm(list = ls()) # Load relevant libraries ----------------------------------------------------- library(stringr) library(data.table) # ============================================================================= # COVID 19-India API: A volunteer-driven, crowdsourced database # for COVID-19 stats & patient tracing in India # =============================================================================
Created Nov 12, 2019
Linear regression implementation using linear algebra in R
View lm_linear_algebra.R
 ### Linear Regression Using lm() ---------------------------------------- data("swiss") dat <- swiss linear_model <- lm(Fertility ~ ., data = dat) summary(linear_model) # Call: # lm(formula = Fertility ~ ., data = dat) #
Last active Jul 8, 2020
View remove_missing_levels.R
 remove_missing_levels <- function(fit, test_data) { library(magrittr) # https://stackoverflow.com/a/39495480/4185785 # drop empty factor levels in test data test_data %>% droplevels() %>% as.data.frame() -> test_data
Last active Oct 11, 2017
View factor_new_levels.R
 library(data.table) train <- fread('train.csv'); test <- fread('test.csv') # consolidate the 2 data sets after creating a variable indicating train / test train\$flag <- 0; test\$flag <- 1 dat <- rbind(train,test) # change outcome, var_b and var_e into factor var dat\$outcome <- factor(dat\$outcome)
Created Oct 7, 2017
View AirPassengers.Rmd
 --- title: "ARIMA Modeling in R" output: html_document --- Let's start off by loading relevant R libraries! ```{r include = FALSE} library(tseries) library(zoo) library(forecast)
Last active Jul 17, 2020
View rice_strucchange.R
 library(xlsx) library(forecast) library(tseries) library(strucchange) ## load the data from a CSV or Excel file. This example is done with an Excel sheet. prod_df <- read.xlsx(file = 'agricultural_productivity.xls', sheetIndex = 'Sheet1', rowIndex = 8:65, colIndex = 2, header = FALSE) colnames(prod_df) <- c('Rice') ## store rice data as time series objects rice <- ts(prod_df\$Rice, start=c(1951, 1), end=c(2008, 1), frequency=1)
Last active Sep 17, 2017
View strucchange_usage.R
 # assuming you have a 'ts' object in R # 1. install package 'strucchange' # 2. Then write down this code: library(strucchange) # store the breakdates bp_ts <- breakpoints(ts ~ 1)
Last active Sep 1, 2016
Experiments With Data (Hackathon)
View experimentsWithData.ipynb