Create an example of one hypothetical dataset, first, in an untidy form and, then, in a tidy form. Each observation is not placed in its own row.
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(readxl)
Assignment_4_tidy_ <- read_excel("~/Desktop/Assignment 4 (tidy).xlsx")
Assignment_4_tidy_
## # A tibble: 71 x 6
## Trucks x2012 x2013 x2014 X__1 X__2
## <chr> <dbl> <dbl> <chr> <lgl> <chr>
## 1 Ford 10 5 4 NA <NA>
## 2 Cheve 8 7 8 NA Untidy
## 3 Dodge 5 5 5 NA <NA>
## 4 <NA> NA NA <NA> NA <NA>
## 5 <NA> NA NA <NA> NA <NA>
## 6 Ford 2012 NA <NA> NA <NA>
## 7 Ford 2012 NA <NA> NA <NA>
## 8 Ford 2012 NA <NA> NA <NA>
## 9 Ford 2012 NA <NA> NA <NA>
## 10 Ford 2012 NA <NA> NA <NA>
## # ... with 61 more rows
# The difference between untidy and tidy.
#Variables in the data set are placed in their own columns.Each observation is placed in its own row. Each value is its own cell.
#Collect three separate sets of 10 observations of two variables.
#Print each dataset.
library(readxl)
Assignment_4_2_ <- read_excel("~/Desktop/Assignment 4 (2).xlsx")
Assignment_4_2_
## # A tibble: 10 x 3
## X__1 Weight Height
## <chr> <dbl> <chr>
## 1 Patient 1 175 "6'9\""
## 2 Patient 2 170 "6'2\""
## 3 Patient 3 165 "6'5\""
## 4 Patient 4 135 "6'6\""
## 5 Patient 5 185 "6'7\""
## 6 Patient 6 165 "6'9\""
## 7 Patient 7 175 "7'1\""
## 8 Patient 8 187 "7'2\""
## 9 Patient 9 155 "7'1\""
## 10 Patient 10 153 "7'1\""
# Variable are Weight and Height
# The comparison of weight and height as patients in hospital.
# This is example of Ratio measurement.
library(readxl)
Assignemt_4_3_ <- read_excel("~/Desktop/Assignemt 4 (3).xlsx")
Assignemt_4_3_
## # A tibble: 11 x 4
## schools year sex `graudation age`
## <chr> <dbl> <chr> <chr>
## 1 clearfield 2000 m 17-
## 2 state college 2000 m 17-
## 3 dubios 2000 m 17-
## 4 currwensville 2000 m 17-
## 5 bald eagle 2000 m 17-
## 6 p.o. 2000 m 17-
## 7 bellefonte 2000 m 17-
## 8 harmony 2000 m 17-
## 9 moshannon valley 2000 m 17-
## 10 west branch 2000 m 17-
## 11 harrisburg city 2000 m 17-
# Variable are Sex and Age
# Comparing graduation age to each school.
# This is example of Nominal measurement.
library(readxl)
Assignment_4_4_ <- read_excel("~/Desktop/Assignment 4 (4).xlsx")
Assignment_4_4_
## # A tibble: 10 x 3
## X__1 `non-smoker` smoker
## <chr> <chr> <chr>
## 1 Patient 1 n y
## 2 Patient 2 y n
## 3 Patient 3 y n
## 4 Patient 4 y n
## 5 Patient 5 n y
## 6 Patient 6 n y
## 7 Patient 7 y n
## 8 Patient 8 y n
## 9 Patient 9 y n
## 10 Patient 10 y n
# Variable are Smoker and Nonsmoker
# The difference from nonsmoker to smokers as patients.
# This is example of Nominal measurement
library(readxl)
Assignment_4_5_ <- read_excel("~/Desktop/Assignment 4 (5).xlsx")
Assignment_4_5_
## # A tibble: 10 x 3
## X__1 class hair
## <chr> <chr> <chr>
## 1 Student 1 sophomore brown
## 2 Student 2 junior brown
## 3 Student 3 senior blonde
## 4 Student 4 senior black
## 5 Student 5 senior black
## 6 Student 6 junior blonde
## 7 Student 7 sophomore brown
## 8 Student 8 sophomore black
## 9 Student 9 senior black
## 10 Student 10 junior brown
# Variables are class and color of hair.
# The comparison of different hair styles of students in 10, 11, 12 grades.
# This is example of Ordinal and Nominal measurement.