Skip to content

Instantly share code, notes, and snippets.

View Luckyeva's full-sized avatar

Wenting Li Luckyeva

View GitHub Profile
@Luckyeva
Luckyeva / Python-notes.ipynb
Created April 2, 2017 14:38
My Python Notes
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#################################
# Optimization #
# 1) function f maps the possible
# variable domain to the objective
# function u(var1, var2, var3)
# 2) it compute the value of u and
# return the highest value of u
#########################################
# R Script for Getting and CLeaning data
#########################################
# Load data from downloaded text files
filepath <- "/Users/lucky1eva/Downloads/UCI HAR Dataset/train/X_train.txt"
rawdata_train <- read.table(filepath)
filepath <- "/Users/lucky1eva/Downloads/UCI HAR Dataset/train/y_train.txt"
## R Programming Assignment 3 - Part III
## TASKS:
## (1) Plot the 30-day mortality rates for heart attack
## (2) Finding the best hospital in a state
## (3) Ranking hospitals by outcome in a state
## -> (4) Ranking hospitals in all states
## (4) Ranking hospitals in all states
@Luckyeva
Luckyeva / rankhospital.R
Last active February 13, 2016 16:13
R programming Assignment 3 - Part II
## R Programming Assignment 3 - Part II
## Introduction
# The data for this assignment come from the Hospital Compare web site (http://hospitalcompare.hhs.gov)
# run by the U.S. Department of Health and Human Services. The purpose of the web site is to provide data and
# information about the quality of care at over 4,000 Medicare-certified hospitals in the U.S. This dataset essentially
# covers all major U.S. hospitals. This dataset is used for a variety of purposes, including determining
# whether hospitals should be fined for not providing high quality care to patients (see http://goo.gl/jAXFX
# for some background on this particular topic).
@Luckyeva
Luckyeva / best.R
Last active February 13, 2016 04:08
## R Programming Assignment 3 - Part I
## Introduction
# Download the file ProgAssignment3-data.zip file containing the data for Programming Assignment 3 from
# the Coursera web site. Unzip the file in a directory that will serve as your working directory. When you
# start up R make sure to change your working directory to the directory where you unzipped the data.
# The data for this assignment come from the Hospital Compare web site (http://hospitalcompare.hhs.gov)
# run by the U.S. Department of Health and Human Services. The purpose of the web site is to provide data and
# information about the quality of care at over 4,000 Medicare-certified hospitals in the U.S. This dataset essentially
@Luckyeva
Luckyeva / complete.R
Last active February 9, 2016 04:14
This is a function I wrote in R to summarise the number of complete cases in any given table
# R assignment 1 - Air Pollution
# preparation for R workspace
myTable <- NULL
mydata <- NULL
idd <- NULL
nobs <- NULL
@Luckyeva
Luckyeva / corr.R
Last active February 9, 2016 04:03
This is one of the functions I wrote for R programming Coursera assignment
# R assignment 1 - Air Poluttion
corr <- function(directory, threshold = 0){
# 'threshold' is a numeric vector of length 1 indicating the
# number of complete cases required to compute the correlation
setwd(paste("/Users/lucky1eva/Downloads/", directory, sep = '' ))
cr <- NULL
dlist <- complete(directory, 1:332)
oklist <- dlist[dlist[,2] >= threshold , 1]