Re: [R] installing R 3.5.1

2018-08-25 Thread Berwin A Turlach
G'day Bogdan,

On Fri, 24 Aug 2018 18:28:59 -0700
Bogdan Tanasa  wrote:

> I am trying to install R 3.5.1 on my Ubuntu 14.04 system; however, I
> am getting the following message :
> 
> sudo apt-get install r-base
> [...]
> The following packages have unmet dependencies:
>  r-base : Depends: r-recommended (= 3.5.1-1trusty) but it is not
> going to be installed
> E: Unable to correct problems, you have held broken packages.

For me such problems are usually fixed by specifying the package that
"is not going to be installed" but on which the package I want to
install depends also to apt-get install.

What does
sudo apt-get install r-base r-recommended
do on your system?

Cheers,

Berwin

__
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] installing R 3.5.1

2018-08-25 Thread Benoit Vaillant
Hello Bogdan,

This reply is off topic for the list, appologies. This problem is more
r-sig-debian related (see below).

Though Berwin already mentionned a possible solution, here is another.

On Fri, Aug 24, 2018 at 06:28:59PM -0700, Bogdan Tanasa wrote:
> I am trying to install R 3.5.1 on my Ubuntu 14.04 system;

You are trying to install R (latest version) on a system that is
outdated by the latest LTS (16.04) and more than four years old
now. ;-)

If you go to: https://cloud.r-project.org/bin/linux/ubuntu/

You'll get some hints, like:
"R 3.5 packages for Ubuntu on i386 and amd64 are available for most
stable Desktop releases of Ubuntu until their official end of life
date. However, only the latest Long Term Support (LTS) release is
fully supported."

Note the *only the latest LTS* ;-)

You'll also get the r-sig-debian list link to report issues.

> Would you please advise, what shall I do next ? Thanks a lot !

If you have the time, upgrade your LTS by migrating your system from
14.04 to 16.04 and then 18.04 (Bionic Beaver).

Best regards,

-- 
Benoît


signature.asc
Description: PGP signature
__
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] Plots in ioslides and R markdown

2018-08-25 Thread Patrick Connolly
I've simplified it so that it's reproducible:


---
title: "Barking up the wrong tree"
author: "Patrick Connolly"
date: "`r format(Sys.time(), '%a %d/%m/%Y %H:%M')`"
output:
  ioslides_presentation: default
  slidy_presentation: default
  beamer_presentation: default
---

```{r global_options, echo=FALSE}
knitr::opts_chunk$set(tidy=TRUE,
  warning=FALSE, 
  message=FALSE,
  cache=FALSE,
  dpi = 300)
 
```
## 6 different Regression Trees

```{r 6 different Regression Trees, echo = FALSE, messages=FALSE, fig.width = 
7, fig.height = 5}

 par(mfrow = c(2, 3))
plot(1:10)
plot(12:4)
plot(seq(0, 800))
plot(-100:-900)
plot(12:50)
plot(90:54)
```

I've tried it on a different machine which gives a slightly more
informative message:

X11 font -adobe-helvetica-%s-%s-*-*-%d-*-*-*-*-*-*-*, face 1 at size 12 could 
not be loaded

That seems to be associated with the Cairo plotting device which isn't
necessary with pdf devices which I normally use, nor, it would seem by
the plot pane in Rstudio.  Consequently, running the plot code itself
works fine, but if is to be incorporated in HTML, we run into the Cairo
issue, Looking into that one, it appears something has been orphaned
for a couple of years.  If anyone has information about that, I'd be
interested.

TIA


-

 version 3.5.0 (2018-04-23)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 14.04.5 LTS

Matrix products: default
BLAS: /home/pat/local/R-3.5.0/lib/libRblas.so
LAPACK: /home/pat/local/R-3.5.0/lib/libRlapack.so

locale:
 [1] LC_CTYPE=en_NZ.UTF-8   LC_NUMERIC=C   LC_TIME=en_NZ.UTF-8  
 
 [4] LC_COLLATE=en_NZ.UTF-8 LC_MONETARY=en_NZ.UTF-8
LC_MESSAGES=en_NZ.UTF-8   
 [7] LC_PAPER=en_NZ.UTF-8   LC_NAME=C  LC_ADDRESS=C 
 
[10] LC_TELEPHONE=C LC_MEASUREMENT=en_NZ.UTF-8 LC_IDENTIFICATION=C  
 

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

