I have a huge raw data file which I do not intend to change or copy. And I have two projects in RStudio
and both need to be able to access it.
I originally created the alias (in MacOS) in the following way
right click the file ~/A/data.csv
in finder, and click "make alias". Then copy the alias to ~/B/
and rename it ~/B/data.csv
I also tried the following command later
ln -s ~/A/data.csv ~/B
For project A, I put the actual data file in A/data/data.csv.
For project B, I created an alias under B/data/.
But when I try fread('B/data/data.csv'), it complains:
sh: ./data/data.csv: Too many levels of symbolic links
Error in fread("./data/data.csv") :
File is empty: /var/folders/4h/2jg64xk52mv3fyq4sb7s371w0000gn/T//Rtmp7cWNN3/filebf3013ad9194
I think I can use a hard link to solve this issue, but just want to see if I can use alias to make it work.
===== I don't think it matters, but for completeness, see the following for my OS and R version:
platform x86_64-apple-darwin10.8.0
arch x86_64
os darwin10.8.0
system x86_64, darwin10.8.0
status
major 3
minor 1.0
year 2014
month 04
day 10
svn rev 65387
language R
version.string R version 3.1.0 (2014-04-10)
nickname Spring Dance
I'm not entirely sure why using aliases in this specific case:
echo "test" > test.txt
) the alias will be 274k times bigger:~/A/data.csv
directly rather than linking to it's alias?Two alternative solutions (not directly answering question) could be to (1) copy the file or (2) create a kind of symbolic link.
Copying the file
Or in
R
, usingsystem
(on Mac):Creating a symbolic link
This can be done by simply saving the path of the file
~/A/data.csv
in~/B/data/
.In shell:
(this part can be also done in
R
usingsystem()
as above) And then, inR
: