سؤال

Is it possible to read files from a UNC-specified directory in R? I'd like to do it without using any packages beyond the base installation.

هل كانت مفيدة؟

المحلول

UNC names work fine, you just have to escape them correctly. This works for me:

read.csv('\\\\COMPUTER\\Directory\\file.txt')

نصائح أخرى

a slightly more cross-platform approach

# the two '' are required to represent the two leading slashes of the UNC path
read.csv(file.path('', '', 'COMPUTER', 'Directory' 'file.txt'))

adding to nograpes answer ... you can avoid the escaping ugliness by using forward slashes ... this works as well

read.csv('//COMPUTER/Directory/file.txt')
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top