Reading data from the web
Welcome to Helsinki Open Data Science: Regression and Model validation.
The first step of data analysis with R is reading data into R. This is done with a function. Which function and function arguments to use to do this, depends on the original format of the data.
Conveniently in R, the same functions for reading data can usually be used weather the data is saved locally on your computer or is located behind a web URL.
After the correct function has been identified and data read into R, the data will usually be in R's data.frame
format. A data frame's dimensions are (\(n\),\(d\)), where \(n\) is the number of rows (the observations) and \(d\) the number of columns (the variables).
This exercise is part of the course
Helsinki Open Data Science
Exercise instructions
- Read the
lrn14
data frame to memory withread.table()
. There is information related to the data here - Use
dim()
on the data frame to look at the dimensions of the data. How many rows and colums does the data have? - Look at the structure of the data with
str()
.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# read the data into memory
lrn14 <- read.table("http://www.helsinki.fi/~kvehkala/JYTmooc/JYTOPKYS3-data.txt", sep="\t", header=TRUE)
# Look at the dimensions of the data
# Look at the structure of the data