[R] file.link fails on NTFS

2012-12-07 Thread Oliver Soong
Windows 7 64-bit, R 2.15.2 i386.  Working directory is on an NTFS drive.

 writeLines(, file.txt)
 file.link(file.txt, link.txt)
Warning in file.link(file.txt, link.txt) :
  cannot link 'link.txt' to 'link.txt', reason 'The system cannot find
the file specified'

No link is created.  The 'link.txt' to 'link.txt' is suspicious.  Does
this happen to anybody else?  I didn't find anything in my searches.

Oliver

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] system(wait = FALSE) seems to fail

2011-01-13 Thread Oliver Soong
I'm having problems with system(wait = FALSE) with R 2.12.1 (both i386
and x64 versions) on a 64-bit Windows 7 machine.

This is as expected:
print(system(cmd /c dir, wait = TRUE))

This fails:
print(system(cmd /c dir, wait = FALSE))

I did not see this with 2.12.0, and things seem to work fine with R
2.12.1 on a 32-bit XP machine.  Can anybody else confirm what I'm
seeing here?

Oliver

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] R 2.11, shell, spaces

2010-09-07 Thread Oliver Soong
Can somebody confirm some unexpected behavior?  This is under Windows,
with R 2.11.0 and 2.11.1.

1. Create a trivial test file (I called it test.R) containing:
cat(Success.\n)
2. Load R (Gui or Term) and run:
shell(\C:\\path\\to\\Rscript.exe\ \C:\\path\\to\\test.R\)

In my case, I get various error messages.  If the
path\\to\\Rscript.exe has spaces or not, it complains that the first
token (e.g., 'C:\Program') is not a valid command.  If the
path\\to\\Rscript.exe has no spaces, it complains that the specified
path is invalid.  If C:\\path\\to\\test.R has no spaces, and I remove
the surrounding quotes, things work as expected.

I think this might be related to some earlier e-mail traffic that I
didn't see a satisfactory resolution to.

Cheers,
Oliver

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] R 2.11, shell, spaces

2010-09-07 Thread Oliver Soong
Thanks, Duncan, for the pointer in the right direction.  I didn't
realize cmd's treatment of quotes was so odd.  For the curious, the
quote behavior of cmd (under XP) is here, in the Remarks under
Processing quotation marks:

http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/cmd.mspx?mfr=true

In my case I can use system.  The only workaround I could think of for
executing a command that requires a shell (e.g., using redirection) is
to create a temporary batch file and cmd that, which is a bit ugly.

Again, thanks for all the input.
Oliver


On Tue, Sep 7, 2010 at 3:44 PM, Duncan Murdoch murdoch.dun...@gmail.com wrote:
 On 07/09/2010 5:01 PM, Oliver Soong wrote:

 Can somebody confirm some unexpected behavior?  This is under Windows,
 with R 2.11.0 and 2.11.1.

 1. Create a trivial test file (I called it test.R) containing:
 cat(Success.\n)
 2. Load R (Gui or Term) and run:
 shell(\C:\\path\\to\\Rscript.exe\ \C:\\path\\to\\test.R\)

 In my case, I get various error messages.  If the
 path\\to\\Rscript.exe has spaces or not, it complains that the first
 token (e.g., 'C:\Program') is not a valid command.  If the
 path\\to\\Rscript.exe has no spaces, it complains that the specified
 path is invalid.  If C:\\path\\to\\test.R has no spaces, and I remove
 the surrounding quotes, things work as expected.

 I think this might be related to some earlier e-mail traffic that I
 didn't see a satisfactory resolution to.

 That message is coming from Windows, not from R.  R is trying to execute

 cmd /c c:\path\to\Rscript.exe c:\path\to\test.R

 and that doesn't work.  You'll have to ask Microsoft why, but I believe the
 correct syntax is

 cmd /c c:\path\to\Rscript.exe c:\path\to\test.R

 i.e. /c is followed by just one quoted string, not two.  If you need extra
 quotes because of spaces in the path to Rscript, I don't know what you can
 do.

 I'd recommend using system() instead of shell(); it will call Rscript
 directly, not go through the cmd shell.

 Duncan Murdoch


 Cheers,
 Oliver

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.





-- 
Oliver Soong
Donald Bren School of Environmental Science  Management
University of California, Santa Barbara
Santa Barbara, CA 93106-5131
805-893-7044 (office)
610-291-9706 (cell)

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] 2.7.0 graphics changes and png devices

