Publications by Hao-Lun Fu
Week 5 In-class exercise 3
In-class exercise 3 Hao-Lun Fu 2020-04-13 pacman::p_load(tidyverse) dta <- read_csv("http://kbroman.org/datacarp/portal_data_joined.csv") ## Parsed with column specification: ## cols( ## record_id = col_double(), ## month = col_double(), ## day = col_double(), ## year = col_double(), ## plot_id = col_double(), ## species_id = col_cha...
75 sym R (9505 sym/45 pcs)
3 dice
3 Dice Hao-Lun Fu 2020-03-30 3 dice create data dice <- outer(1:6, 1:6, '+') list(dice) ## [[1]] ## [,1] [,2] [,3] [,4] [,5] [,6] ## [1,] 2 3 4 5 6 7 ## [2,] 3 4 5 6 7 8 ## [3,] 4 5 6 7 8 9 ## [4,] 5 6 7 8 9 10 ## [5,] 6 7 8 9 10 11 ## [6,] 7 8 ...
151 sym R (2071 sym/5 pcs) 1 img
Week 4 In-class exercise
Week4 In-class exercise Hao-Lun Fu 2020-03-24 Exercise 1: Student ID Load file Change the data structure from factor to character add missing ID, then order as requirement dta <- read.table("/Users/haolunfu/Documents/資料管理/week4/student2017.txt", header = T) dtac <- dta dtac$ID <- as.character(dtac$ID) dtac[17,1] <- "U76067010" dtac <-...
1028 sym R (4709 sym/24 pcs) 2 img
Week 3 Homework
Week3 Homework Hao-Lun Fu 2020-03-30 Exercise 1: ToothGrowth Input data dta <- ToothGrowth head(dta) ## len supp dose ## 1 4.2 VC 0.5 ## 2 11.5 VC 0.5 ## 3 7.3 VC 0.5 ## 4 5.8 VC 0.5 ## 5 6.4 VC 0.5 ## 6 10.0 VC 0.5 List mean, sd and observations aggregate(len ~ supp, mean, data=dta) ## supp len ## 1 OJ 20.663...
1534 sym R (5050 sym/48 pcs) 8 img
Week 3 in-class exercise
Week 3 In-class exercise Hao-Lun Fu 2020-03-23 Exercise 1: math attainment input data read in a plain text file with variable names and assign a name to it dta <- read.table("/Users/haolunfu/Documents/資料管理/week3/math_attainment.txt", header = T) checking data structure of data str(dta) ## 'data.frame': 39 obs. of 3 variables: ## ...
1574 sym R (6892 sym/49 pcs) 3 img
Week 3 in-class exercise 5
ChickWts Hao-Lun Fu 2020-03-16 Load dataset Show the data structure library(datasets) dat <- datasets::chickwts str(dat) ## 'data.frame': 71 obs. of 2 variables: ## $ weight: num 179 160 136 227 217 168 108 124 143 140 ... ## $ feed : Factor w/ 6 levels "casein","horsebean",..: 2 2 2 2 2 2 2 2 2 2 ... As you can see, the column 2 is th...
226 sym R (2282 sym/6 pcs)
Week 3 in-class exercise 4
UCBAdmissions Hao-Lun Fu 2020-03-16 Load dataset Data structure library(datasets) dat <- datasets::UCBAdmissions str(dat) ## 'table' num [1:2, 1:2, 1:6] 512 313 89 19 353 207 17 8 120 205 ... ## - attr(*, "dimnames")=List of 3 ## ..$ Admit : chr [1:2] "Admitted" "Rejected" ## ..$ Gender: chr [1:2] "Male" "Female" ## ..$ Dept : chr [1:6...
216 sym R (555 sym/8 pcs)
Week 3 in-class exercise 3
Race and Birth Weight Hao-Lun Fu 2020-03-16 Load the data Show the first 6 data library(MASS) dat <- MASS::birthwt head(dat) ## low age lwt race smoke ptl ht ui ftv bwt ## 85 0 19 182 2 0 0 0 1 0 2523 ## 86 0 33 155 3 0 0 0 0 3 2551 ## 87 0 20 105 1 1 0 0 0 1 2557 ## 88 0 21 108 1 1 ...
211 sym R (879 sym/6 pcs)
Week 3 in-class exercise 1
math_attainment Hao-Lun Fu 2020-03-16 input data read in a plain text file with variable names and assign a name to it dta <- read.table("/Users/haolunfu/Documents/資料管理/week3/math_attainment.txt", header = T) checking data structure of data str(dta) #> 'data.frame': 39 obs. of 3 variables: #> $ math2: int 28 56 51 13 39 41 30 13...
458 sym R (2461 sym/12 pcs) 3 img
Week 3 in-class exercise 2
Women Hao-Lun Fu 2020-03-16 Load dataset library(datasets) dta <- datasets::women Read the first 6 data head(dta) ## height weight ## 1 58 115 ## 2 59 117 ## 3 60 120 ## 4 61 123 ## 5 62 126 ## 6 63 129 List all values of the data by column or variable As you can see, there are two variables (height...
281 sym R (486 sym/7 pcs)