Private Repository for HW assignments of Stat 133 (Spring 2019)
- Name: Hongling Lei
- Github username: HonglingLei
- Email: honglinglei@berkeley.edu / leihongling1998@163.com
- Lab section: 111
- Professor: Gaston Sanchez
- GSI: Yulun Wu
-
Workout 1: NBA Performance Analysis
This R written project is mainly about the data analysis cycle of NBA GSW data. In the data preparation stage, I downloaded data, cleaned data by manipulating them, and merged files for further analysis. In the core analysis stage, I wrote code to make statistical summaries of different players' performances, plotted graphs to display their shots and changed the formats of the graphs to enable them to be shown in the final report. In the reporting stage, I wrote an Rmd file to display the analyzing process and results to readers. My final report includes the following parts - introduction, motivation, background, data, analysis, discussion, conclusion, and references. -
Workout 2: Investment Shiny App
In this project, I created a Shiny App that allows users to visualize - in an interactive way - some of the saving/investing scenatios. There are three modes of investing: no contribution after principal, fixed annual contribution, and growing annual contribution. When users open this Shiny App, they can drag the dot on each bar to customize parameters, such as "Initial Amount", "Return Rate", "Years", "Annual Contribution", "Growth Rate", and whether they want a faceted display or not. Then the App automatically calculates the total account balance each year under the three investing modes. It also graphs the balances with time to give users a visual understanding of the growing trends. -
Workout 3: R Package "binomial"
I created an R package called "binomial" that provides functions to check whether the inputs are valid, to calculate the probability based on given parameters, to graph the distribution and to display a summary of expected value, variance, skewness, kurtosis, etc.
Get started with R as a scientific calculator
Understand pane layout of RStudio
Understand the help documentation in R
How to install packages
Difference between .R and .Rmd files
Get to know markdown syntax
Work with vectors of different data types
Understand the concept of atomic structures
Learn how to subset and slice R vectors
Understand the concept of vectorization
Understand recycling rules in R
Importing Data Tables in R
Default reading-table functions
Basic manipulation of data frames
Get started with
"dplyr"
Get to know the basic dplyr verbs:
slice()
,filter()
,select()
mutate()
arrange()
summarise()
group_by()
Get started with"ggplot2"
Produce basic plots withggplot()
Practicing with the command line
Navigating the filesystem and managing files
Practice basic manipulation of data files
Practice exporting tables from R
Practice exporting displayed output (as is) from R
Practice exporting plot images from R
Create a GitHub repository
Create a local Git repository
Practice adding, and committing changes to your (local) Git repo
Practice pushing committed changes to a remote repo
Learn how to write simple functions
Get into the habit of writing simple functions
Get into the habit of documenting functions
Make sure your functions work
Use conditionals if-then-else
Forget about vectorized code (pretend it doesn’t exist)
Practice writing simple loops
Get familiar with the syntax of a for loop
Get familiar with the syntax of a while loop
Get familiar with the syntax of a repeat loop
Encapsulate loops inside a function call
Introduction to the R package “testthat”
Write simple functions and their unit tests
Test your code
String manipulation
Base R functions for strings
getting started with simulations in R
learn how to create a basic shiny app
put in practice concepts from your introductory statistics course(s)
Work with the package "stringr"
String manipulation
More regular expressions
A bit of data cleaning
Work with the package "rvest"
Learn to extract html elements and attributes
Create a simple crawler