R quick quiz

Find out whether you need a really, really basic R course or if you're okay to do some data processing already.

published on April 21, 20163 responses 0

> df = data.frame(a=c(1,2,3),b=c(4,5,6))

Which two commands give you the number 4?

Select the two correct answers
> df[1,2]
> df$b[1]
> df[2,1]
> df[2:1]
> df[1:2]

By default, what will happen when a column containing mostly numbers but some text is read by read.table() ?

The text will get replaced by zeroes
The text will get replaced by NA()
The column will be a factor
The column is illegal and will be removed

What does this mean?
1:10

A numeric vector containing the numbers 1 to 10
A numeric vector containing the numbers 1 and 10
An integer vector containing the numbers 1 to 10
An integer vector containing the numbers 1 and 10

A true/false value in R is held in which data-type?

logical
illogical
binary
raw

You're not sure if a function "furbies" is available... which of the following would tell you for sure?

> ?furbies
> exists("furbies")
> furbies
[all of these]

Which of the following does NOT assign the value "foo" to the variable f?

> f <- "foo"
> "foo" -> f
> f = "foo"
> f <= "foo"

The following code creates what?

> c(a=c(1,2),b=c(3,4))

A data.frame with 2 rows and 2 columns
A numeric vector with named values
A factor vector
A list

Which of the following is NOT an R data type?

logical
complex
raw
factor

What is R?

R is a free software environment for statistical computing and graphics
R is a family of operating systems for x86-based computers
R is an esoteric programming language created in 1993 by Urban Müller, and notable for its extreme minimalism
R is an integrated family of products that helps to address the entire analytical process, from planning and data collection to analysis, reporting and deployment.

Which of the following does not contain numbers?

numeric
integer
raw
character

If you wanted to install R, where would you download it from?

r-project.org
cpan.org
rstudio.com
cran.org

Which of the following is NOT an R data structure?

factor
array
list
character

Which of the following do you use to load a package in R?

> install.packages()
> load()
> library()
> source()

What is a matrix?

A data structure with the same number of rows and columns
A data structure with columns of equal length that can contain different data types from each other
A data structure with columns of equal length that must all contain the same data type
A vector of list objects

Which of the following does NOT call a function?

> ?help
> ??help
> help
> help()

What is a data.frame?

A data structure with the same number of rows and columns
A data structure with columns of equal length that can contain different data types from each other
A data structure with columns of equal length that must all contain the same data type
A vector of list objects

read.delim() gives you what?

vector
data.frame
factor
character

Which of the following would you use to read a table in a file called "table.csv"?

> read.table.csv()
> read.csv("table.csv")
> "table.csv"
> table.csv()

How many data types are there in R?

1
3
6
9

You're confused about data.frames. Which of the following does not help?

> ?base
> ?data.frame
> library(help="data.frame")
> library(help="base")