Introducere în scrierea funcțiilor în R
Richie Cotton
Data Evangelist at DataCamp
Mean are 3 argumente
x: Un vector numeric sau de tip dată-oră.trim: Proporția de valori extreme eliminate de la fiecare capăt înainte de calculna.rm: Eliminare înainte de calculTransmitere argumente după poziție
mean(numbers, 0.1, TRUE)
Transmitere argumente după nume
mean(na.rm = TRUE, trim = 0.1, x = numbers)
Argumente uzuale după poziție, rare după nume
mean(numbers, trim = 0.1, na.rm = TRUE)
library(readr)
test_scores_geography_raw <- read_csv("test_scores_geography.csv")
library(dplyr)
test_scores_geography_clean <- test_scores_geography_raw %>%
select(person_id, first_name, last_name, test_date, score)
library(readr)
test_scores_geography_raw <- read_csv("test_scores_geography.csv")
library(dplyr)
test_scores_geography_clean <- test_scores_geography_raw %>%
select(person_id, first_name, last_name, test_date, score)
library(readr)
test_scores_geography_raw <- read_csv("test_scores_geography.csv")
library(dplyr)
test_scores_geography_clean <- test_scores_geography_raw %>%
select(person_id, first_name, last_name, test_date, score)
library(readr)
test_scores_geography_raw <- read_csv("test_scores_geography.csv")
library(dplyr)
test_scores_geography_clean <- test_scores_geography_raw %>%
select(person_id, first_name, last_name, test_date, score)
library(readr)
test_scores_geography_raw <- read_csv("test_scores_geography.csv")
library(dplyr)
test_scores_geography_clean <- test_scores_geography_raw %>%
select(person_id, first_name, last_name, test_date, score)
library(readr)
test_scores_geography_raw <- read_csv("test_scores_geography.csv")
library(dplyr)
test_scores_geography_clean <- test_scores_geography_raw %>%
select(person_id, first_name, last_name, test_date, score)
library(readr)
test_scores_english_raw <- read_csv("test_scores_english.csv")
library(dplyr)
test_scores_english_clean <- test_scores_english_raw %>%
select(person_id, first_name, last_name, test_date, score)
library(readr)
test_scores_art_raw <- read_csv("test_scores_art.csv")
library(dplyr)
test_scores_art_clean <- test_scores_art_raw %>%
select(person_id, first_name, last_name, test_date, score)
library(readr)
test_scores_spanish_raw <- read_csv("test_scores_spanish.csv")
library(dplyr)
test_scores_spanish_clean <- test_scores_spanish_raw %>%
select(person_id, first_name, last_name, test_date, score)
library(readr)
test_scores_geography_raw <- read_csv("test_scores_geography.csv")
library(dplyr)
library(lubridate)
test_scores_geography_clean <- test_scores_geography_raw %>%
select(person_id, first_name, last_name, test_date, score) %>%
mutate(test_date = mdy(test_date))
library(readr)
test_scores_english_raw <- read_csv("test_scores_english.csv")
library(dplyr)
library(lubridate)
test_scores_english_clean <- test_scores_english_raw %>%
select(person_id, first_name, last_name, test_date, score) %>%
mutate(test_date = mdy(test_date))
library(readr)
test_scores_art_raw <- read_csv("test_scores_art.csv")
library(dplyr)
library(lubridate)
test_scores_art_clean <- test_scores_art_raw %>%
select(person_id, first_name, last_name, test_date, score) %>%
mutate(test_date = mdy(test_date))
library(readr)
test_scores_spanish_raw <- read_csv("test_scores_spanish.csv")
library(dplyr)
library(lubridate)
test_scores_spanish_clean <- test_scores_spanish_raw %>%
select(person_id, first_name, last_name, test_date, score) %>%
mutate(test_date = mdy(test_date))
library(readr)
test_scores_geography_raw <- read_csv("test_scores_geography.csv")
library(dplyr)
library(lubridate)
test_scores_geography_clean <- test_scores_geography_raw %>%
select(person_id, first_name, last_name, test_date, score) %>%
mutate(test_date = mdy(test_date)) %>%
filter(!is.na(score))
library(readr)
test_scores_english_raw <- read_csv("test_scores_english.csv")
library(dplyr)
library(lubridate)
test_scores_english_clean <- test_scores_english_raw %>%
select(person_id, first_name, last_name, test_date, score) %>%
mutate(test_date = mdy(test_date)) %>%
filter(!is.na(score))
library(readr)
test_scores_art_raw <- read_csv("test_scores_art.csv")
library(dplyr)
library(lubridate)
test_scores_art_clean <- test_scores_art_raw %>%
select(person_id, first_name, last_name, test_date, score) %>%
mutate(test_date = mdy(test_date)) %>%
filter(is.na(score))
library(readr)
test_scores_spanish_raw <- read_csv("test_scores_spanish.csv")
library(dplyr)
library(lubridate)
test_scores_spanish_clean <- test_scores_spanish_raw %>%
select(person_id, first_name, last_name, test_date, score) %>%
mutate(test_date = mdy(test_date)) %>%
filter(!is.na(score))
Funcțiile elimină repetiția din cod, ceea ce
Funcțiile permit și reutilizarea și partajarea codului.
Introducere în scrierea funcțiilor în R