Dear Tom Mosca,

Re:

> Using a PC I have written the R code for my elementary statistics students.  
> One of the students has a Mac.  Should the same lines of code work on a Mac?
> 
> 
> 
> Where can the student find support for R on her Mac?  I don't know anything 
> about them, and have never used one.
> 


Some commands are platform-dependent though, such as opening the standard 
graphics window [quartz() vs windows()].
This needn't be a problem, since in R a script can sense on which platform it 
is running.
Some years ago I wrote a platform-sensing graphics routine, reproduced below.
This might help to prevent problems with simple graphics demos, and can no 
doubt be extended to other commands.

Success, and
Best regards,


Franklin Bretschneider
Dept of Biology
Utrecht University
brets...@xs4all.nl




#  function PIgraph.r
#  Platform-Independent graphics init
#  determines platform (Windows or Mac) then chooses device type
#  F. Bretschneider; 04-08-2009
#  ====================

PIgraph <- function(w,h) if(.Platform$OS.type == "windows") windows(w=w, h=h) 
else quartz(w=w, h=h)

#  example application
x=-3:3
y=x^2
PIgraph(8,6)
plot(x,y, type = 'o')

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.

Reply via email to