Importing CSV and Delimited Data

Want to learn more? I recommend working through: R for Data Science, R Cookbook, and R Graphics Cookbook.

Original source: Learning R

Note: This tutorial won't work until you change the URL to the CSV and remove the comment tags.

# Flat Files Offline
# testdata <- read.table("d:/data/mydata.dat", header=TRUE) # valid
## Read.csv is like read.table but the default seperator and adds a header
# Flat File Online
# testdata2 <- read.table(" MyData.csv", header=TRUE, sep=",")
# Specify . As Denoting A Missing Value
# testdata <- read.table("mydata.csv", header=TRUE, sep=",", na.strings=".")