Assessment questions: Loading data into R

Sep 2, 2013 • Emily Davenport

I’m sticking with the topic I chose for the concept map, which was how to load data into R.

Beginner from intermediate question:

1. Say you had data in excel that you wished to do some statistical tests on in R. You save your data (which consisted of 5 rows and 10 columns) as a .csv file in excel and then open it with the following command in R:
imported_data <- read.table(file = "my_excel_data.csv", sep=",", header=TRUE)
What data type is the variable "imported_data"?
A. matrix
B. dataframe
C. array
D. vector

Intermediate from advanced question:

2. Your collaborators gave you a table of data to analyze, but it is messy. The data consists of one column of ID numbers and then many columns of readings from an instrument (all numeric data). There are missing values, uneven numbers of observations (uneven row lengths), and their ID numbers for each sample contain a "#". What command will read in the data properly?
A. imported_data <- read.table(file = "collaborators_hot_mess_data.csv", sep="t", header=TRUE, dec=".", fill=TRUE, comment.char="#")
B. imported_data <- read.table(file = "collaborators_hot_mess_data.csv", sep=",", header=TRUE, dec=".", fill=TRUE, comment.char="#")
C. imported_data <- read.table(file = "collaborators_hot_mess_data.csv", sep="t", header=TRUE, dec=".", fill=FALSE, comment.char="#")
D. imported_data <- read.table(file = "collaborators_hot_mess_data.csv", sep=",", header=TRUE, dec=".", fill=FALSE, comment.char="$")
E. imported_data <- read.table(file = "collaborators_hot_mess_data.csv", sep=",", header=TRUE, dec=".", fill=TRUE, comment.char="$")
F. imported_data <- read.table(file = "collaborators_hot_mess_data.csv", sep="t", header=TRUE, dec=".", fill=FALSE, comment.char="$")