Data on the web

# Load the readr package

library(readr)

# Import the csv file: pools

url_csv <- "http://s3.amazonaws.com/assets.datacamp.com/production/course_1478/datasets/swimming_pools.csv"

pools<-read_csv(url_csv)

# Import the txt file: potatoes

url_delim <- "http://s3.amazonaws.com/assets.datacamp.com/production/course_1478/datasets/potatoes.txt"

potatoes<-read_tsv(url_delim)

# Print pools and potatoes

pools

potatoes


# Load the readxl and gdata package

library(readxl)

library(gdata)

# Specification of url: url_xls

url_xls <- "http://s3.amazonaws.com/assets.datacamp.com/production/course_1478/datasets/latitude.xls"

# Import the .xls file with gdata: excel_gdata

excel_gdata<-read.xls(url_xls)

# Download file behind URL, name it local_latitude.xls

download.file(url_xls,destfile="local_latitude.xls")

# Import the local .xls file with readxl: excel_readxl

excel_readxl<-read_excel("local_latitude.xls")


# https URL to the wine RData file.

url_rdata <- "https://s3.amazonaws.com/assets.datacamp.com/production/course_1478/datasets/wine.RData"

# Download the wine file to your working directory

download.file(url_rdata,"wine_local.RData")

# Load the wine data into your workspace using load()

load("wine_local.RData")

# Print out the summary of the wine data

summary(wine)


# Load the httr package

library(httr)

# Get the url, save response to resp

url <- "http://www.example.com/"

resp<-GET(url)

# Print resp

resp

# Get the raw content of resp: raw_content

raw_content<-content(resp,as="raw")

# Print the head of raw_content

head(raw_content)

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • In the simplest setting,fromJSON()can convert character s...
    腾子_Lony阅读 203评论 0 0
  • 关于沟通,我个人的问题在于——容易紧张。 一直尝试做到“润物细无声”的境界,一直在思考、摸索、练习中…… 人生真是...
    子元1314阅读 646评论 3 2
  • 我叫夏璃沫,2013年8月,犹记得那是个清爽的月份,我刚转来这个学校才半学期,并不认识很多人,但由于学习不错,各班...
    匕菏夜阅读 167评论 0 0
  • 从上一家公司离职距现在已快一年了,记忆最深刻的莫过于每天的早会。 不同的部门,不同的人,汇报工作的方式有的都是大同...
    豆瓣绿儿阅读 424评论 5 18