How to connect RStudio to OneDrive Excel file? - r

Currently trying to connect to a OneDrive file that contains a spreadsheet. Trying to pull some IDs from the file. What packages might achieve this?
Can the DBI package connect to OneDrive?

AS suggested by #chthonicdaemon you could install OneDrive locally, sync the file and use it exactly as a local file.
But there are other options - the most obvious being:
https://cran.r-project.org/web/packages/Microsoft365R/vignettes/od_sp.html

Related

Can't upload xlsx library in Amazon Web Service (R)

I need to use the xlsx package in AWS but I have not been able to upload it. I have tried, as other posts suggested, installing the package with its dependencies, but didn't work. This is the error message that I get using AWS:
When I try to upload the library in my computer (without using AWS), I can upload the library without problem. Does anybody knows what could be happening? Thanks in advance!

Azure Databricks: How do we access R Scripts present on DBFS?

I'm new to DataBricks. I am trying to access a .R file that is present in the DBFS storage but I cannot figure out how to do so. Any help is really appreciated.
I can read data from the storage using the file path /dbfs and also source code from the script but I want to make edits to the script.
You need some editor to do that - for example, you can setup RStudio on your cluster and connect to it via RStudio UI - in this case you can edit R files directly on DBFS.
But really, the simplest for you would be to use Databricks CLI fs command to copy the file to your local machine, make changes in the editor of your choice, and upload file back.

open a OneDrive file with r

Im tring to create a shiny app that read and online onedrive xlsx file and show some things, but for the moment Im unable to read the onedrive xlsx file, I already explore the Microsoft365R and I can conect to my onedrive and I even can open the fil but... what it does is from r open a tab in chrome with the excel file.
I need the file in the local enviroment of r.. this its beacause the shiny app must be deploy in a web server, that every time the app runs it reads the update the file.
library(Microsfot365R)
odb <- get_business_onedrive()
odb$open_file("lcursos.xlsx")
Also this its a business account, so I also have to put the username and key to acces each file, that its beacause use the simple url doesnt work, it says Error 403 FORBIDEEN.
Any ideas?
Thank you so much!
Use the download_file() method to download the file to your local machine:
odb$download_file("lcursos.xlsx")
You can set the location of the download with the dest argument. Once it's downloaded, open it with the xls reader package of your choice. I suggest either openxlsx or readxl.
Note that if your file is password protected, your options are limited. See this question for possible solutions.

Is it possible to download software using R?

I am writing a user-friendly function to import Access tables using R. I have found that most of the steps will have to be done outside of R, but I want to keep most of this within the script if possible. The first step is to download a Database driver from microsoft: https://www.microsoft.com/en-US/download/details.aspx?id=13255.
I am wondering if it is possible to download software from inside R, and what function/package I can use? I have looked into download.file but this seems to be for downloading information files rather than software.
Edit: I have tried
install_url(https://download.microsoft.com/download/2/4/3/24375141-E08D-
4803-AB0E-10F2E3A07AAA/AccessDatabaseEngine_X64.exe)
But I get an error:
Downloading package from url: https://download.microsoft.com/download/2/4/3/24375141-E08D-4803-AB0E-10F2E3A07AAA/AccessDatabaseEngine_X64.exe
Installation failed: Don't know how to decompress files with extension exe

How to import a dataset from Dropbox?

I have an iPad Pro as my primary computer, and am running R Studio from a cloud server for a class. I am trying to figure out how to import data sets, since my local working directory is on the server. I have been trying to download the package repmis, since I have been reading that that package allows for data set import from Dropbox. However, when I try to download the package, I get "Error:configuration failed for openssl" and a similar one for curl. I tried to install openssl but instead it says I need to install "deb" for ubuntu operating systems, but I can't find that in R Studio in the package database. (And I can't install curl without openssl either) Any suggestions?
If it's a relatively straightforward data set like a CSV, XML, JSON or even an .RData file you can use a Dropbox sharing URL to read it. Here's an example (it's a live URL) for reading in a CSV directly from a shared Dropbox link:
read.csv("https://www.dropbox.com/s/7xg5u0z1gtjcuol/mtcars.csv?dl=1")
The dl=1 won't be the default from a "share this link" copy (it'll probably be dl=0.
urla<- 'https://www.dropbox.com/s/fakecode/xyz.txt?raw=1'
bpdata<-read.table(urla, header=TRUE)
scode<-'https://www.dropbox.com/s/lp6fleehcsb3wi9/protoBP.R?raw=1'
source(scode)
readAndPlotZoomForYear(urla, 2019)
Basically I wanted to source code from a file in Dropbox and to use the read.table() function on a tab delineated data file. I found this could be done by replacing the string after the question mark with raw=1 in the Dropbox file links.

Resources