Re: [R] Same code on Mac?

2016-09-01 Thread Jim Lemon
Sometimes the problem stems from chronic exposure to user interfaces.
Yesterday I prepared some material for a Mac user's presentation and
said,

"This text file tells you the names of the files you need for the presentation"

the response was,

"Can I click on it?"

I deleted all the files in the directory apart from the necessary ones
and crossed my fingers.

Jim


On Fri, Sep 2, 2016 at 1:50 AM, Sarah Goslee  wrote:
> R already contains platform-independent code to open a graphics
> device: dev.new()
> The device thus created is specified in options(), but by default is
> appropriate for the current platform.
>
> It's good practice to use this function instead of calling quartz()
> directly so that your code can be run on other systems.
>
> Sarah
>
> On Thu, Sep 1, 2016 at 11:34 AM, Franklin Bretschneider
>  wrote:
>> 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.
>
>
>
> --
> Sarah Goslee
> http://www.stringpage.com
> http://www.sarahgoslee.com
> http://www.functionaldiversity.org
>
> __
> 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.

__
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.


Re: [R] Same code on Mac?

2016-09-01 Thread Sarah Goslee
R already contains platform-independent code to open a graphics
device: dev.new()
The device thus created is specified in options(), but by default is
appropriate for the current platform.

It's good practice to use this function instead of calling quartz()
directly so that your code can be run on other systems.

Sarah

On Thu, Sep 1, 2016 at 11:34 AM, Franklin Bretschneider
 wrote:
> 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.



-- 
Sarah Goslee
http://www.stringpage.com
http://www.sarahgoslee.com
http://www.functionaldiversity.org

__
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.


Re: [R] Same code on Mac?

2016-09-01 Thread Franklin Bretschneider
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.


Re: [R] Same code on Mac?

2016-09-01 Thread Robert Baer

On 9/1/2016 9:44 AM, Sarah Goslee wrote:

On Wed, Aug 31, 2016 at 4:25 PM, Tom Mosca  wrote:

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.



There's an official FAQ for Mac, just as there is for Windows.
https://cran.r-project.org/faqs.html
There's also a Mac-specific email help list.
https://www.r-project.org/mail.html

Most R code will run as well or better on Mac. All of the OS problems
I've run into tend to be problems with Windows. It's a bit harder to
get some geospatial stuff working on Mac, but that's unlikely to be a
problem with your elementary stats students.
Sarah has pointed you at some Mac support, but some additional advice as 
to the student audience.   [I live in a Windows world most of the time 
and a Ubuntu world the rest of the time, so I have minimal knowledg of 
OSX].Having students install RStudio has really helped because it 
brings cross-platform commonality here and there.


The biggest problems I've run into with beginning statistics students 
are the issues related to getting them connected to our network and/or 
reading in textbook datasets located on that network.  Differences in 
handling of line endings on text files. However, if you do ground work 
to show them how to do some basic basic things early, they can support 
themselves with these things. The commands will work the same


For text files I often have (Windows) students copy data to the 
clipboard and use a command like  x <- read.table(file = 'clipboard', 
sep = '\t', header = TRUE)  so we can work through some statistical 
tests or graphing.   This won't work on a Mac.  An equivalent 
formulation that is helpful on the Mac is x <- read.table(file = 
pipe('pbpaste'), sep = '\t', header = TRUE)


Other than that, I think you'll find R extremely OS agnostic in a 
teaching environment.


--


--
Robert W. Baer, Ph.D.
Professor of Physiology
Kirksville College of Osteopathic Medicine
A T Still University of Health Sciences
800 W. Jefferson St
Kirksville, MO 63501
660-626-2321 Department
660-626-2965 FAX

__
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.


Re: [R] Same code on Mac?

2016-09-01 Thread Sarah Goslee
On Wed, Aug 31, 2016 at 4:25 PM, Tom Mosca  wrote:
> 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.
>


There's an official FAQ for Mac, just as there is for Windows.
https://cran.r-project.org/faqs.html
There's also a Mac-specific email help list.
https://www.r-project.org/mail.html

Most R code will run as well or better on Mac. All of the OS problems
I've run into tend to be problems with Windows. It's a bit harder to
get some geospatial stuff working on Mac, but that's unlikely to be a
problem with your elementary stats students.

Sarah

-- 
Sarah Goslee
http://www.functionaldiversity.org

__
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.


[R] Same code on Mac?

2016-09-01 Thread Tom Mosca
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.



Thank you.

[[alternative HTML version deleted]]

__
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.