This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(fs) | |
library(tidyverse) | |
mpg_samples <- map(1:40, ~ slice_sample(mpg, n = 20)) | |
# Create data frames and store them to disk | |
dir_create(c("chapters/01_improve_reading_files/reprex_files")) | |
iwalk(mpg_samples[1:9], | |
~ write_csv(.x, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
# Data -------------------------------------------------------------------- | |
viz_data_one <- tibble( | |
age_group = c(rep("Adolescent", 3), rep("Young Adult", 3)), | |
framing_score = c(0.2, 0.08, 0.09, 0.3, 0.28, 0.15), | |
upper = framing_score + .02, | |
lower = framing_score - .02, | |
reward = rep(c("Small Reward", "Medium Reward", "Large Reward"), 2) |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (!require(ggplot2)) install.packages('ggplot2') | |
if (!require(extrafont)) install.packages('extrafont') | |
library(ggplot2) | |
library(extrafont) | |
# **************** Base theme ************************************* | |
base_theme <- theme( | |
plot.margin = unit(rep(1, 4), "cm"), | |
plot.title = element_text(size = rel(1.3), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Person | gender | Age | Height | pre.weight | Diet | weight6weeks | |
---|---|---|---|---|---|---|---|
25 | 41 | 171 | 60 | 2 | 60 | ||
26 | 32 | 174 | 103 | 2 | 103 | ||
1 | 0 | 22 | 159 | 58 | 1 | 54.2 | |
2 | 0 | 46 | 192 | 60 | 1 | 54 | |
3 | 0 | 55 | 170 | 64 | 1 | 63.3 | |
4 | 0 | 33 | 171 | 64 | 1 | 61.1 | |
5 | 0 | 50 | 170 | 65 | 1 | 62.2 | |
6 | 0 | 50 | 201 | 66 | 1 | 64 | |
7 | 0 | 37 | 174 | 67 | 1 | 65 |
We can make this file beautiful and searchable if this error is corrected: It looks like row 9 should actually have 33 columns, instead of 14. in line 8.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
school,sex,age,address,famsize,Pstatus,Medu,Fedu,Mjob,Fjob,reason,guardian,traveltime,studytime,failures,schoolsup,famsup,paid,activities,nursery,higher,internet,romantic,famrel,freetime,goout,Dalc,Walc,health,absences,G1,G2,G3 | |
GP,M,17,U,GT3,T,3,3,other,other,reputation,father,1,2,0,no,no,no,yes,no,yes,yes,no,4,3,4,1,4,4,4,6,5,6 | |
GP,F,16,U,GT3,T,4,3,other,at_home,course,mother,1,3,0,yes,yes,yes,no,yes,yes,yes,no,5,3,5,1,1,3,0,7,9,8 | |
GP,M,17,U,GT3,T,3,3,services,services,other,mother,1,2,0,no,yes,no,yes,yes,yes,yes,yes,4,3,4,2,3,4,12,12,12,11 | |
GP,F,15,R,GT3,T,1,1,other,other,reputation,mother,1,2,2,yes,yes,no,no,no,yes,yes,yes,3,3,4,2,4,5,2,8,6,5 | |
GP,F,16,U,GT3,T,4,2,teacher,services,home,mother,2,2,0,no,yes,yes,yes,yes,yes,yes,no,5,3,3,1,1,1,0,11,10,10 | |
GP,M,16,R,GT3,T,4,3,services,other,reputation,mother,2,1,0,yes,yes,no,yes,no,yes,yes,no,3,3,3,1,1,4,2,11,15,15 | |
MS,F,18,U,GT3,T,3,3,other,other,home,mother,1,2,0,no,no,yes,no,yes,yes,yes,yes,4,1,3,1,2,1,0,15,15,15 | |
GP,F,17,U,GT3,T,4,2,other,other,reputation,mother,2, |
We can make this file beautiful and searchable if this error is corrected: It looks like row 9 should actually have 17 columns, instead of 8. in line 8.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
id,age,department,distance_from_home,education,employee_count,gender,job_role,job_satisfaction,marital_status,monthly_income,num_companies_worked,performance_rating,total_working_years,work_life_balance,years_at_company,years_since_last_promotion | |
1080,39,Research & Development,6,Bachelor,1,Female,Manufacturing Director,Medium,Single,8376,4,Excellent,9,Better,2,2 | |
436,33,Research & Development,15,Below College,1,Male,Manager,High,Married,13610,7,Excellent,15,Best,7,7 | |
1465,26,Sales,5,Bachelor,1,Female,Sales Representative,High,Single,2966,0,Excellent,5,Better,4,0 | |
748,38,Sales,3,Master,1,Male,Sales Executive,Very High,Single,6861,8,Excellent,19,Better,1,0 | |
407,52,Research & Development,3,Bachelor,1,Male,Manufacturing Director,High,Married,7969,2,Excellent,28,Better,5,0 | |
152,35,Sales,1,Doctor,1,Male,Sales Executive,Medium,Married,7295,1,Excellent,10,Better,10,0 | |
4,33,Research & Development,3,Master,1,Female,Research Scientist,High,Married,2909,1,Excellent,8,Better,8,3 | |
515,33,Research & Development,3,Bachelor,1,Male,R |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
id | age | |
---|---|---|
1117 | 55 | |
963 | 51 | |
426 | 50 | |
917 | 46 | |
937 | 45 | |
585 | 42 | |
800 | 42 | |
1097 | 40 | |
315 | 39 |
We can make this file beautiful and searchable if this error is corrected: It looks like row 2 should actually have 2 columns, instead of 1. in line 1.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
id;Geschlecht (0 == weiblich, 1 == männlich);Prätest;post_test;alter | |
1;1;13;17;22 | |
2;0;9;20;24 | |
3;1;8;12;19 | |
4;1;14;12;23 | |
5;0;16;18;28 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hour | year | Minuten | |
---|---|---|---|
21 | 2013 | 24 | |
22 | 2013 | 72 | |
11 | 2013 | 16 | |
12 | 2013 | 3 | |
1 | 2013 | 74 | |
11 | 2013 | 16 | |
11 | 2013 | 16 | |
20 | 2013 | 123 | |
22 | 2013 | 37 |
NewerOlder