Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

The Basics of R

Total questions: 21

Worksheet time: 8mins

Name
Class
Date
1.

What is this an icon of?

a)

slack.png

b)

R Project

c)

R engine

d)

R Studio

2.

What extension will an R script have?

a)

.Rscript

b)

.R

c)

.Rproj

d)

.Rmd

3.
Which key autocompletes the existing object or function name when you start typing in R?
a)
"->"
b)
Shift
c)
Tab
d)
Escape
4.
Which of the following is an absolute local path?
a)
C:/users/me/Desktop/DigitalMethods/data/SAFI_clean.csv
b)
data/SAFI_clean.csv
c)
https://ndownloader.figshare.com/files/11492171
d)
here/SAFI_clean.csv
5.

Which command below will create a new object called interviews?

a)

interviews <- c(1,2,3)

b)

interviews[interviews =="yes"]

c)

create.dir(interviews)

d)

interviews <- NULL

6.

What does .Rproj extension denote?

a)

It is the file extension for Rmarkdown document.

b)

It designates an R working directory for R session and makes starting new research projects in R easier.

c)

It is a file that needs to be active for R to work.

d)

It is the file extension for R script.

7.
What does getwd() do in R?
a)
Displays the path to your current working directory
b)
Lists the contents of the current directory
c)
Sets the working space to the current directory
d)
Sets the path to the current directory
8.

What is the data type of the 'interviews' object: interviews <- c(1, "a", TRUE, "TRUE")

a)

Logical

b)

Numeric

c)

Character

d)

Complex

9.
What will the following command rooms[!is.na(rooms)] do?
a)
Eliminate all missing values from the rooms object
b)
Extract and display those elements of rooms which contain missing values
c)
Create a new rooms object without missing values
d)
Display those elements of rooms object which are not missing values (NAs).
10.

Which of the following are good names for your digital objects in R?

a)

My_beautiful_object

b)

My.beautiful.object

c)

My beautiful object

d)

My#Beautif$lobj8ct

e)

MyBeautifulObject

11.

How will R interpret the following statement? 'round()'

a)

As a Subset of an Object called 'round'

b)

As a Vector

c)

As a Function

d)

As a "Plot a Circle" command

12.

How do you install the tidyverse package in R?

a)

install.packages(tidyverse)

b)

install.tidyverse()

c)

library(tidyverse)

d)

install.packages("tidyverse")

13.

What does the following code do: read_csv("data/SAFI_clean.csv")

a)

Creates SAFI_clean.csv spreadsheet in the data folder

b)

Loads SAFI_clean.csv to R Studio with ephemeral output in the console

c)

Deletes the SAFI_clean.csv in the data folder

d)

Creates a new object called SAFI_clean in R Studio environment

14.

If I execute the expression x <- 4 in R, what will be the output of running `class(x)' ?

a)

numeric

b)

-4

c)

"4"

d)

4

15.

What is the class of the object defined by x <- c(4, TRUE)?

a)

numeric

b)

logical

c)

integer

d)

a vector containing values "4", "TRUE"

16.
If I have two vectors x <- c(1,3, 5) and y <- c(3, 2, 10), what is produced by the expression c(x, y)?
a)
a 3 by 2 numeric matrix
b)
a vector with three elements, containing the numbers 4,5,15
c)
a vector with six elements containing the numbers 1,3,5,3,2,10
d)
a vector with two elements 9, 15
17.
A key property of vectors in R is that
a)
elements of a vector all must be of the same class
b)
vectors can be two-dimensional
c)
each element can be of different class
d)
vectors can contain both logical and either numeric or character values
18.

Suppose I have a vector x <- 1:4 and a vector y <- 2. What is produced by the expression x * y?

a)

a numeric vector with elements 3, 4, 5, 6.

b)

a numeric vector with elements 1,4,2

c)

a numeric vector with elements 1,2,3,4,2

d)

a numeric vector with elements 2, 4, 6, 8.

19.
Suppose you have a vector x <- 1:4 and a vector y <- 2:3. What is produced by the expression x+y ?
a)
3,5,5,7
b)
1,2,3,4,2,3
c)
1,4,2,3
d)
2,8,3,12
20.
If an incomplete command is executed, R console will show the following prompt:
a)
>
b)
+
c)
-
d)
$
21.

What is this an icon of?

a)

slack.png

b)

R Project

c)

R engine

d)

R Studio