#############################
# PSYC 70510 - Statistical Methods in Psych Lab I
# Week 1 - Group work
# Lab Instructor: Kaile Smith
#
# Name(s):
# Date:
#############################


# Work through the questions in order.
# Keep the Week 1 lesson open so you can return to the worked examples.
# Write your code beneath each question, then run it from this script.


### 1. Check the Project location

# Print your current working directory in the Console.
# Confirm that it points to your PSYC-70510 Project folder.




### 2. Import and print mtcars

# Import mtcars.csv from the Project's data folder.
# Use a Project-relative filepath.
# Assign the imported data frame to an object named cars.
# Print the entire cars object in the Console.




### 3. Inspect the data frame

# Print the column names.
# Inspect the number of rows and columns and the structure of the data frame.
# Return the type of every column.




### 4. Describe mpg three ways

# Calculate the mean of mpg by selecting the column with $.



# Calculate the median of mpg by selecting the column by numeric position.



# Calculate the standard deviation of mpg by selecting the column by name
# inside square brackets.




### 5. Select the first 10 disp values

# Select the first 10 rows of the disp column, then calculate their mean.




### 6. Select the odd-numbered wt values

# Create a vector containing all odd-numbered row positions in the data frame.
# Use that vector to select wt, then calculate the mean.




### 7. Keep six columns in a new object

# Create a character vector containing these column names in this order:
# X, cyl, hp, wt, gear, mpg



# Use the vector to select the six columns from cars.
# Save the result as selected_cars.



# Print the column names of selected_cars to check their order.




### 8. Challenge: calculate all numeric-column means

# Remove the character column X from selected_cars.
# Save the five numeric columns as numeric_cars.



# Use one sapply() call to calculate the mean of every column in numeric_cars.




### Before you finish

# Compare your code with another group member's script.
# Be ready to show the line you found most difficult and the output or error
# that helped you understand it.
