Re: [R-SIG-Mac] sort() under terminal

2015-10-12 Thread Rainer M Krug
Adrian Dușa  writes:

> Dear All,
>
> I tried to search some information about this on Google, but didn't find
> anything yet.
> There seems to be a difference between sorting in the Terminal app and
> sorting in the Rgui:
>
> In the Terminal:

Just a guess: Check the sessionInfo(). Mine is:

,
| > sessionInfo()
| R version 3.2.2 (2015-08-14)
| Platform: x86_64-apple-darwin14.5.0 (64-bit)
| Running under: OS X 10.11 (El Capitan)
| 
| locale:
| [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
| 
| attached base packages:
| [1] stats graphics  grDevices utils datasets  methods   base
| >
`

I guess it is the locale settings which are different?

Cheers,

Rainer
>
>> sort(c("W", "e", "E"))
> [1] "E" "W" "e"
>> R.version
>_
> platform   x86_64-apple-darwin13.4.0
> arch   x86_64
> os darwin13.4.0
> system x86_64, darwin13.4.0
> status
> major  3
> minor  2.2
> year   2015
> month  08
> day14
> svn rev69053
> language   R
> version.string R version 3.2.2 (2015-08-14)
> nickname   Fire Safety
>
>
>
> In the Rgui:
>
>> sort(c("W", "e", "E"))
> [1] "e" "E" "W"
>> R.version
>_
> platform   x86_64-apple-darwin13.4.0
> arch   x86_64
> os darwin13.4.0
> system x86_64, darwin13.4.0
> status
> major  3
> minor  2.2
> year   2015
> month  08
> day14
> svn rev69053
> language   R
> version.string R version 3.2.2 (2015-08-14)
> nickname   Fire Safety
>
>
> Could anyone point me to some information, please?
> Best wishes,
> Adrian

-- 
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, 
UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Stellenbosch University
South Africa

Tel :   +33 - (0)9 53 10 27 44
Cell:   +33 - (0)6 85 62 59 98
Fax :   +33 - (0)9 58 10 27 44

Fax (D):+49 - (0)3 21 21 25 22 44

email:  rai...@krugs.de

Skype:  RMkrug

PGP: 0x0F52F982


signature.asc
Description: PGP signature
___
R-SIG-Mac mailing list
R-SIG-Mac@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-mac


Re: [R-SIG-Mac] sort() under terminal

2015-10-12 Thread Duncan Murdoch
On 12/10/2015 10:59 AM, Adrian Dușa wrote:
> Dear All,
> 
> I tried to search some information about this on Google, but didn't find
> anything yet.
> There seems to be a difference between sorting in the Terminal app and
> sorting in the Rgui:
> 
> In the Terminal:
> 
>> sort(c("W", "e", "E"))
> [1] "E" "W" "e"
>> R.version
>_
> platform   x86_64-apple-darwin13.4.0
> arch   x86_64
> os darwin13.4.0
> system x86_64, darwin13.4.0
> status
> major  3
> minor  2.2
> year   2015
> month  08
> day14
> svn rev69053
> language   R
> version.string R version 3.2.2 (2015-08-14)
> nickname   Fire Safety
> 
> 
> 
> In the Rgui:
> 
>> sort(c("W", "e", "E"))
> [1] "e" "E" "W"
>> R.version
>_
> platform   x86_64-apple-darwin13.4.0
> arch   x86_64
> os darwin13.4.0
> system x86_64, darwin13.4.0
> status
> major  3
> minor  2.2
> year   2015
> month  08
> day14
> svn rev69053
> language   R
> version.string R version 3.2.2 (2015-08-14)
> nickname   Fire Safety
> 
> 
> Could anyone point me to some information, please?

See the help page for sort, or the page it references, ?Comparison.
Presumably you are running the two instances of R with different locale
settings.

Duncan Murdoch

___
R-SIG-Mac mailing list
R-SIG-Mac@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-mac


Re: [R-SIG-Mac] sort() under terminal

2015-10-12 Thread THIOULOUSE JEAN
The difference is not between the Terminal and Rgui. Check your locale: in the 
Terminal, I get

> sort(c("W", "e", "E"))
[1] "e" "E" "W"

> sessionInfo()
R version 3.2.1 (2015-06-18)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.10.5 (Yosemite)

locale:
[1] fr_FR.UTF-8/fr_FR.UTF-8/fr_FR.UTF-8/C/fr_FR.UTF-8/fr_FR.UTF-8

attached base packages:
[1] stats graphics  grDevices utils datasets  methods   base 

loaded via a namespace (and not attached):
[1] adegraphics_1.0-4  RColorBrewer_1.1-2 sp_1.1-1   KernSmooth_2.23-14
[5] grid_3.2.1 ade4_1.7-2 lattice_0.20-31   

Jean


> Le 12 oct. 2015 à 16:59, Adrian Dușa  a écrit :
> 
> Dear All,
> 
> I tried to search some information about this on Google, but didn't find
> anything yet.
> There seems to be a difference between sorting in the Terminal app and
> sorting in the Rgui:
> 
> In the Terminal:
> 
>> sort(c("W", "e", "E"))
> [1] "E" "W" "e"
>> R.version
>   _
> platform   x86_64-apple-darwin13.4.0
> arch   x86_64
> os darwin13.4.0
> system x86_64, darwin13.4.0
> status
> major  3
> minor  2.2
> year   2015
> month  08
> day14
> svn rev69053
> language   R
> version.string R version 3.2.2 (2015-08-14)
> nickname   Fire Safety
> 
> 
> 
> In the Rgui:
> 
>> sort(c("W", "e", "E"))
> [1] "e" "E" "W"
>> R.version
>   _
> platform   x86_64-apple-darwin13.4.0
> arch   x86_64
> os darwin13.4.0
> system x86_64, darwin13.4.0
> status
> major  3
> minor  2.2
> year   2015
> month  08
> day14
> svn rev69053
> language   R
> version.string R version 3.2.2 (2015-08-14)
> nickname   Fire Safety
> 
> 
> Could anyone point me to some information, please?
> Best wishes,
> Adrian
> 
> 
> -- 
> Adrian Dusa
> University of Bucharest
> Romanian Social Data Archive
> Soseaua Panduri nr.90
> 050663 Bucharest sector 5
> Romania
> 
>   [[alternative HTML version deleted]]
> 
> ___
> R-SIG-Mac mailing list
> R-SIG-Mac@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-mac

—-
Jean THIOULOUSE
http://lbbe.univ-lyon1.fr/-Thioulouse-Jean-.html



___
R-SIG-Mac mailing list
R-SIG-Mac@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-mac


[R-SIG-Mac] R and Haskell (Having My Cake...)

2015-10-12 Thread Dominic Steinitz
All,

As someone who uses both R and Haskell and a Mac in my day job, I am very 
excited by the news that this now works on Macs.

> http://tweag.github.io/HaskellR/ 
For example, if I want to use Nelder-Mead in Haskell then all I have to do is 
the code below most of which is boilerplate and took me about 20 minutes. 
Plotting is also supported although I tend to use the the native Haskell charts 
package most of the time.

Oh and the answer is

> (505.0,1.35627670639,-6.432963549964604e-4,2.105887833352907e-6,69,0)


Not bad but not brilliant but it is Nelder-Mead after all.

> {-# LANGUAGE QuasiQuotes #-}
> 
> import H.Prelude as H
> import Language.R.QQ
> 
> import qualified Foreign.R as R
> import qualified Foreign.R.Type as R
> 
> import Data.Int
> import Control.DeepSeq
> 
> xs, ys :: [Double]
> xs = [1.0..10.0]
> ys = [1.0..10.0]
> 
> cost :: Double -> Double -> Double
> cost m c =
>   sum $
>   map (^2) $
>   zipWith (-) (map (\x -> m * x + c) xs) ys
> 
> nmMin :: IO (Double, Double, Double, Double, Int32, Int32)
> nmMin = runRegion $ do
>   initParms <- [r| c(2.0,1.0) |]
>   initVal   <- H.fromSEXP . R.cast R.SReal <$>
>[r| (function(v) costH_hs(v[1], v[2])) (initParms_hs) |]
>   relaxMin <- [r| optimx(c(2.0,1.0), function(v) costH_hs(v[1], v[2]), method 
> = "Nelder-Mead") |]
>   mMin <- H.fromSEXP . R.cast R.SReal <$> [r| relaxMin_hs$p1 |]
>   cMin <- H.fromSEXP . R.cast R.SReal <$> [r| relaxMin_hs$p2 |]
>   vMin <- H.fromSEXP . R.cast R.SReal <$> [r| relaxMin_hs$value |]
>   fEvals   <- H.fromSEXP . R.cast R.SInt  <$> [r| 
> as.integer(relaxMin_hs$fevals) |]
>   convCode <- H.fromSEXP . R.cast R.SInt  <$> [r| 
> as.integer(relaxMin_hs$convcode) |]
>   return $!! (initVal, mMin, cMin, vMin, fEvals, convCode)
>   where
> costH :: Double -> Double -> R s Double
> costH m c = return $ cost m c
> 
> main :: IO ()
> main =
>   withEmbeddedR defaultConfig $ do
> runRegion $ do
>   _ <- [r| install.packages(c("numDeriv", "optimx"), repos = 
> "http://cran.us.r-project.org;) |]
>   _ <- [r| library('numDeriv') |]
>   _ <- [r| library('optimx') |]
>   return ()
> results <- nmMin
> putStrLn $ Prelude.show results



Dominic Steinitz
domi...@steinitz.org
http://idontgetoutmuch.wordpress.com


[[alternative HTML version deleted]]

___
R-SIG-Mac mailing list
R-SIG-Mac@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-mac


[R-SIG-Mac] sort() under terminal

2015-10-12 Thread Adrian Dușa
Dear All,

I tried to search some information about this on Google, but didn't find
anything yet.
There seems to be a difference between sorting in the Terminal app and
sorting in the Rgui:

In the Terminal:

> sort(c("W", "e", "E"))
[1] "E" "W" "e"
> R.version
   _
platform   x86_64-apple-darwin13.4.0
arch   x86_64
os darwin13.4.0
system x86_64, darwin13.4.0
status
major  3
minor  2.2
year   2015
month  08
day14
svn rev69053
language   R
version.string R version 3.2.2 (2015-08-14)
nickname   Fire Safety



In the Rgui:

> sort(c("W", "e", "E"))
[1] "e" "E" "W"
> R.version
   _
platform   x86_64-apple-darwin13.4.0
arch   x86_64
os darwin13.4.0
system x86_64, darwin13.4.0
status
major  3
minor  2.2
year   2015
month  08
day14
svn rev69053
language   R
version.string R version 3.2.2 (2015-08-14)
nickname   Fire Safety


Could anyone point me to some information, please?
Best wishes,
Adrian


-- 
Adrian Dusa
University of Bucharest
Romanian Social Data Archive
Soseaua Panduri nr.90
050663 Bucharest sector 5
Romania

[[alternative HTML version deleted]]

___
R-SIG-Mac mailing list
R-SIG-Mac@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-mac


Re: [R-SIG-Mac] XCode / gcc / R compatibility issues on Yosemite with XCode 7 and on El Capitan

2015-10-12 Thread Jenny Brown
Thank you to both of you.  I believe my issue is solved by using the binary
distribution of gfortran libraries, as it was dynamic linking that was
causing me the most headache.  And that seems to solve that.

I still have to modify the etc/Makeconf file to use the right directory for
-L and the right library name for gfortran  it comes written as
gfortran-4.8 in the Makeconf but that gives a not-found on my system.  I'm
not entirely clear on when the Makeconf is initially written during a
binary install of R.  But it does seem that I can adjust the lines related
to fortran and get it to work for compiling my source packages.

Thanks!




On Thu, Oct 8, 2015 at 1:33 AM, Prof Brian Ripley 
wrote:

> On 08/10/2015 02:37, Simon Urbanek wrote:
>
>> Jenny,
>>
>> I suspect you may not have the correct information. The CRAN Mavericks
>> binary of R is not built with gcc, it's actually build using Apple clang
>> and we're neither using nor requiring homebrew, so most of what you are
>> describing doesn't make sense to me. I have tested Xcode 7 with the
>> gfortran-4.8 we supply and it works just fine on 10.11 (tested on Hmisc). I
>> have only 10.6, 10.9 and 10.11 so I can't check 10.10, but I would
>> certainly recommend building on 10.9 with Xcode 6 for compatibility (that's
>> what we do for CRAN). If you don't care about binary compatibility then
>> Xcode 7 on 10.11 is fine (FWIW Hmisc package compiled on 10.11 actually
>> works for me on 10.9 so it could even be that you may get away with using
>> 10.11 if you don't use system dependencies with higher versions).
>>
>
> It also works for me on 10.10.  If the 'Command Line Tools OS X 10 for
> Xcode 7' Apple package is installed on 10.10 (specifically file
> http://adcdownload.apple.com/Developer_Tools/Command_Line_Tools_OS_X_10.10_for_Xcode_7/Command_Line_Tools_OS_X_10.10_for_Xcode_7.dmg),
> it installs
>
> % clang --version
> Apple LLVM version 7.0.0 (clang-700.0.74)
> Target: x86_64-apple-darwin14.5.0
>
> hence targets OS X 10.10 aka Darwin 14.  My 10.10 machine does not have
> Xcode installed, only the CLT: you do not need Xcode's SDKs to compile R
> nor any CRAN package.  (You do need Xcode to compile R.app.)
>
> For Fortran on Yosemite/El Capitan I use the gfortran 5.2 build at the
> sites given in the current R-admin manual ('Other builds of gfortran are
> available: see https://gcc.gnu.org/wiki/GFortranBinaries and
> http://coudert.name/software.html').  My recollection is that the
> 'gfortran-4.8 for Mavericks' on r.research.att.com does compile all but
> one of the CRAN packages on Yosemite (SWATmodel which compiles executables
> from Fortran code), in some cases with warnings.
>
> Note that any recent(ish) build of gfortran will have dynamic libgfortran
> and libquadmath libraries, and installations of most Fortran-using packages
> will link to these.  So you either need to install those libraries on all
> the machines or arrange for the packages you distribute to point to the
> copies in the CRAN build (in R_HOME/lib) as is done for the CRAN binary
> packages.  (I believe they are post-processed by
> https://svn.r-project.org/R-dev-web/trunk/CRAN/QA/Simon/packages/1.fixr
> .)  My recollection is that a very few packages also link to libgcc_s, also
> in R_HOME/lib.
>
>
>
> Cheers,
>> Simon
>>
>>
>> On Oct 7, 2015, at 10:47 AM, Jenny Brown  wrote:
>>>
>>> I am maintaining R installations and packages for a large number of OS X
>>> machines.  A recent change from Apple is making the R installation more
>>> awkward, and I'm trying to determine the best path forward with minimal
>>> maintenance headaches.
>>>
>>>
>>> Recently, XCode 7's release on Yosemite 10.10 broke compilation of "brew
>>> install --with-fortran gcc48" which is a pre-requisite for compiling
>>> third
>>> party R packages that use fortran.  (XCode 7 eliminates the 10.9 and
>>> 10.10
>>> SDKs and only provides 10.11 which is El Capitan's... so even though
>>> XCode
>>> 7 installs on Yosemite, it can not build for Yosemite, which causes gcc
>>> trouble.  Lots of opensource devs are commenting on this on various
>>> projects.)
>>>
>>> It appears that the binary installs of R for OS X (3.1 through 3.2.2)
>>> were
>>> all built against gcc 4.8.  I've discovered that gcc 5.2 builds properly
>>> on
>>> Yosemite, even with XCode 7, and R can be compiled with gcc 5.2.
>>>
>>> However, even the latest R (3.2.2) on cran.rstudio.com appears to be
>>> built
>>> by default with gcc 4.8 -- are there plans to move to gcc 5.2?
>>> Presumably
>>> the breakage I'm seeing where gcc 4.8 can't use the xcode 7 10.11 SDK
>>> would
>>> also occur on El Capitan, so gcc 5.2 would be a necessary upgrade there
>>> too.
>>>
>>> Right now my choices for getting R to work with my third-party fortran
>>> packages appear to be: manually downgrade xcode to 6.4 for Yosemite; or,
>>> maintain my own compilation of R against gcc 5.2, for each of Yosemite
>>> and
>>> El 

Re: [R-SIG-Mac] Experiences with El Capitan

2015-10-12 Thread Spencer Graves



On 10/12/2015 8:51 PM, Kevin Ushey wrote:

The simplest way to fix your issue is to symlink R to /usr/local/bin, e.g.

 ln -s /Library/Frameworks/R.framework/Resources/bin/R /usr/local/bin/R



This worked.  Thanks.  Spencer


... but not completely:  "R CMD build" worked.  "R CMD check" ended with:


Error in texi2dvi(file = file, pdf = TRUE, clean = clean, quiet = quiet,  :
  pdflatex is not available





Or, as Professor Ripley said in his initial post, R installers from
3.2.2 on El Capitan will now install a symlink at /usr/local/bin/R, so
you might want to just re-install or update R.

Updating the CLT is normally just a matter of downloading the latest



What's CLT?  Central Limit Theorem?  Charlotte Douglas International 
Airport?




version of Xcode from the App Store, if I understand correctly. (You



	  I requested "Xcode" at the App Store.  It asked for my Apple password 
then went away.  I rebooted and still got "pdflatex is not available".




may need to read + confirm a license agreement on your next run of the
clang compiler -- try running 'clang' after installing Xcode to see if
you're prompted)



$ clang
xcrun: error: invalid active developer path 
(/Library/Developer/CommandLineTools), missing xcrun at: 
/Library/Developer/CommandLineTools/usr/bin/xcrun



	  Thanks again for your prompt reply.  Other suggestions?  (All this 
worked before I upgraded to OS X 10.11.)  Spencer




Kevin

On Mon, Oct 12, 2015 at 6:33 PM, Spencer Graves
 wrote:


On 10/5/2015 2:46 PM, Simon Urbanek wrote:

On Oct 5, 2015, at 3:34 AM, Rainer M Krug  wrote:


peter dalgaard  writes:




Agreed.

I just would like to dd that in the case of using homebrew, which
installs everything under /usr/local/... which did not cause any
problems at all. I moved the contents of /usr/local to an other location
before upgrade because the upgrade to Yosemite took because of a large
/usr/local several hours instead of about half an hour, moved it back
afterwards and everything worked fins without problems.

One question concerning mixed usage of homebrew and the Official R
installers:

do the Official R installers fail if an R binary already exist, or do
they raise a warning?

To make this easier, would it be possible, to install the binaries under
/usr/local/bin/R.X.Y.Z and then just create links in /usr/local/bin ?
Tghis would make the whole process more transparent and easier to switch
between different versions and means of installation.


R installer never installs any R binaries outside of the framework/app.
The only thing we provide on 10.10 is a softlink for R and Rscript in
/usr/local/bin into the framework (removing anything else in that name if it
exists). In earlier OS X versions this applies to /usr/bin instead.

Cheers,
Simon



Thanks for the clarifications,

Rainer


-pd


On 04 Oct 2015, at 18:53 , Prof Brian Ripley 
wrote:

The machine which provides the 'r-devel-osx-x86_64-clang' checks on
the CRAN check farm has been upgraded from Yosemite to El Capitan
and a complete round of checks has been run.


1) There is a lot of misinformation around about 'System Integrity
Protection' aka 'rootless'.

Upgrading to El Capitan moves files which are not allowed under /usr
to /Library/SystemMigration/usr, so you will be able to see what was
lost. This includes /usr/bin/R, /usr/bin/Rscript (but the installer
installs these under /usr/local/bin on El Capitan as from R 3.2.2),
/usr/X11R6, /usr/texbin .  Contrary to reports from betas, the link
/usr/X11 is preserved.

If an installer tries to create a disallowed file such as
/usr/bin/R, this is silently ignored (at least in the cases we
tested).  So you can install e.g. R 3.1.3 but the executables will
not appear in the default Terminal path (more details in the current
manual).


2) After updating you need to re-install the Command Line Tools and
R (to get the links in /usr/local).  I did not need to re-install
Java nor XQuartz.



   How do you suggest I "re-install the Command Line Tools and R"?


   I upgraded to 10.11 days ago but only now tried "R CMD build" and got,
"-bash: R: command not found". How can I get past this?


   Thanks,
   Spencer


p.s.  Thanks very much for all your work, including the comments on this
thread.



3) All the 'Mavericks' binary packages tested worked.  The source
packages of rJava and rgl (only) cannot be installed and the
maintainers have patched versions available.


There is updated information in the latest 'R Installation and
Administration' manual in R-patched and R-devel (in the sources, or
the online versions at https://cran.r-project.org/manuals.html will
update in a day or two).

--
Brian D. Ripley,  rip...@stats.ox.ac.uk
Emeritus Professor of Applied Statistics, University of Oxford
1 South Parks Road, Oxford OX1 3TG, UK

___
R-SIG-Mac mailing