R

A vibrant illustration depicting R programming concepts, including coding snippets, graphs, and data visualization elements, set against a tech-inspired background.

R Programming Knowledge Quiz

Test your knowledge of R programming and data analysis with this engaging quiz! Covering a range of topics from calculation methods to dataset exploration, this quiz is perfect for those looking to enhance their skills.

  • Multiple choice questions
  • Explore datasets
  • Understand R functions
  • Apply mathematical concepts
10 Questions2 MinutesCreated by CodingGuru2023
Define n = 1000, compute the sum 1 through 1000 using n(n+1)/2 .
505500
550000
500500
505050
n <- 1000
x <- seq(1,n)
sum(x)
Based on the result,what do you think the functions seq and sum do? You can use the help system.

Sum creates a list of numbers and seq adds them up.
Seq creates a list of numbers and sum adds them up.
Seq computes the difference between two arguments and sum computes the sum of 1 through 1000.
Sum always returns the same number

To find the solutions to an equation of the format ax2+bx+c, use the quadratic equation: x=(b±b24ac)/2a.

1.686141 & -1.186141
1.699865 & - 1.203564
1.247893 & -0.987456
1.897563 & -1.250698
The movielens dataset in the dslabs package includes data on a variety of movies and their rating by a particular user. Load the movielens dataset: library(dslabs) data(movielens) Begin your exploration of this dataset by looking at the structure of the dataset and variable types.
 
How many rows are in the dataset?
 
 
100004
100098
102654
131216
How many different variables are in the dataset?
7
9
8
5.5

We already know we can use the levels() function to determine the levels of a factor. A different function, nlevels(), may be used to determine the number of levels of a factor.

901
969
895
756

Mandi, Amy, Nicole, and Olivia all ran different distances in different time intervals. Their distances (in
miles) and times (in minutes) are as follows:

name <- c("Mandi", "Amy", "Nicole", "Olivia")
distance <- c(0.8, 3.1, 2.8, 4.0)
time <- c(10, 30, 40, 50)

Write a line of code to convert time to hours. Remember there are 60 minutes in an hour. Then write a line of code to calculate the speed of each runner in miles per hour. Speed is distance divided by time.

Report 3 significant digits.

0.833
1.25
2.36
0.569
What was Mandi's speed in miles per hour?
4.8
6.85
3.7
5.5
With the Murders Dataframe
 
Compute the per 100,000 murder rate for each state and store it in an object called murder_rate.Then use the logical operators to create a logical vector, name it low, that tells us which entries of murder_rate are lower than 1.
what is the sum for the variable low?
 
 
12
11.25
65
8
%in% If rather than an index we want a logical that tells us whether or not each element of a first vector is in a second, we can use the function %in%. For example: x <- c(2, 3, 5) y <- c(1, 2, 3, 4) x%in%y Gives us two TRUE followed by a FALSE because 2 and 3 are in y but 5 is not.
 
Which of the following is not an actual abbreviation: MA, ME, MI, MO, MU?
 
Hint:
  • Define a character vector with the abbreviations MA, ME, MI, MO, MU.
  • Use the %in% operator to create a logical vector that is TRUE when the abbreviation is in murders$abb
MU
MO
MI
ME
MA
{"name":"R", "url":"https://www.quiz-maker.com/QPREVIEW","txt":"Test your knowledge of R programming and data analysis with this engaging quiz! Covering a range of topics from calculation methods to dataset exploration, this quiz is perfect for those looking to enhance their skills.Multiple choice questionsExplore datasetsUnderstand R functionsApply mathematical concepts","img":"https:/images/course1.png"}
Powered by: Quiz Maker