need help to open a file in system directory like pdf file in
path ="c:\\abc\\xyz.pdf" with system default pdf viewer
Or to open image in folder using system default photo viewer
already try system('"E:\\pdf_ka_zakhera\\9780387981406-c1.pdf"') in R
Try this:
shell("E:\\pdf_ka_zakhera\\9780387981406-c1.pdf")
From "shell" help page:
To make use of Windows file associations, use shell.exec
Related
mission on online course:
Download this RData file to your working directory. Then load the data into R with the following command:
load("skew.RData")
so I have downloaded it to my computer but where is my working directory? or how do I load the downloaded file to Rstudio
You can see your working directory by executing getwd().
In order to load the data you need to change it to the folder path where the data is stored.
setwd("C:/your/path")
load("skew.RData")
You can set you working directory in RStudio on the right side manually and then save the files there and open them like :
load("skew.RData")
If your file is saved somewhere else, you should define the path to it:
load("path/to/your/file/skew.RData")
I'm using R Studio Server. When I try to upload a file from my desktop, I'm getting
Error: 'path' does not exist: 'data/sweets.xlsx'
This is the code I'm using to upload my file
sweetsimport <- readxl::read_xlsx('data/sweets.xlsx')
How do I fix this issue?
That path is not a path to your desktop. Assuming you are on a Mac and 'data' is a folder in your desktop with 'sweets.xlsx' directly inside of it, the correct path would be ~/Desktop/data/sweets.xlsx. Another way to get an absolute path on a Mac is to click a file and press option-command-c to copy the pathname.
I am new to Sage & I wish to load a .sage file from a Sage Notebook worksheet.
I am on OSX 10.9.5.
If I evaluate
load (example.sage)
I get
IOError: did not find file 'example.sage' to load or attach
The example file is on my Desktop.
Do I need to explicitly state the full file path?
If so how?
Thx.
There are two ways to load that file located on your desktop.
One way is using ~ to denote your home directory:
load('~/Desktop/example.sage')
The other one is to use the full path:
load('/Users/username/Desktop/example.sage')
(replacing username by your actual username).
On a mac using iCloud file optimization, large files that are seldom used are uploaded to iCloud and only a small pointer file is left. When I look for the file in Finder, I see the file name and to the left is an icon that indicates that the file is in the cloud. To access the file, I click on the icon and the file is downloaded. With the file.exist command, R returns FALSE for the existence of the file. But after some research I found that the file link is stored in a directory below ~/Library/Mobile\ Documents/com~apple~CloudDocsand the file name is changed to xxx.icloud where xxx is the original file name.
Here's an example of the path to a a directory that holds a .icloud file from a shell in my mac
/Users/gcn/Library/Mobile Documents/com~apple~CloudDocs/Documents/workspace/nutmod/data-raw/NutrientData
I can query for the existence of the file with exists(xxx.icloud). But how do I tell my mac to download the iCloud file and then read it in? Using something like read.table or read.csv doesn't work because the pointer file is not csv.
You can read a csv file directly from a iCloud folder on the Mac by using the path to that folder. Get the path by finding it in the finder. Then right click on the filename at the bottom of the finder window where it shows all the folders leading to the file and choose: Copy "YourFile" as Pathname.
That path will look something like this:
"/Users/NAME/Library/Mobile
Documents/com~apple~CloudDoc/Docs/YourFile.csv"
Use that in your read code:
iCloudDat <- read_csv("/Users/NAME/Library/Mobile Documents/com~apple~CloudDocs/Documents/YourFileName.csv")
That should work.
If the extension isn't .txt or .csv read.table and read.csv won't work.
you have to download the file and extract the tables to a readable format.
you can download the file using download.file() which is is the utils basic library.
I want to upload an image file using an AutoIt script:
WinWaitActive("Open")
Send("D:\sprint8execution\gGastro-mvn\tmp.png")
Send("{ENTER}")
How to give the system-defined path in the script so that if the script runs on any other machine it goes to applicable directory and fetches the image from there?
Have a look to the AutoIt macros. #ScriptDir is the directory that includes the current running script.