簡體   English   中英

如何將此文本文件轉換為R data.frame

[英]How to convert this text file into R data.frame

這是文本文件

y <- read.table("https://afltables.com/afl/stats/biglists/bg2.txt", skip = 1, header = T, sep = ' ')
 Error in scan(file = file, what = what, sep = sep, quote = quote, dec = dec, : line 3 did not have 30 elements 

你可以試試看

y <- read.fwf("https://afltables.com/afl/stats/biglists/bg2.txt", skip = 3, widths=c(6, 9, 30, 2), col.names = c("Rank","Games","Player","Teams" ))

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM