#create .txt file and tibble
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(readr)
teethclass3tttt <- read.table("~/wfed540/classmeeting 3/teethclass3tttt.txt")
teethclass3tttt
## V1 V2 V3 V4 V5 V6 V7
## 1 Name incisors canines premolars firstmolar secondmolar thirdmolar
## 2 Joe 4 3 8 4 0 0
## 3 Bob 3 2 7 3 0 0
## 4 Cindy 2 4 6 2 3 0
## 5 Jim 2 4 8 4 3 0
## 6 Maria 2 4 8 4 4 0
## 7 Gary 4 4 4 4 3 0
## 8 Steve 4 4 6 2 3 2
## 9 Leila 4 4 8 2 4 2
## 10 Sonja 4 4 8 2 4 0
## 11 Noda 4 4 8 3 4 0
## 12 David 3 3 6 0 4 0
## 13 Olga 3 3 8 4 3 4
## 14 Ted 2 0 6 4 3 2
## 15 Ray 1 4 4 4 0 1
teethclass3tttt <- tbl_df(teethclass3tttt)
teethclass3tttt
## # A tibble: 15 x 7
## V1 V2 V3 V4 V5 V6 V7
## <fctr> <fctr> <fctr> <fctr> <fctr> <fctr> <fctr>
## 1 Name incisors canines premolars firstmolar secondmolar thirdmolar
## 2 Joe 4 3 8 4 0 0
## 3 Bob 3 2 7 3 0 0
## 4 Cindy 2 4 6 2 3 0
## 5 Jim 2 4 8 4 3 0
## 6 Maria 2 4 8 4 4 0
## 7 Gary 4 4 4 4 3 0
## 8 Steve 4 4 6 2 3 2
## 9 Leila 4 4 8 2 4 2
## 10 Sonja 4 4 8 2 4 0
## 11 Noda 4 4 8 3 4 0
## 12 David 3 3 6 0 4 0
## 13 Olga 3 3 8 4 3 4
## 14 Ted 2 0 6 4 3 2
## 15 Ray 1 4 4 4 0 1
##################################
#create .csv file and tibble
library(dplyr)
library(readr)
teethclass33 <- read.csv("~/wfed540/classmeeting 3/teethclass33.csv")
teethclass33
## Name incisors canines premolars firstmolar secondmolar thirdmolar
## 1 Joe 4 3 8 4 0 0
## 2 Bob 3 2 7 3 0 0
## 3 Cindy 2 4 6 2 3 0
## 4 Jim 2 4 8 4 3 0
## 5 Maria 2 4 8 4 4 0
## 6 Gary 4 4 4 4 3 0
## 7 Steve 4 4 6 2 3 2
## 8 Leila 4 4 8 2 4 2
## 9 Sonja 4 4 8 2 4 0
## 10 Noda 4 4 8 3 4 0
## 11 David 3 3 6 0 4 0
## 12 Olga 3 3 8 4 3 4
## 13 Ted 2 0 6 4 3 2
## 14 Ray 1 4 4 4 0 1
teethclass33 <- tbl_df(teethclass33)
##################################
#create excel file and use tibble
library(readxl)
teethclass3x <- read_excel("~/wfed540/classmeeting 3/teethclass3x.xlsx")
View(teethclass3x)
teethclass3x
## # A tibble: 14 x 7
## Name incisors canines premolars firstmolar secondmolar thirdmolar
## <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 Joe 4 3 8 4 0 0
## 2 Bob 3 2 7 3 0 0
## 3 Cindy 2 4 6 2 3 0
## 4 Jim 2 4 8 4 3 0
## 5 Maria 2 4 8 4 4 0
## 6 Gary 4 4 4 4 3 0
## 7 Steve 4 4 6 2 3 2
## 8 Leila 4 4 8 2 4 2
## 9 Sonja 4 4 8 2 4 0
## 10 Noda 4 4 8 3 4 0
## 11 David 3 3 6 0 4 0
## 12 Olga 3 3 8 4 3 4
## 13 Ted 2 0 6 4 3 2
## 14 Ray 1 4 4 4 0 1
teethclass3x <- tbl_df(teethclass3x)
teethclass3x
## # A tibble: 14 x 7
## Name incisors canines premolars firstmolar secondmolar thirdmolar
## <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 Joe 4 3 8 4 0 0
## 2 Bob 3 2 7 3 0 0
## 3 Cindy 2 4 6 2 3 0
## 4 Jim 2 4 8 4 3 0
## 5 Maria 2 4 8 4 4 0
## 6 Gary 4 4 4 4 3 0
## 7 Steve 4 4 6 2 3 2
## 8 Leila 4 4 8 2 4 2
## 9 Sonja 4 4 8 2 4 0
## 10 Noda 4 4 8 3 4 0
## 11 David 3 3 6 0 4 0
## 12 Olga 3 3 8 4 3 4
## 13 Ted 2 0 6 4 3 2
## 14 Ray 1 4 4 4 0 1
####################################
#Import the .csv file from the web and create tibble
library(dplyr)
library(readr)
alphafile <- read.csv("http://www.personal.psu.edu/dlp/alphaheight_weight_dataset.csv")
alphafile<- tbl_df(alphafile)
alphafile
## # A tibble: 200 x 4
## Index Height Weight Gender
## <int> <dbl> <dbl> <fctr>
## 1 1 65.78 112.99 female
## 2 2 71.52 136.49 male
## 3 3 69.40 153.03 male
## 4 4 68.22 142.34 female
## 5 5 67.79 144.30 male
## 6 6 68.70 123.30 male
## 7 7 69.80 141.49 male
## 8 8 70.01 136.46 female
## 9 9 67.90 112.37 male
## 10 10 66.78 120.67 male
## # ... with 190 more rows
#####################################
#Import the .csv file from the web and create tibble
titanic <- read.csv("http://www.personal.psu.edu/dlp/w540/datasets/titanicsurvival.csv")
titanic <- tbl_df(titanic)
titanic
## # A tibble: 2,201 x 4
## Class Age Sex Survive
## <int> <int> <int> <int>
## 1 1 1 1 1
## 2 1 1 1 1
## 3 1 1 1 1
## 4 1 1 1 1
## 5 1 1 1 1
## 6 1 1 1 1
## 7 1 1 1 1
## 8 1 1 1 1
## 9 1 1 1 1
## 10 1 1 1 1
## # ... with 2,191 more rows
####################################
#Import the SPSS .sav file from the web and create tibble
library(haven)
library(readr)
EXAMPLE_23_1 <- read_sav("~/wfed540/R projects/EXAMPLE_23_1.sav")
EXAMPLE_23_1 <- tbl_df(EXAMPLE_23_1)
EXAMPLE_23_1
## # A tibble: 1,028 x 12
## Illness Item_1 Item_2 Item_3 Item_4 Item_5 Item_6
## <dbl+lbl> <dbl+lbl> <dbl+lbl> <dbl+lbl> <dbl> <dbl+lbl> <dbl+lbl>
## 1 1 4 3 3 3 4 2
## 2 0 3 2 4 3 4 3
## 3 0 4 3 4 3 3 2
## 4 1 5 5 4 5 4 5
## 5 1 2 2 2 2 2 2
## 6 0 3 2 2 3 2 1
## 7 0 2 1 1 2 1 2
## 8 0 3 2 4 4 2 2
## 9 0 2 4 3 3 3 3
## 10 1 1 1 1 1 1 1
## # ... with 1,018 more rows, and 5 more variables: Item_7 <dbl>,
## # Item_8 <dbl+lbl>, Item_9 <dbl+lbl>, Item_10 <dbl+lbl>, Item_11 <dbl>