[英]How to load a CSV txt file into R correctly
我是R的新手,遇到了一些簡單的麻煩。 我以為我了解read.table()函數,但顯然不明白。 我正在嘗試將“ http://www.stat.berkeley.edu/users/nolan/data/bikeshare.txt ”加載到RStudio中,無論出於何種原因,它只會再次顯示文本文件。 我的命令是:
read.table("http://www.stat.berkeley.edu/users/nolan/data/bikeshare.txt",
sep=",",
header=True)
任何幫助深表感謝。
謝謝。
這是一個例子:
URL <- "http://www.stat.berkeley.edu/users/nolan/data/bikeshare.txt"
bikeshare <- read.table(URL, sep=",", header=TRUE)
head(bikeshare)
> URL <- "http://www.stat.berkeley.edu/users/nolan/data/bikeshare.txt"
> bikeshare <- read.table(URL, sep=",", header=TRUE)
> head(bikeshare)
instant dteday season yr mnth hr holiday weekday workingday weathersit temp atemp hum windspeed casual registered cnt
1 1 2011-01-01 1 0 1 0 0 6 0 1 0.24 0.2879 0.81 0.0000 3 13 16
2 2 2011-01-01 1 0 1 1 0 6 0 1 0.22 0.2727 0.80 0.0000 8 32 40
3 3 2011-01-01 1 0 1 2 0 6 0 1 0.22 0.2727 0.80 0.0000 5 27 32
4 4 2011-01-01 1 0 1 3 0 6 0 1 0.24 0.2879 0.75 0.0000 3 10 13
5 5 2011-01-01 1 0 1 4 0 6 0 1 0.24 0.2879 0.75 0.0000 0 1 1
6 6 2011-01-01 1 0 1 5 0 6 0 2 0.24 0.2576 0.75 0.0896 0 1 1
如果您想了解有關R的更多信息,我建議您使用以下免費資源。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.