Question: = = = = = = = = = = = = = = = = = = = = = = = = =
# Task
# copy original dataframe into a new one: mymtcars
# mtcars object is one of many builtin data sets in R So you do not need to worry about creating mtcars.
mymtcars mtcars
# : investigate mymtcars using str function. How many variables and observations are included in this dataframe?
# : calculate engine displacement per cylinder and save it as a new variable 'UnitEngine' in the dataframe. Populate the two XXXX below
myCars$XXXX myCars$XXXXmyCars$cyl
# summarize the new variable 'UnitEngine': use summary function
#
# Task
# create a numeric vector 'Pets' with this numbers
# create a numeric vector 'Order' with these numbers
# create a numeric vector 'Siblings'
Siblings c
# create a numeric vector 'IDs'
IDs c
# Combine those four numeric vectors together into a dataframe called 'myFriends'. You must use data.frame function
# report the structure of the dataframe
# summarize the dataframe. Use summary function
# list or print all of the values for 'IDs' variable in the dataframe
myFriends$IDs
# list all of the values for 'Pets' variable in the dataframe
# list all of the values for 'Order' variable in the dataframe
# list all of the values for 'Siblings' variable in the dataframe
myFriends$Siblings
# # write a code to print the values in the fifth observation of the Pets variable
## add a vector called 'age' to 'myFriends' using cbind function. YOU MUST USE cbind FUNCTION to receive full grades.
age c
## define a vector called 'names' by including all the names in a vector. Add a vector 'names' to 'myFriends' using cbind function. Print the structure of 'myFriends'. What is the data type among: factor, numeric, logical string of the 'names'?
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