other attached packages:
[1] sp_1.3-1lattice_0.20-35

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.17 knitr_1.20   bindr_0.1.1  magrittr_1.5 
tidyselect_0.2.4 munsell_0.5.0   
 [7] colorspace_1.3-2 xtable_1.8-2 R6_2.2.2 rlang_0.2.1  
stringr_1.3.1plyr_1.8.4  
[13] dplyr_0.7.6  tools_3.5.0  grid_3.5.0   htmltools_0.3.6  
crosstalk_1.0.0  rprojroot_1.3-2 
[19] yaml_2.1.19  leaflet_2.0.1assertthat_0.2.0 digest_0.6.15
tibble_1.4.2 bindrcpp_0.2.2  
[25] shiny_1.1.0  purrr_0.2.5  later_0.7.3  htmlwidgets_1.2  
promises_1.0.1   evaluate_0.10.1 
[31] glue_1.2.0   mime_0.5 rmarkdown_1.10   stringi_1.2.3
compiler_3.5.0   pillar_1.2.3
[37] backports_1.1.2  scales_0.5.0 httpuv_1.4.4.2   pkgconfig_2.0.1 
> 



On Thu, 23-Aug-2018 at 07:23AM -0700, Jeff Newmiller wrote:

|> This is not reproducible because you have not provided the plot code or 
sample data. Output of sessionInfo would probably be appropriate as well.
|> 
|> As to whether needing to load objects is typical... yes, rmarkdown runs from 
a fresh environment to emphasize reproducibility, but your load command is 
bypassing that for us.
|> 
|> On August 23, 2018 2:15:19 AM PDT, Patrick Connolly 
 wrote:
|> >I'm having difficulty getting plots into ioslides.  

[...]


-- 
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.   
   ___Patrick Connolly   
 {~._.~}   Great minds discuss ideas
 _( Y )_ Average minds discuss events 
(:_~*~_:)  Small minds discuss people  
 (_)-(_)  . Eleanor Roosevelt
  
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.

__
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] Plots in ioslides and R markdown

2018-08-25 Thread Duncan Murdoch

On 25/08/2018 6:21 AM, Patrick Connolly wrote:

---
title: "Barking up the wrong tree"
author: "Patrick Connolly"
date: "`r format(Sys.time(), '%a %d/%m/%Y %H:%M')`"
output:
   ioslides_presentation: default
   slidy_presentation: default
   beamer_presentation: default
---

```{r global_options, echo=FALSE}
knitr::opts_chunk$set(tidy=TRUE,
   warning=FALSE,
   message=FALSE,
   cache=FALSE,
   dpi = 300)


Drop the dpi setting and it will work fine.

Duncan Murdoch

  
```

## 6 different Regression Trees

```{r 6 different Regression Trees, echo = FALSE, messages=FALSE, fig.width = 
7, fig.height = 5}

  par(mfrow = c(2, 3))
plot(1:10)
plot(12:4)
plot(seq(0, 800))
plot(-100:-900)
plot(12:50)
plot(90:54)
```


__
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] R shared library (/usr/lib64/R/lib/libR.so) not found.

2018-08-25 Thread Dirk Eddelbuettel


Rolf,

I noticed this thread started by you as well as a few of the excellent
follow-ups. While it conclcuded, allow me a few quick comments:

 - Some of us go through some effort to provide R on Ubuntu (and Debian) in a
   reliable and reproducible manner. And it works and is used by many people.

 - The basic r-base (and r-base-core etc) packages work in the distribution,
   but may be older as the distribution is taken as snapshots in time.  Hence
   the Ubuntu mirror via CRAN. That way you get a choice between eg R 3.4.4
   (not that old) and R 3.5.1. (brand new) in the current Ubuntu 18.04.

 - The (short) instructions at CRAN work: add a repo, install from it.
   Neither they nor the longer (more recent) blog post you found (which says
   the same, with more pictures) suggest to link or move libraries around.

 - We even have "proof" in the sense of fully automated build and use
   systems. Docker is just one example.  Eg this Dockerfile build the r-base
   container available as rocker/r-base (as well as the official r-base)
  https://github.com/rocker-org/rocker/blob/master/r-base/Dockerfile
   and eg this one use it and builds on top to generated an RStudio container
  
