mmapのエラー

mmapを用いてデータを読み込もうとすると以下のエラーが出た。

 mmap(binfile, char()) でエラー: 
  unable to open file: possible permission issue. 

パーミッションに問題はない。
検索すると、ファイルパスにチルダを用いていたことが原因のようで、そこを修正すると問題なく読み込めた。

以下転載
https://groups.google.com/a/lbl.gov/forum/#!topic/singularity/0Zee4kobMxw

I had some vague recollection that is some contexts '~' is actually
interpreted as a literal and not expanded to your home directory
location. I ran this on my plain old hardware, no container, and I
get the same

> library(mmap)
> tmp <- "~/testmmap"
> ints <- as.mmap(1:100L, mode=int8(), file=tmp)
Error in mmap(file, as.Ctype(mode)) :
unable to open file: possible permission issue.

That's with R 3.4.2.

Compare to

> tmp <- path.expand("~/testmmap")
> tmp
[1] "/home/bennet/testmmap"
> ints <- as.mmap(1:100L, mode=int8(), file=tmp)
>