vconfused101
vconfused101

Reputation: 75

setwd in R - mapped drive?

Sorry I am very new to this, so am confused. I am working on a project that requires me to analyze data that is on a shared drive. I cannot make a copy of the dataset. How do I load this dataset in R? It's also a SAS file I'll need to read into R.

The file is smb://department.university.edu/lab101/me/dataset/file.xpt Setwd(smb://department.university.edu/lab101/me/dataset) doesn't work, but am not sure what would here.

Upvotes: 0

Views: 2801

Answers (1)

amrrs
amrrs

Reputation: 6325

First, Your setwd receives a character string as file path:

setwd("smb:\\department.university.edu\lab101\me\dataset")

Then you can read the file like mentioned here:

# save SAS dataset in trasport format
libname out xport 'c:/mydata.xpt';
data out.mydata;
set sasuser.mydata;
run;

# in R 
library(Hmisc)
mydata <- sasxport.get("file.xpt")
# character variables are converted to R factors

Reference: http://www.statmethods.net/input/importingdata.html

Upvotes: 2

Related Questions