#Must load dplyr
#Import .xlsx file on my computer
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)
Table_xlsx_ <- read_excel("~/Desktop/tables/Table(.xlsx).xlsx")

library(dplyr)
#Create a "tibble"
Table_xlsx_ <- tbl_df(Table_xlsx_)
Table_xlsx_
## # A tibble: 15 x 7
##        Name Clearfield `State_ College`  Dogs Brownfish Pittsburgh
##       <chr>      <dbl>            <dbl> <dbl>     <dbl>      <dbl>
##  1    Steve          2                1     1        10          2
##  2     Nina          2                1     2        11          2
##  3     Gary          2                1     1        12          2
##  4     Daci          2                1     1        10          2
##  5 Jennifer          2                1     1        11          2
##  6    Terry          2                1     1        12          2
##  7     Dave          2                1     1        13          2
##  8      Joe          2                1     1        14          2
##  9    Patty          2                1     2        13          2
## 10      Deb          2                1     1        15          2
## 11     Mark          2                1     2        16          2
## 12     Joey          2                1     2        12          2
## 13    Sonja          2                1     1        12          2
## 14    Lelia          2                1     3        11          2
## 15     Dave          2                1     1        10          2
## # ... with 1 more variables: Harrisburg <dbl>
#Summarize
summary(Table_xlsx_)
##      Name             Clearfield State_ College      Dogs    
##  Length:15          Min.   :2    Min.   :1      Min.   :1.0  
##  Class :character   1st Qu.:2    1st Qu.:1      1st Qu.:1.0  
##  Mode  :character   Median :2    Median :1      Median :1.0  
##                     Mean   :2    Mean   :1      Mean   :1.4  
##                     3rd Qu.:2    3rd Qu.:1      3rd Qu.:2.0  
##                     Max.   :2    Max.   :1      Max.   :3.0  
##    Brownfish       Pittsburgh   Harrisburg
##  Min.   :10.00   Min.   :2    Min.   :1   
##  1st Qu.:11.00   1st Qu.:2    1st Qu.:1   
##  Median :12.00   Median :2    Median :1   
##  Mean   :12.13   Mean   :2    Mean   :1   
##  3rd Qu.:13.00   3rd Qu.:2    3rd Qu.:1   
##  Max.   :16.00   Max.   :2    Max.   :1
#########################################
#Import .csv file on my computer
library(readxl)
Table_csv_ <- read_excel("~/Desktop/tables/Table(.csv).xlsx")

library(dplyr)
#Create a "tibble"
Table_csv_ <- tbl_df(Table_csv_)
Table_csv_
## # A tibble: 15 x 7
##        Name Clearfield `State_ College`  Dogs Brownfish Pittsburgh
##       <chr>      <dbl>            <dbl> <dbl>     <dbl>      <dbl>
##  1    Steve          2                1     1        10          2
##  2     Nina          2                1     2        11          2
##  3     Gary          2                1     1        12          2
##  4     Daci          2                1     1        10          2
##  5 Jennifer          2                1     1        11          2
##  6    Terry          2                1     1        12          2
##  7     Dave          2                1     1        13          2
##  8      Joe          2                1     1        14          2
##  9    Patty          2                1     2        13          2
## 10      Deb          2                1     1        15          2
## 11     Mark          2                1     2        16          2
## 12     Joey          2                1     2        12          2
## 13    Sonja          2                1     1        12          2
## 14    Lelia          2                1     3        11          2
## 15     Dave          2                1     1        10          2
## # ... with 1 more variables: Harrisburg <dbl>
#Summarize
summary(Table_csv_)
##      Name             Clearfield State_ College      Dogs    
##  Length:15          Min.   :2    Min.   :1      Min.   :1.0  
##  Class :character   1st Qu.:2    1st Qu.:1      1st Qu.:1.0  
##  Mode  :character   Median :2    Median :1      Median :1.0  
##                     Mean   :2    Mean   :1      Mean   :1.4  
##                     3rd Qu.:2    3rd Qu.:1      3rd Qu.:2.0  
##                     Max.   :2    Max.   :1      Max.   :3.0  
##    Brownfish       Pittsburgh   Harrisburg
##  Min.   :10.00   Min.   :2    Min.   :1   
##  1st Qu.:11.00   1st Qu.:2    1st Qu.:1   
##  Median :12.00   Median :2    Median :1   
##  Mean   :12.13   Mean   :2    Mean   :1   
##  3rd Qu.:13.00   3rd Qu.:2    3rd Qu.:1   
##  Max.   :16.00   Max.   :2    Max.   :1
#######################################
#Import .txt file on my computer
library(readxl)
Table_txt_ <- read_excel("~/Desktop/tables/Table(.txt).xlsx")