https://github.com/rocker-org/rocker/blob/master/rstudio/testing/Dockerfile 
   Nowhere in either of these "recipes" are library files moved, renamed, or
   otherwise altered.

 - Nobody ever suggested for _any_ Linux distribution to mix its files below
   /usr with your own compilation.  There lies madness, and it may be the
   root cause of the behaviour local to your machine.  Don't do it.

 - Please consider asking Debian and Ubuntu related questions on r-sig-debian.  

Regards, Dirk

-- 
http://dirk.eddelbuettel.com | @eddelbuettel | e...@debian.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] NaN in Scoring Sentiment

2018-08-25 Thread Shivi Bhatia
Hi All- I am running a sentiment scoring model and the code is as below:
sentiments_per_Category <- aggregate(relative_sentiment_frequencies,
 by = list(Category =
df$Case.Category), mean)

while i run the head command most of the values are NaN. i then used
complete.cases on my data frame
df[complete.cases(df),]
 but it does not seems to work. Please advice if there is a way to handle
NaN.

Regards, Shivi

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


Re: [R] NaN in Scoring Sentiment

2018-08-25 Thread Jeff Newmiller
Did you keep the resulting complete cases version of df?

dfc <- df[complete.cases(df),]

and then use that as input?

On August 25, 2018 7:00:47 AM PDT, Shivi Bhatia  wrote:
>Hi All- I am running a sentiment scoring model and the code is as
>below:
>sentiments_per_Category <- aggregate(relative_sentiment_frequencies,
> by = list(Category =
>df$Case.Category), mean)
>
>while i run the head command most of the values are NaN. i then used
>complete.cases on my data frame
>df[complete.cases(df),]
>but it does not seems to work. Please advice if there is a way to
>handle
>NaN.
>
>Regards, Shivi
>
>   [[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.

-- 
Sent from my phone. Please excuse my brevity.

__
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] installing R 3.5.1

2018-08-25 Thread Bogdan Tanasa
Dear Benoit, many thanks for your suggestions. Have a good weekend !

Message: 26
Date: Sat, 25 Aug 2018 11:13:49 +0200
From: Benoit Vaillant 
To: Bogdan Tanasa 
Cc: r-help 
Subject: Re: [R] installing R 3.5.1
Message-ID: <20180825091348.7tidm7fvhiudr...@auroras.fr>
Content-Type: text/plain; charset="iso-8859-15"

Hello Bogdan,

This reply is off topic for the list, appologies. This problem is more
r-sig-debian related (see below).

Though Berwin already mentionned a possible solution, here is another.

On Fri, Aug 24, 2018 at 06:28:59PM -0700, Bogdan Tanasa wrote:
> I am trying to install R 3.5.1 on my Ubuntu 14.04 system;

You are trying to install R (latest version) on a system that is
outdated by the latest LTS (16.04) and more than four years old
now. ;-)

If you go to: https://cloud.r-project.org/bin/linux/ubuntu/

You'll get some hints, like:
"R 3.5 packages for Ubuntu on i386 and amd64 are available for most
stable Desktop releases of Ubuntu until their official end of life
date. However, only the latest Long Term Support (LTS) release is
fully supported."

Note the *only the latest LTS* ;-)

You'll also get the r-sig-debian list link to report issues.

> Would you please advise, what shall I do next ? Thanks a lot !

If you have the time, upgrade your LTS by migrating your system from
14.04 to 16.04 and then 18.04 (Bionic Beaver).

Best regards,

-- 
Benoît

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


Re: [R] installing R 3.5.1

2018-08-25 Thread Bogdan Tanasa
Dear Berwin, thank you for your help.

On my system, after "sudo apt-get install r-base r-recommended", it says :
[..]
The following packages have unmet dependencies:
 r-recommended : Depends: r-cran-kernsmooth (>= 2.2.14) but it is not going
to be installed
 Depends: r-cran-mass but it is not going to be installed
 Depends: r-cran-class but it is not going to be installed
 Depends: r-cran-nnet but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

Although these packages seem to be well installed ..

On Sat, Aug 25, 2018 at 12:51 AM Berwin A Turlach 
wrote:

