I have problems with the function read.table. I want to read a table from an url, and keep it in R as a dataframe. The url is: https://datanalytics.com/uploads/datos_treemap.txt
I have wrote this code:
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"))
But I can't keep the data as a dataframe, and it results in the following error:
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
I have also tried to download the document as a txt, and keep it in mi PC. But the generate txt results in a vector instead of a table (all the results are in one unic row). The code I have wrote is:
download.file("https://datanalytics.com/uploads/datos_treemap.txt","/mnt/M/Ana/R/datos_treemap.txt",method = c("wget"))
What am I doing wrong?