read.table 함수에 문제가 있습니다. URL에서 테이블을 읽고 데이터 프레임으로 R에 보관하고 싶습니다. https://datanalytics.com/uploads/datos_treemap.txtURL에서 테이블을 읽고 데이터 프레임으로 유지하십시오.
이 코드 썼다 : URL은
library(RCurl)
a <- getURL('https://datanalytics.com/uploads/datos_treemap.txt')
b = read.table(a, sep="\t ", header = TRUE, nrows=3)
download.file("https://datanalytics.com/uploads/datos_treemap.txt","/mnt/M/Ana/R/datos_treemap.txt",method = c("wget"))
을하지만이 dataframe으로 데이터를 보존 할 수 없으며 다음과 같은 오류가 발생합니다
Error in file(file, "rt") : cannot open the connection
In addition: Warning message:
In file(file, "rt") : cannot open file...
No such file or directory
나는 또한 문서를 txt로 다운로드하고 mi PC에 보관하려고 시도했다. 그러나 txt를 생성하면 테이블 대신 벡터가 생성됩니다 (모든 결과가 하나의 유니 코드 행에 있음). 내가 작성한 코드는 다음과 같습니다.
내가 뭘 잘못하고 있는지 아는 사람이 있습니까? 미리 감사드립니다.
잘 작동합니다. 정말 고마워요! –
도움이 된 것을 기쁘게 생각합니다! – Prem