> G'day Bogdan,
>
> On Fri, 24 Aug 2018 18:28:59 -0700
> Bogdan Tanasa  wrote:
>
> > I am trying to install R 3.5.1 on my Ubuntu 14.04 system; however, I
> > am getting the following message :
> >
> > sudo apt-get install r-base
> > [...]
> > The following packages have unmet dependencies:
> >  r-base : Depends: r-recommended (= 3.5.1-1trusty) but it is not
> > going to be installed
> > E: Unable to correct problems, you have held broken packages.
>
> For me such problems are usually fixed by specifying the package that
> "is not going to be installed" but on which the package I want to
> install depends also to apt-get install.
>
> What does
> sudo apt-get install r-base r-recommended
> do on your system?
>
> Cheers,
>
> Berwin
>

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


Re: [R] R shared library (/usr/lib64/R/lib/libR.so) not found.

2018-08-25 Thread Berwin A Turlach
G'day Rolf,

On Sat, 25 Aug 2018 11:20:09 +1200
Rolf Turner  wrote:

> I was pretty sure that the foregoing was a complete red herring.  And
> I was right.

I am not sure whether I agree. :)
 
> I have been told by younger and wiser heads that installing from
> source is The Right Thing to Do. 

Younger heads probably have more time on their hands to play around
with installing from source and debugging when things go wrong.  Wiser
heads probably have figured out how they should do so in the first
place. :)

Seriously, years ago I installed quite a bit of software from source,
also to always have the newest version.  And while I was using Debian
unstable I accepted that from time to time an update would leave me
with a broken system and I would have to spend some time to fix it
again.  Nowadays, I rather spend my time on other things and so am
happy to go with most software with whatever version the package
installer of Ubuntu installs.

The one exception is R, but that is for various good reasons:
  * I want to have the 32 bit and 64 bit architecture installed so
that I can test my packages on both packages.  
  * I would like to keep old versions around, to test my packages on
them
  * I like to use the R version that is installed in our computer
lab when preparing teaching material, and the newest version
otherwise.

If I ever get the feeling that all these points are easily achievable
with the compiled packages (without having to play around with docker,
sandboxes etc), I would stop compiling R from source.

> Moreover I'd always had the impression that the version of R provided
> by the package manager persistently lags one or two releases behind
> the current version.

>From the official repositories, yes.  But CRAN provides since longer
than I can remember up-to-date binary packages for the most common
Linux distributions.  AFAIK, Debian and Ubuntu packages are available
thanks to Dirk Eddelbuettel (initially? mainly?) and others.

> The process for installing R using the package manager is far from 
> straightforward and few people give clear instructions on this issue.

1.) Start a web browser
2.) Go to your favourite CRAN server
3.) Select 'Download R for Linux'
4.) Select the directory "ubuntu/" from the page that is served
5.) Select README.html from the page that is served
6.) Follow the instructions

> (Instructions are usually incomplete and full of jargon and acronyms 
> that the instructors blithely assume assume that the instructees 
> understand.  

I am sure (some) of my students have the same complains about my
lecturing   

> (They *don't*! In this instance (mirabile dictu!) I managed (using
> Uncle Google) 

You were lucky in this case, usually Uncle Google serves me with
somewhat out-dated (if not wrong) information when I run into a
technical problem with linux.

> to find very clear and explicit instructions at:
> 
> https://www.digitalocean.com/community/tutorials/how-to-install-r-on-ubuntu-18-04-quickstart
> 
> I followed these instructions, and everything went swimmingly. 

You were lucky that you are not sitting behind a firewall (as I seem to
be, not sure whom I have to thank for that).  For me the first step
(installing the GPG key) fails and some further googling was
necessary.  Though, I was working from the CRAN instructions.

> Interestingly (???) the "new" R was installed in /usr/bin and not in 
> /usr/local/bin.

Of course, it is a system Ubuntu package, so it installs to /usr/bin.

> I then tried issuing the command:
> 
>  rstudio
> 
> Exactly the same pop-up error.  No help at all, as I expected.

O.k., as I got a new machine, I installed (X)ubuntu 18.04 from scratch,
no update from an earlier version.  The R version installed from
r-base-core was R 3.4.4.  In a terminal in which I manipulated my PATH
variable so that /usr/bin is early on, I could start R without problem,
and I could start rstudio without problem.

After following the instructions on CRAN and updating my apt
information, I have now R 3.5.1 installed.  And it starts fine from the
command line as does rstudio.  And rstudio starts now with R 3.5.1.

Both these packages work out of the box.  Thus I wonder whether you
have somehow messed up your system during the attempt to install R from
source.  Or have some environment variables set that provide rstudio
with wrong information

> Then finally, in desperation, I copied libR.so from /usr/lib/R/lib to
> /usr/lib64/R/lib.  Bingo!!!  I can now start Rstudio!!!

I keep wondering why you have a /usr/lib64.

On my Ubuntu boxes, in /usr I have /lib, /lib32 and /libx32, but no
lib64.  As far as I know, Debian/Ubuntu 64bit implementations always
used /usr/lib for its 64 bit libraries and /usr/lib32 for the 32 bit
versions (unlike other distributions who used /usr/lib64 for the former
and /usr/lib for the latter).

In fact, a 'locate /lib64' on my Ubuntu 18.04 system (less than 2 week
old fresh installation) shows:

/lib64
/lib64/ld-

Re: [R] installing R 3.5.1

2018-08-25 Thread Berwin A Turlach
Dear Bogdan,

On Sat, 25 Aug 2018 07:24:40 -0700
Bogdan Tanasa  wrote:

> installed E: Unable to correct problems, you have held broken
> packages.

Perhaps this is the problem, did you try "apt-get -f install"?

Cheers,

Berwin

__
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] installing R 3.5.1

