Publications by Richard Zheng
Matrix Transformations
Functions: plotTransformation = function(m,X,Y){ x_coord = c() y_coord = c() for (i in seq(length(X))){ coord_m = matrix(c(X[i],Y[i]),nrow=2,ncol=1) new_coord = m %*% coord_m x_coord = append(x_coord,new_coord[1]) y_coord = append(y_coord,new_coord[2]) } plot(y_coord~x_coord,xlim=c(-4,8), ylim=c(-3,3)) } she...
142 sym R (1413 sym/6 pcs) 5 img
Practice
Write a loop that calculates 12-factorial factorial <- function(num){ total = num while (num>1){ total = total*(num-1) num = num - 1 } return(total) } factorial(12) ## [1] 479001600 Show how to create a numeric vector that contains the sequence from 20 to 50 by 5. seq(20,50,5) ## [1] 20 25 30 35 40 45 50 Create the fun...
311 sym R (520 sym/6 pcs)
EigenShoes
Set up Packages library(EBImage) library(jpeg) library(OpenImageR) ## ## Attaching package: 'OpenImageR' ## The following objects are masked from 'package:EBImage': ## ## readImage, writeImage Loading Images num=17 path="jpg/" files=list.files(path,pattern="\\.jpg")[1:num] View Images Function height=1200; width=2500;scale=20 plo...
342 sym R (3775 sym/19 pcs) 4 img
non_voter
Exploratory data analysis on variables that may affect why people don’t vote Loading data into dataframe non_voter = read.csv("https://raw.githubusercontent.com/fivethirtyeight/data/master/non-voters/nonvoters_data.csv", header= TRUE, sep=",") Creating a subset,renaming columns and droping na values subset_voter = subset(non_voter,select = c(pp...
785 sym R (968 sym/7 pcs) 4 img
Data 607 HW3
packages used library(tidyverse) ## -- Attaching packages --------------------------------------- tidyverse 1.3.0 -- ## v ggplot2 3.3.3 v purrr 0.3.4 ## v tibble 3.0.5 v dplyr 1.0.3 ## v tidyr 1.1.2 v stringr 1.4.0 ## v readr 1.4.0 v forcats 0.5.1 ## -- Conflicts ------------------------------------------ tidyverse_con...
862 sym R (3137 sym/30 pcs)
Chess Tournament Results
Loading packages library(tidyverse) ## -- Attaching packages --------------------------------------- tidyverse 1.3.0 -- ## v ggplot2 3.3.3 v purrr 0.3.4 ## v tibble 3.0.5 v dplyr 1.0.3 ## v tidyr 1.1.2 v stringr 1.4.0 ## v readr 1.4.0 v forcats 0.5.1 ## -- Conflicts ------------------------------------------ tidyverse_...
256 sym R (6941 sym/15 pcs)
data606 week12
packages library(tidyverse) ## -- Attaching packages --------------------------------------- tidyverse 1.3.0 -- ## v ggplot2 3.3.3 v purrr 0.3.4 ## v tibble 3.1.0 v dplyr 1.0.5 ## v tidyr 1.1.3 v stringr 1.4.0 ## v readr 1.4.0 v forcats 0.5.1 ## Warning: package 'tibble' was built under R version 4.0.5 ## Warning: pack...
351 sym R (1809 sym/13 pcs) 1 img
DATA607 week 7
loading packages library(tidyverse) ## -- Attaching packages --------------------------------------- tidyverse 1.3.0 -- ## v ggplot2 3.3.3 v purrr 0.3.4 ## v tibble 3.0.5 v dplyr 1.0.3 ## v tidyr 1.1.2 v stringr 1.4.0 ## v readr 1.4.0 v forcats 0.5.1 ## -- Conflicts ------------------------------------------ tidyverse_...
380 sym R (4890 sym/25 pcs)
Tidy Airline
Packages library(tidyverse) ## -- Attaching packages --------------------------------------- tidyverse 1.3.0 -- ## v ggplot2 3.3.3 v purrr 0.3.4 ## v tibble 3.0.5 v dplyr 1.0.3 ## v tidyr 1.1.2 v stringr 1.4.0 ## v readr 1.4.0 v forcats 0.5.1 ## -- Conflicts ------------------------------------------ tidyverse_conflict...
970 sym R (2775 sym/14 pcs) 4 img
DATA 607 Project 2
Loading Packages library(tidyverse) ## -- Attaching packages --------------------------------------- tidyverse 1.3.0 -- ## v ggplot2 3.3.3 v purrr 0.3.4 ## v tibble 3.0.5 v dplyr 1.0.3 ## v tidyr 1.1.2 v stringr 1.4.0 ## v readr 1.4.0 v forcats 0.5.1 ## -- Conflicts ------------------------------------------ tidyverse_...
1700 sym R (54569 sym/27 pcs) 6 img