Question
R studio coding # Create a vector `students` holding 1,000 values representing students # They should have the values Student 1, Student 2,..., Student 1000
R studio coding
# Create a vector `students` holding 1,000 values representing students
# They should have the values "Student 1", "Student 2",..., "Student 1000"
# Create a vector `math_grades` that holds 1000 random values in it
# (these represent grades in a math course)
# These values should be normally distributed with a mean of 88 and a
# standard deviation of 10
# Replace any values in the `math_grades vector` that are above 100 with
# the number 100
# Create a vector `spanish_grades` that holds 1000 random values in it
# (these represent grades in a spanish course)
# These values should be normally distributed with a mean of 85 and a
# standard deviation of 12
# Replace any values in the `spanish_grades` that are above 100 with
# the number 100
# Create a data.frame variable `grades` by combining
# the vectors `students`, `math_grades`, and `spanish_grades`
# Make sure to properly handle strings
# Create a variable `num_students` that contains the
# number of rows in your dataframe `grades`
# Create a variable `num_courses` that contains the number of columns
# in your dataframe `grades` minus one (b/c of their names)
# Add a new column `grade_diff` to your dataframe, which is equal to
# `students$math_grades` minus `students$spanish_grades`
# Add another column `better_at_math` as a boolean (TRUE/FALSE) variable that
# indicates that a student got a better grade in math
# Create a variable `num_better_at_math` that is the number
# (i.e., one numeric value) of students better at math
# Write your `grades` dataframe to a new .csv file inside your data/ directory
# with the filename `grades.csv`. Make sure *not* to write row names.
# (you'll need to create the `data/` directory, which you can do outside of R)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started