2018-08-25 Thread Bogdan Tanasa
Dear Berwin, thank you very much . I guess that I shall update my Ubuntu OS
;

after "sudo apt-get -f install", I am getting the same message :

The following packages have unmet dependencies:
 r-recommended : Depends: r-cran-kernsmooth (>= 2.2.14) but it is not going
to be installed
 Depends: r-cran-mass but it is not going to be installed
 Depends: r-cran-class but it is not going to be installed
 Depends: r-cran-nnet but it is not going to be installed
E: Unable to correct problems, you have held broken packages.


On Sat, Aug 25, 2018 at 8:02 AM, Berwin A Turlach 
wrote:

> Dear Bogdan,
>
> On Sat, 25 Aug 2018 07:24:40 -0700
> Bogdan Tanasa  wrote:
>
> > installed E: Unable to correct problems, you have held broken
> > packages.
>
> Perhaps this is the problem, did you try "apt-get -f install"?
>
> Cheers,
>
> Berwin
>

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


Re: [R] Multiple counters in a single for loop

2018-08-25 Thread Jeff Newmiller
look at the map2 function in the purrr package.

On August 24, 2018 6:44:19 AM PDT, Deepa  wrote:
>Hello,
>
>Is there an option to include multiple counters in a single for loop in
>R?
>
>For instance, in python there is
>
>for i,j in zip(x,range(0,len(x))):
>
>
>Any suggestions?
>
>   [[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.

-- 
Sent from my phone. Please excuse my brevity.

__
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] Multiple counters in a single for loop

2018-08-25 Thread jeremiejuste
Hello,
I'm aware it is not the answer you are expecting but indexes are not that bad 
to implement as well.

for ( i in 1:length(var1)){
elem1 <-var1[i]
elem2 <-  var2[i]


}

if you want more abstraction you could then wrap that up in a function

HTHOn 25 Aug 2018 18:57, Jeff Newmiller  wrote:
>
> look at the map2 function in the purrr package. 
>
> On August 24, 2018 6:44:19 AM PDT, Deepa  wrote: 
> >Hello, 
> > 
> >Is there an option to include multiple counters in a single for loop in 
> >R? 
> > 
> >For instance, in python there is 
> > 
> >for i,j in zip(x,range(0,len(x))): 
> > 
> > 
> >Any suggestions? 
> > 
> > [[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. 
>
> -- 
> Sent from my phone. Please excuse my brevity. 
>
> __ 
> 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] Multiple counters in a single for loop

2018-08-25 Thread Duncan Murdoch

On 25/08/2018 1:47 PM, jeremieju...@gmail.com wrote:

Hello,
I'm aware it is not the answer you are expecting but indexes are not that bad 
to implement as well.

for ( i in 1:length(var1)){


This is generally a bad idea:  if length(var1) == 0, it does the wrong 
thing, since 1:0 is c(1L, 0L).  Better to use


for ( i in seq_along(var1) ) {

Duncan Murdoch


elem1 <-var1[i]
elem2 <-  var2[i]


}

if you want more abstraction you could then wrap that up in a function

HTHOn 25 Aug 2018 18:57, Jeff Newmiller  wrote:


look at the map2 function in the purrr package.

On August 24, 2018 6:44:19 AM PDT, Deepa  wrote:

Hello,

Is there an option to include multiple counters in a single for loop in
R?

For instance, in python there is

for i,j in zip(x,range(0,len(x))):


Any suggestions?

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


--
Sent from my phone. Please excuse my brevity.

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



__
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] Plots in ioslides and R markdown

2018-08-25 Thread Patrick Connolly
On Sat, 25-Aug-2018 at 07:53AM -0400, Duncan Murdoch wrote:

|> On 25/08/2018 6:21 AM, Patrick Connolly wrote:
|> >---
|> >title: "Barking up the wrong tree"
|> >author: "Patrick Connolly"
|> >date: "`r format(Sys.time(), '%a %d/%m/%Y %H:%M')`"
|> >output:
|> >   ioslides_presentation: default
|> >   slidy_presentation: default
|> >   beamer_presentation: default
|> >---
|> >
|> >```{r global_options, echo=FALSE}
|> >knitr::opts_chunk$set(tidy=TRUE,
|> >   warning=FALSE,
|> >   message=FALSE,
|> >   cache=FALSE,
|> >   dpi = 300)
|> 
|> Drop the dpi setting and it will work fine.

Still doesn't avoid what I think is the issue with Cairo

   Error in axis(side = side, at = at, labels = labels, ...) : X11
  font -adobe-helvetica-%s-%s-*-*-%d-*-*-*-*-*-*-*, face 1 at size 12
  could not be loaded Calls:  ... plot.default -> localAxis
  -> Axis -> Axis.default -> axis

  Execution halted


For interactive plotting, Rstudio plots those 6 plots on one page so
no issue is apparent, as it will if I use a pdf device within ESS.
However, when plotting interactively in ESS, a basic font is used for
the labels which is OK for preliminary quick look.  No error message
is shown, but I suspect that it is defaulting to a crude font because
the helvetica font is not available.

It appears to me that the font problem doesn't arise with Rstudio
unless the desired output is ioslides.  Which brings us back to the
issue with Cairo.  There are lots of hits when I search for
configuring fonts, Cairo and R but I've not found anything I can use.

I would appreciate pointers where I can find useful information.

Thank you.

|> 
|> Duncan Murdoch
|> 
|> >```
|> >## 6 different Regression Trees
|> >
|> >```{r 6 different Regression Trees, echo = FALSE, messages=FALSE, fig.width 
= 7, fig.height = 5}
|> >
|> >  par(mfrow = c(2, 3))
|> >plot(1:10)
|> >plot(12:4)
|> >plot(seq(0, 800))
|> >plot(-100:-900)
|> >plot(12:50)
|> >plot(90:54)
|> >```

-- 
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.   
   ___Patrick Connolly   
 {~._.~}   Great minds discuss ideas
 _( Y )_ Average minds discuss events 
(:_~*~_:)  Small minds discuss people  
 (_)-(_)  . Eleanor Roosevelt
  
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.

__
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] Plots in ioslides and R markdown

2018-08-25 Thread Duncan Murdoch

On 25/08/2018 7:37 PM, Patrick Connolly wrote:

On Sat, 25-Aug-2018 at 07:53AM -0400, Duncan Murdoch wrote:

|> On 25/08/2018 6:21 AM, Patrick Connolly wrote:
|> >---
|> >title: "Barking up the wrong tree"
|> >author: "Patrick Connolly"
|> >date: "`r format(Sys.time(), '%a %d/%m/%Y %H:%M')`"
|> >output:
|> >   ioslides_presentation: default
|> >   slidy_presentation: default
|> >   beamer_presentation: default
|> >---
|> >
|> >```{r global_options, echo=FALSE}
|> >knitr::opts_chunk$set(tidy=TRUE,
|> >   warning=FALSE,
|> >   message=FALSE,
|> >   cache=FALSE,
|> >   dpi = 300)
|>
|> Drop the dpi setting and it will work fine.

Still doesn't avoid what I think is the issue with Cairo

Error in axis(side = side, at = at, labels = labels, ...) : X11
   font -adobe-helvetica-%s-%s-*-*-%d-*-*-*-*-*-*-*, face 1 at size 12
   could not be loaded Calls:  ... plot.default -> localAxis
   -> Axis -> Axis.default -> axis

   Execution halted


For interactive plotting, Rstudio plots those 6 plots on one page so
no issue is apparent, as it will if I use a pdf device within ESS.


So use RStudio, don't use ESS.


However, when plotting interactively in ESS, a basic font is used for
the labels which is OK for preliminary quick look.  No error message
is shown, but I suspect that it is defaulting to a crude font because
the helvetica font is not available.

It appears to me that the font problem doesn't arise with Rstudio
unless the desired output is ioslides.  Which brings us back to the
issue with Cairo.  There are lots of hits when I search for
configuring fonts, Cairo and R but I've not found anything I can use.



I don't see a font problem in MacOS.  I don't think you've stated what 
system you are using (but I may have missed it).


Duncan Murdoch


I would appreciate pointers where I can find useful information.

Thank you.

|>
|> Duncan Murdoch
|>
|> >```
|> >## 6 different Regression Trees
|> >
|> >```{r 6 different Regression Trees, echo = FALSE, messages=FALSE, fig.width 
= 7, fig.height = 5}
|> >
|> >  par(mfrow = c(2, 3))
|> >plot(1:10)
|> >plot(12:4)
|> >plot(seq(0, 800))
|> >plot(-100:-900)
|> >plot(12:50)
|> >plot(90:54)
|> >```



__
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] R shared library (/usr/lib64/R/lib/libR.so) not found.

