-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test new fun to open dictionary in excel
- Loading branch information
1 parent
3a3fab5
commit 14a9f8a
Showing
1 changed file
with
20 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
|
||
download_and_open_excel <- function(url) { | ||
# Extract the file name from the URL | ||
destfile <- basename(url) | ||
|
||
# Download the file | ||
download.file(url, destfile, mode = "wb") # Use mode = "wb" for binary files like Excel | ||
|
||
# Open the file based on the operating system | ||
if (.Platform$OS.type == "windows") { | ||
# For Windows | ||
shell.exec(destfile) | ||
} else if (Sys.info()["sysname"] == "Darwin") { | ||
# For macOS | ||
system(paste("open", shQuote(destfile))) | ||
} else { | ||
# For Unix/Linux | ||
system(paste("xdg-open", shQuote(destfile))) | ||
} | ||
} |