2008-05-19 Thread Oliver Soong
Hi,

I have a question about the graphics changes in 2.7.0.  The example is
this bit of code:

par(mfcol = c(2, 3))
for(i in 1:6) plot(1:10, 1:10, xlab = xlab, ylab = ylab, main = main)

In 2.7.0, if I do this interactively (using windows()), I get bold
titles.  If I do this through a png device, I get regular weight
titles.  If I do this in 2.6.2, both situations give bold titles.

I assume the 2.7.0 png device is off here, but I'm not sure how to fix
this.  Suggestions?

Oliver

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] 2.7.0 graphics changes and png devices

2008-05-19 Thread Oliver Soong
Apologies for the double-post, but I figured I should be slightly more
specific.  I'm using the windows version of 2.7.0 and 2.6.2.  My calls
to png is simply png(2.7.0.png) and png(2.6.2.png), respectively,
followed by the appropriate dev.off().

Oliver


On 5/19/08, Oliver Soong [EMAIL PROTECTED] wrote:
 Hi,

 I have a question about the graphics changes in 2.7.0.  The example is
 this bit of code:

 par(mfcol = c(2, 3))
 for(i in 1:6) plot(1:10, 1:10, xlab = xlab, ylab = ylab, main = main)

 In 2.7.0, if I do this interactively (using windows()), I get bold
 titles.  If I do this through a png device, I get regular weight
 titles.  If I do this in 2.6.2, both situations give bold titles.

 I assume the 2.7.0 png device is off here, but I'm not sure how to fix
 this.  Suggestions?

 Oliver


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] cor -1

2008-05-18 Thread Oliver Soong
I'm having what looks like a quantization problem with cor on R 2.7.0.
 I get warnings from cor.test because r  -1.  R session output is at
the bottom.  A simple fix would be to add the appropriate checks to
the end of the internal cor code.

Oliver


 x - c(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)
 y - c(1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1)
 cor.test(x, y)

Pearson's product-moment correlation

data:  x and y
t = NaN, df = 13, p-value = NA
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:
 NaN NaN
sample estimates:
cor
 -1

Warning messages:
1: In sqrt(1 - r^2) : NaNs produced
2: In atanh(r) : NaNs produced
 cor(x, y)  -1
[1] TRUE
 cor(x, y) + 1
[1] -2.220446e-16
 .Internal(cor(x, y, 1, FALSE))  -1
[1] TRUE
 .Internal(cor(x, y, 3, FALSE))  -1
[1] FALSE

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] pairs, par(plt)

2007-10-20 Thread Oliver Soong
I'm having some confusion over the coordinate system after using
pairs.  I'm not interested in the content of the actual pairs plot,
although the number of pairs seems to matter a bit.  I'm purely
interested in knowing where my points will be plotted on the device.
However, after using pairs, the par information (omd, fig, plt, and
usr) don't reflect what points does.  For example:

pairs(iris[1:5])
par(xpd = NA)
points(0 - 0.01 * 1:100, 0 - 0.01 * 1:100)
points(0 - 0.01 * 1:100, 1 + 0.01 * 1:100)
points(1 + 0.01 * 1:100, 0 - 0.01 * 1:100)
points(1 + 0.01 * 1:100, 1 + 0.01 * 1:100)
par(c(omd, fig, plt, usr))

The resulting plot shows that the corners of the are approximately
0.05 user coordinate units from the boundaries of the plot region.
According to par, though, there is a margin around the plotting region
that is clearly not symmetric and does not correspond to around 0.05
units.

If we use pairs(iris[1:2]) and repeat the rest, the corners are now
0.02 user coordinate units.  par provides the same information as
before.

So:
1. How do I figure out where coordinates I give to points will display
on the figure?
2. More generally (for my own understanding), why does the par
information not do what I expect?  Do I have some fundamental
misunderstanding of the arrangement of plotting, figure, display, and
margin regions within the device?

I'm using R 2.5.1, and this behavior occurs on a fresh R console.

Thanks!

Oliver


-- 
Oliver Soong
Donald Bren School of Environmental Science  Management
University of California, Santa Barbara
Santa Barbara, CA 93106-5131
805-893-7044 (office)
610-291-9706 (cell)

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.