2018-08-25 Thread Rolf Turner



On 08/26/2018 02:59 AM, Berwin A Turlach wrote:


G'day Rolf,

On Sat, 25 Aug 2018 11:20:09 +1200
Rolf Turner  wrote:


I was pretty sure that the foregoing was a complete red herring.  And
I was right.


I am not sure whether I agree. :)


Huh?  Black is white and up is down???

I did as advised and it made absolutely no difference.  Ergo  I was right.




I keep wondering why you have a /usr/lib64.




 How did you get this? 


I have no idea.  It just seems to be there.  And it seems that rstudio 
thinks that it should be there.



And why does rstudio think it has to look into that directory?

How would I know?  You would have to ask RStudio, not me.

Anyway, I seem to have (for the time being at least) a working system, 
and I don't feel like wasting any more time on this issue.


cheers,

Rolf

--
Technical Editor ANZJS
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276

__
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] R shared library (/usr/lib64/R/lib/libR.so) not found.

2018-08-25 Thread Berwin A Turlach
G'day Rolf,

On Sun, 26 Aug 2018 13:00:34 +1200
Rolf Turner  wrote:

> On 08/26/2018 02:59 AM, Berwin A Turlach wrote:
>
> > I am not sure whether I agree. :)  
> 
> Huh?  Black is white and up is down???

