Clears all R memory rm(list=ls())
In groups create a table with the following information: first name, last name, sex, country of birth, and city of birth data from your group as 5 different character vectors. Use the following names: first_name, last_name, sex, country_of_birth, city_of_birth.
First_name of my group - Create a character vector called first_name containing the names of your group.
first_name <- c("Claudia", "Maddie", "Lisa", "Adriana")
first_name
## [1] "Claudia" "Maddie" "Lisa" "Adriana"
Last_name of my group - Create character vector called last_name containing the last names of your group.
last_name <- c("Cuellar", "Lews", "Dwiananda", "Salazar")
last_name
## [1] "Cuellar" "Lews" "Dwiananda" "Salazar"
Age of my group - Create a vector called age containing the ages of your group.
age <- c(27,21,21,24)
age
## [1] 27 21 21 24
Height of my group - Create a vector called height containing the ages of your group.
height <- c(160,157, 150,156)
height
## [1] 160 157 150 156
Sex of my group - Create a character vector called sex containing the sex of your group.
sex <- c("Female", "Female","Female","Female")
sex
## [1] "Female" "Female" "Female" "Female"
City_of_birth of my group - Create a character vector called country_of_birth containing the ages of your group.
country_of_birth <- c("Mexico", "Wales", "Indonesia", "Mexico")
country_of_birth
## [1] "Mexico" "Wales" "Indonesia" "Mexico"
Country_of_birth of my group -Create a character vector called city_of_birth containing the TRUE/FALSE data you collected.
city_of_birth <- c("Mexico", "Cardiff", "Jakarta", "Mexico")
city_of_birth
## [1] "Mexico" "Cardiff" "Jakarta" "Mexico"
Played_cricket - Create a logical vector called played_cricket containing TRUE/FALSE from your group.
played_cricket <- c(FALSE, FALSE, FALSE, FALSE)
played_cricket
## [1] FALSE FALSE FALSE FALSE
table2 <- data.frame(first_name, last_name, age, height, sex,country_of_birth,city_of_birth,played_cricket)
table2
## first_name last_name age height sex country_of_birth city_of_birth
## 1 Claudia Cuellar 27 160 Female Mexico Mexico
## 2 Maddie Lews 21 157 Female Wales Cardiff
## 3 Lisa Dwiananda 21 150 Female Indonesia Jakarta
## 4 Adriana Salazar 24 156 Female Mexico Mexico
## played_cricket
## 1 FALSE
## 2 FALSE
## 3 FALSE
## 4 FALSE
Calculation of standard error with = sd(data) / sqrt(length(data))
std <- sd(height) / sqrt(length(height))
std
## [1] 2.096624
se <- function(height){
return(sd(height)/sqrt(length(height)))
}
standard_error <- se(table2$height)
standard_error
## [1] 2.096624
sa <- function(age){
return(sd(age)/sqrt(length(age)))
}
standard_errora <- sa(table2$age)
standard_errora
## [1] 1.436141