Scraping a csv file - r

I'm trying to save a two csv files that can be accessed through this website:
https://www.cenace.gob.mx/Paginas/SIM/Reportes/CapacidadTransferencia.aspx
I only want to save both csv files as data frames in RStudio. I've tried to do this through rvest, but it seems that the data is in the website's back end and this approach is not working.

Related

Load CSV dataset into R directly from Kaggle

I need to load a CSV dataset directly to R from Kaggle without pre-downloading the CSV file. I found the solution how to unzip a csv file using GET() function from httr package, but for that I need the URL of the download. On Kaggle I can see only the Download button link '.../download', without the exact address to the zipped csv file. Is there any way to get the link to the zipped csv file on Kaggle?
I also found the kaggler package, but it seems working only for my own datasets that are under my account. While I would like to load into R datasets uploaded by other Kaggle users. Is there any way to do it in R?
Here is an example of Kaggle dataset. I would need to load the Placement_Data_Full_Class.csv directly into R.

Writing a csv file that is too large R

I currently saved some data as a csv file on my computer. It has 581 rows, but when I try to open the saved file on my mac, the dataframe has been altered and the numbers app from which I am looking at my csv from says some data was deleted. Is there a way to fix this? Or is there a different type of file I can save my data as that would adjust for the number of rows?
This is how I am writing the csv. I'm trying to manually add my file to a github repo after it has been saved to my computer.
write.csv(coords, 'Top_50_Distances.csv', row.names = FALSE)

Exporting CSV from R, not being read by program until saved by excel

I'm exporting CSV files from R, using write.csv
I've also tried various encoding options.
The CSV files open fine and read manually.
However, I need to process these files in another program (METAL https://genome.sph.umich.edu/wiki/METAL) and the program is pretty much unable to recognize the text in the files.
But, when I open the CSV files in excel, and save them again manually with excel-- same name, same place, same encoding, without changing anything except clicking save as CSV, then METAL is able to recognize the text in the CSV files.
I was wondering if anyone has any suggestions how to fix this? It's very cumbersome to go in each file and have to re-save manually.

Loading an existing .RData file into an R program

I have a .RData file. I want to do some operations on the dataframe that this file contains. Can I load this file on my R program and convert it into a dataframe? The only option I know currently is to convert the ..RData file to a csv and convert that csv into a data frame again. I am looking for a neater solution. I got this file from a friend of mine and I cannot produce the dataframe from scratch.

How do you save an Excel file with multiple sheets as an RDS file for use in R?

I am currently running an R function that uses XLConnect to scan a very large Excel file of many sheets, and I'm repeating this function 500 times. It currently can take up to 20 minutes to run it, and I was told that I need to save it as an RDS to speed things up. I'm an R beginner so what is an RDS, how do I save an Excel file as it, and once I do save it as an RDS, will I still be able to refer to the different sheets within the Excel file, or will I have to save each sheet as an RDS individually?
At the prompt line of a running session of R type this:
?saveRDS
The questions about saving an Excel file and referring to different sheets have been answered many times in SO. You need to make some effort to look things up before posting multi-part questions.

Resources