library(dplyr)
#Create a "tibble"
Table_txt_ <- tbl_df(Table_txt_)
Table_txt_
## # A tibble: 15 x 7
##        Name Clearfield `State_ College`  Dogs Brownfish Pittsburgh
##       <chr>      <dbl>            <dbl> <dbl>     <dbl>      <dbl>
##  1    Steve          2                1     1        10          2
##  2     Nina          2                1     2        11          2
##  3     Gary          2                1     1        12          2
##  4     Daci          2                1     1        10          2
##  5 Jennifer          2                1     1        11          2
##  6    Terry          2                1     1        12          2
##  7     Dave          2                1     1        13          2
##  8      Joe          2                1     1        14          2
##  9    Patty          2                1     2        13          2
## 10      Deb          2                1     1        15          2
## 11     Mark          2                1     2        16          2
## 12     Joey          2                1     2        12          2
## 13    Sonja          2                1     1        12          2
## 14    Lelia          2                1     3        11          2
## 15     Dave          2                1     1        10          2
## # ... with 1 more variables: Harrisburg <dbl>
#Summarize
summary(Table_txt_)
##      Name             Clearfield State_ College      Dogs    
##  Length:15          Min.   :2    Min.   :1      Min.   :1.0  
##  Class :character   1st Qu.:2    1st Qu.:1      1st Qu.:1.0  
##  Mode  :character   Median :2    Median :1      Median :1.0  
##                     Mean   :2    Mean   :1      Mean   :1.4  
##                     3rd Qu.:2    3rd Qu.:1      3rd Qu.:2.0  
##                     Max.   :2    Max.   :1      Max.   :3.0  
##    Brownfish       Pittsburgh   Harrisburg
##  Min.   :10.00   Min.   :2    Min.   :1   
##  1st Qu.:11.00   1st Qu.:2    1st Qu.:1   
##  Median :12.00   Median :2    Median :1   
##  Mean   :12.13   Mean   :2    Mean   :1   
##  3rd Qu.:13.00   3rd Qu.:2    3rd Qu.:1   
##  Max.   :16.00   Max.   :2    Max.   :1
######################################
#Import .csv file from a remote location
csvwebfile <- read.csv("http://www.personal.psu.edu/dlp/alphaheight_weight_dataset.csv")

library(dplyr)
#Create a "tibble"
csvwebfile <- tbl_df(csvwebfile)
csvwebfile
## # 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
#Summarize
summary(csvwebfile)
##      Index            Height          Weight         Gender   
##  Min.   :  1.00   Min.   :63.43   Min.   : 97.9   female: 95  
##  1st Qu.: 50.75   1st Qu.:66.52   1st Qu.:119.9   male  :105  
##  Median :100.50   Median :67.94   Median :127.9               
##  Mean   :100.50   Mean   :67.95   Mean   :127.2               
##  3rd Qu.:150.25   3rd Qu.:69.20   3rd Qu.:136.1               
##  Max.   :200.00   Max.   :73.90   Max.   :159.0
#####################################
#Import .csv webfile 
csvwebfile2 <- read.csv("http://www.personal.psu.edu/dlp/w540/datasets/titanicsurvival.csv")

library(dplyr)                   
#Create a "tibble"
csvwebfile2 <- tbl_df(csvwebfile2)
csvwebfile2
## # 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
#Summarize
summary(csvwebfile2)
##      Class            Age              Sex            Survive     
##  Min.   :0.000   Min.   :0.0000   Min.   :0.0000   Min.   :0.000  
##  1st Qu.:0.000   1st Qu.:1.0000   1st Qu.:1.0000   1st Qu.:0.000  
##  Median :1.000   Median :1.0000   Median :1.0000   Median :0.000  
##  Mean   :1.369   Mean   :0.9505   Mean   :0.7865   Mean   :0.323  
##  3rd Qu.:3.000   3rd Qu.:1.0000   3rd Qu.:1.0000   3rd Qu.:1.000  
##  Max.   :3.000   Max.   :1.0000   Max.   :1.0000   Max.   :1.000
#####################################
#Import from spss
library(haven)
EXAMPLE_23_1 <- read_sav("~/Downloads/EXAMPLE_23_1.sav")


library(dplyr)
#Create a “tibble”
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>
#Summarize
summary(EXAMPLE_23_1)
##     Illness           Item_1          Item_2          Item_3    
##  Min.   :0.0000   Min.   :1.000   Min.   :1.000   Min.   :1.00  
##  1st Qu.:0.0000   1st Qu.:2.000   1st Qu.:2.000   1st Qu.:2.00  
##  Median :0.0000   Median :3.000   Median :3.000   Median :3.00  
##  Mean   :0.3492   Mean   :2.855   Mean   :2.938   Mean   :2.89  
##  3rd Qu.:1.0000   3rd Qu.:3.000   3rd Qu.:4.000   3rd Qu.:4.00  
##  Max.   :1.0000   Max.   :5.000   Max.   :5.000   Max.   :5.00  
##      Item_4          Item_5          Item_6          Item_7     
##  Min.   :1.000   Min.   :1.000   Min.   :1.000   Min.   :1.000  
##  1st Qu.:2.000   1st Qu.:2.000   1st Qu.:2.000   1st Qu.:2.000  
##  Median :3.000   Median :3.000   Median :2.000   Median :3.000  
##  Mean   :2.832   Mean   :2.949   Mean   :2.483   Mean   :3.022  
##  3rd Qu.:4.000   3rd Qu.:4.000   3rd Qu.:3.000   3rd Qu.:4.000  
##  Max.   :5.000   Max.   :5.000   Max.   :5.000   Max.   :5.000  
##      Item_8         Item_9         Item_10         Item_11    
##  Min.   :1.00   Min.   :1.000   Min.   :1.000   Min.   :1.00  
##  1st Qu.:3.00   1st Qu.:3.000   1st Qu.:3.000   1st Qu.:3.00  
##  Median :4.00   Median :4.000   Median :4.000   Median :4.00  
##  Mean   :3.58   Mean   :3.601   Mean   :3.444   Mean   :3.55  
##  3rd Qu.:4.00   3rd Qu.:4.000   3rd Qu.:4.000   3rd Qu.:4.00  
##  Max.   :5.00   Max.   :5.000   Max.   :5.000   Max.   :5.00