Jump to content

R (programming language)/Tutorials/Loading data

From Wikiversity

This tutorial demonstrates how to load data in R.

Direct loading

[edit | edit source]
  • Given the data file data.txt located at <path>:
1970    45    78
1980    52    95
1990    59    25
2000    63    34
  • This data can easily be loaded into R using the following commands:
setwd("<path>")                # change working directory
data <- read.table("data.txt")  # load data

Loading csv

[edit | edit source]