Nope, but as I said, on my machine RStudio and the R installed from the
Ubuntu repositories worked out of the box.

After adding the CRAN repositories to my apt configuration and
upgrading R, RStudio and the new R version worked again out of the box.

For the R versions that I compile from source, as I install sub
architectures, I need to install symbol links from where libR.so
actually is to where Rstudio expects them.  And RStudio works out of
the box with all these installation, i.e. it seems to follow symbolic
links.
 
> I did as advised and it made absolutely no difference.  Ergo  I was
> right.

That is your conclusion from the data, are you are perfectly entitled
to it. :)

I still think that this is one of the 5% of the cases where you got
your inference wrong.  Given that for me (and presumably many others
[but I neither follow r-sig-Debian nor the Rstudio forums, so I may
have a biased input]) everything works out of the box, my conclusion
from the data is that you have FUBAR'd your system.

Now, this can be from the way you tried to compile R from source (you
never told us what you exactly specified to ./configure, but we would
also have to know whether you made changes to config.site before
compilation) or it could be from some environment variables (set long
time ago and since forgotten [if so, where is it set ~/.bashrc? ~/.R?). 

> 
> 
> > I keep wondering why you have a /usr/lib64.  
> 
> 
> 
> >  How did you get this?   
> 
> I have no idea.  It just seems to be there.  And it seems that
> rstudio thinks that it should be there.

As far as I can tell, RStudio expects libR.so in a certain directory
relative to where the home directory (as reported by R on query) of R.
But RStudio's behaviour can also be influenced by environment variable.
 
So the fact that RStudio keeps looking at /usr/lib64 is for me evidence
that your system is compromised, and that RStudio is not starting the
version of R installed from the Ubuntu package manager.

> Anyway, I seem to have (for the time being at least) a working
> system, and I don't feel like wasting any more time on this issue.

Fair enough, but I am concerned that this issue will raise it head
sooner or later again.  So my final advice is to stick to the old adage
from sports: Never change a winning team.  If you system works for you
know, freeze it.  No more updates/upgrades.   Otherwise, good luck when
you try to update R next

Cheers,

Berwin

__
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] Plots in ioslides and R markdown

