Skip to content

Instantly share code, notes, and snippets.

View abhirupkgp's full-sized avatar

Abhirup Mallik abhirupkgp

View GitHub Profile
# all about histograms
library(Sleuth3)
head(case0102)
#check the summary for finding min and max of the subset that you want to work with
summary(case0102$Salary[case0102$Sex == "Male"])
# plot the histogram in default setting
hist(case0102$Salary[case0102$Sex == "Male"],
main = "Histogram of starting salary of Men",
xlab = "Salary")
@abhirupkgp
abhirupkgp / gist:8475006
Last active January 3, 2016 14:19
Analysis of the data on Crime against Women in India in 2012.
library(sp)
library(RColorBrewer)
crimeW12 <- read.csv(url("http://data.gov.in/access-point-download-count?url=http://data.gov.in/sites/default/files/crdCAW_1.csv"), header = TRUE)
load(url("http://biogeo.ucdavis.edu/data/gadm2/R/IND_adm1.RData"))
#divide the data set into different crime headers
temp <- crimeW12[,c(1,4)]
crimeRep1 <- data.frame(State = temp[1:38,1],
Rape = temp[1:38,2], Kidnap = temp[39:76,2],
@abhirupkgp
abhirupkgp / 0_reuse_code.js
Created January 16, 2014 06:53
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@abhirupkgp
abhirupkgp / gist:8450718
Last active January 3, 2016 10:39
LAB 1 for STAT 3022. An Introduction to R.
# install library "Sleuth3"
install.packages("Sleuth3")
# load the library
library(Sleuth3)
#Getting data into R
#Reading data from computer or url:
chair_data <- read.table(url("http://users.stat.umn.edu/~malli066/3022/runstitch.txt"),header=T)