Publications by Alexis Marcolini

Publish Document

06.12.2023

Import your data data <- read_excel("../00_data/MyData.xlsx") %>% mutate(rev_men = as.numeric(rev_men)) ## Warning: There was 1 warning in `mutate()`. ## ℹ In argument: `rev_men = as.numeric(rev_men)`. ## Caused by warning: ## ! NAs introduced by coercion data <- as_tibble(data) data("mtcars") mtcars <- as_tibble(mtcars) Repeat the sa...

370 sym 2 img

Publish Document

06.12.2023

Import your data data(flights) flights %>% skimr::skim() Data summary Name Piped data Number of rows 336776 Number of columns 19 _______________________ Column type frequency: character 4 numeric 14 POSIXct 1 ________________________ Group variables None Variable type: character skim_variable n_missing complete_rate min max empty n_u...

644 sym 7 tbl

Publish Document

01.12.2023

Import your data data("mtcars") Repeat the same operation over different columns of a data frame Case of numeric variables Create your own function Repeat the same operation over different elements of a list When you have a grouping variable (factor) Create your own Choose either one of the two cases above and apply it to your data...

333 sym

Publish Document

29.11.2023

Ch20 Vectors Introduction Vector basics Important types of automatic vector Using atomic vectors sample(10) + 10 ## [1] 13 17 14 15 16 11 12 19 20 18 1:10 + 1:2 ## [1] 2 4 4 6 6 8 8 10 10 12 1:10 + 1:3 ## Warning in 1:10 + 1:3: longer object length is not a multiple of shorter object ## length ## [1] 2 4 6 5 7 9 8 10 12 11 dat...

330 sym Python (2364 sym/54 pcs)

Publish Document

20.11.2023

Import your data data <- read_excel("../00_data/MyData.xlsx") Chapter 15 Create a factor Modify factor order Make two bar charts here - one before ordering another after # Transform data: calculate average male athletes by state State_cd_by_ef_male_count <- data %>% group_by(state_cd) %>% summarise( avg_ef_male_count = mea...

292 sym 3 img

Publish Document

20.11.2023

Import your data data(flights) flights %>% skimr::skim() Data summary Name Piped data Number of rows 336776 Number of columns 19 _______________________ Column type frequency: character 4 numeric 14 POSIXct 1 ________________________ Group variables None Variable type: character skim_variable n_missing complete_rate min max empty n_u...

644 sym 7 tbl

Publish Document

17.11.2023

Import your data data(flights) flights %>% skimr::skim() Data summary Name Piped data Number of rows 336776 Number of columns 19 _______________________ Column type frequency: character 4 numeric 14 POSIXct 1 ________________________ Group variables None Variable type: character skim_variable n_missing complete_rate min max empty n_u...

512 sym 4 tbl

Publish Document

15.11.2023

Introduction When should you write a function? df <- tibble::tibble( a = rnorm(10), b = rnorm(10), c = rnorm(10), d = rnorm(10) ) # Rescale each column df$a <- (df$a - min(df$a, na.rm = TRUE)) / (max(df$a, na.rm = TRUE) - min(df$a, na.rm = TRUE)) df$b <- (df$b - min(df$b, na.rm = TRUE)) / (max(df$b, na.rm = TRUE) - min(df$b...

292 sym

Publish Document

11.11.2023

Import your data # excel file data <- read_excel("../00_data/MyData.xlsx") %>% rename(X = institution_name) stressors <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2022/2022-01-11/stressor.csv') ## Rows: 7332 Columns: 5 ## ── Column specification ──────────────...

472 sym 3 tbl

Publish Document

10.11.2023

Chapter 15 Factors Creating factors General social survey gss_cat ## # A tibble: 21,483 × 9 ## year marital age race rincome partyid relig denom tvhours ## <int> <fct> <int> <fct> <fct> <fct> <fct> <fct> <int> ## 1 2000 Never married 26 White $8000 to 9999 Ind,near … Prot… Sout… ...

457 sym 4 img