2018-08-25 Thread Jeff Newmiller
a) Duncan, he provided sessionInfo below his reprex.

b) Patrick: you appear to be trying to use a common file to generate multiple 
output formats. I will caution you that I have found considerable 
disappointment in trying that, and suggest that you focus your efforts on one 
output format for each Rmd file.

c) You can add out.width="100%" and out.height="100%" to your chunk to fix the 
scaling problem. This method is HTML-specific... you would need different 
strings for LaTeX output.

d) Note that the help files for the rmarkdown output functions are often very 
interesting. e.g.

?rmarkdown::ioslides_presentation

On August 25, 2018 5:10:14 PM PDT, Duncan Murdoch  
wrote:
>On 25/08/2018 7:37 PM, Patrick Connolly wrote:
>> On Sat, 25-Aug-2018 at 07:53AM -0400, Duncan Murdoch wrote:
>> 
>> |> On 25/08/2018 6:21 AM, Patrick Connolly wrote:
>> |> >---
>> |> >title: "Barking up the wrong tree"
>> |> >author: "Patrick Connolly"
>> |> >date: "`r format(Sys.time(), '%a %d/%m/%Y %H:%M')`"
>> |> >output:
>> |> >   ioslides_presentation: default
>> |> >   slidy_presentation: default
>> |> >   beamer_presentation: default
>> |> >---
>> |> >
>> |> >```{r global_options, echo=FALSE}
>> |> >knitr::opts_chunk$set(tidy=TRUE,
>> |> >   warning=FALSE,
>> |> >   message=FALSE,
>> |> >   cache=FALSE,
>> |> >   dpi = 300)
>> |>
>> |> Drop the dpi setting and it will work fine.
>> 
>> Still doesn't avoid what I think is the issue with Cairo
>> 
>> Error in axis(side = side, at = at, labels = labels, ...) : X11
>>font -adobe-helvetica-%s-%s-*-*-%d-*-*-*-*-*-*-*, face 1 at size
>12
>>could not be loaded Calls:  ... plot.default ->
>localAxis
>>-> Axis -> Axis.default -> axis
>> 
>>Execution halted
>> 
>> 
>> For interactive plotting, Rstudio plots those 6 plots on one page so
>> no issue is apparent, as it will if I use a pdf device within ESS.
>
>So use RStudio, don't use ESS.
>
>> However, when plotting interactively in ESS, a basic font is used for
>> the labels which is OK for preliminary quick look.  No error message
>> is shown, but I suspect that it is defaulting to a crude font because
>> the helvetica font is not available.
>> 
>> It appears to me that the font problem doesn't arise with Rstudio
>> unless the desired output is ioslides.  Which brings us back to the
>> issue with Cairo.  There are lots of hits when I search for
>> configuring fonts, Cairo and R but I've not found anything I can use.
>> 
>
>I don't see a font problem in MacOS.  I don't think you've stated what 
>system you are using (but I may have missed it).
>
>Duncan Murdoch
>
>> I would appreciate pointers where I can find useful information.
>> 
>> Thank you.
>> 
>> |>
>> |> Duncan Murdoch
>> |>
>> |> >```
>> |> >## 6 different Regression Trees
>> |> >
>> |> >```{r 6 different Regression Trees, echo = FALSE, messages=FALSE,
>fig.width = 7, fig.height = 5}
>> |> >
>> |> >  par(mfrow = c(2, 3))
>> |> >plot(1:10)
>> |> >plot(12:4)
>> |> >plot(seq(0, 800))
>> |> >plot(-100:-900)
>> |> >plot(12:50)
>> |> >plot(90:54)
>> |> >```
>> 

-- 
Sent from my phone. Please excuse my brevity.

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