Re: [R] PCRE configure problem with R-4.0.0
On Tue, 05-May-2020 at 06:28AM -0400, Ista Zahn wrote: |> |> |> > |> > Linux Mint 17.2 is based on Ubuntu 14.04, which has been released in |> > |> > April 2014, while PCRE2 has been released in 2015. |> > |> |> > |> Moreover, support for 17.2 ended over a year ago (according to |> > |> https://en.wikipedia.org/wiki/Linux_Mint_version_history). I suggest |> > |> upgrading to a supported version. |> > |> > Thanks for making that clear -- though I don't relish the hassle of |> > upgrading an OS. I was quite happy with the features of Mint 17.x. |> > |> |> Sure, but there is no free lunch and as your system gets older and |> older you'll find that more and more modern software doesn't work with |> it. Additionally there are increasing security risks because the |> vendor is no longer releasing security patches. |> |> That said, if you really really wanna, you can use |> https://docs.conda.io/en/latest/, https://spack.io/, or similar to |> install recent software releases on old systems. Thanks. Condo is a new one to me. |> |> Best, |> Ista |> |> > [...] |> > |> > |> > -- |> > ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. |> >___Patrick Connolly |> > {~._.~} Great minds discuss ideas |> > _( Y )_ Average minds discuss events |> > (:_~*~_:) Small minds discuss people |> > (_)-(_) . Eleanor Roosevelt |> > |> > ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___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] PCRE configure problem with R-4.0.0
On Mon, 04-May-2020 at 11:03AM -0400, Ista Zahn wrote: |> On Mon, May 4, 2020 at 3:51 AM Ivan Krylov wrote: |> > |> > First of all, you mentioned Linux Mint, so you might get better advice |> > on R-SIG-Debian mailing list. |> > |> > On Mon, 4 May 2020 16:15:42 +1200 |> > Patrick Connolly wrote: |> > |> > >There are quite a lot of packages in the repository for Linux Mint |> > >17.2 with 'pcre' in the name and these are installed: |> > |> > >Apparantly the '3' doesn't indicate an updated '2' version |> > |> > The funny thing about libpcre3 is that it is the old PCRE1 version, |> > third ABI-incompatible upgrade of it [*], and libpcre2 (available in |> > current releases of Linux Mint, Ubuntu and Debian) is supposed to be |> > the newer PCRE2. |> > |> > Linux Mint 17.2 is based on Ubuntu 14.04, which has been released in |> > April 2014, while PCRE2 has been released in 2015. |> |> Moreover, support for 17.2 ended over a year ago (according to |> https://en.wikipedia.org/wiki/Linux_Mint_version_history). I suggest |> upgrading to a supported version. Thanks for making that clear -- though I don't relish the hassle of upgrading an OS. I was quite happy with the features of Mint 17.x. [...] -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___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.
[R] PCRE configure problem with R-4.0.0
When I try ./configure --enable-R-shlib I get this error: configure: error: PCRE2 library and headers are required, or use --with-pcre1 and PCRE >= 8.32 with UTF-8 support I have to admit I'm completely in the dark as to what functionality PCRE provides. Next, I tried using --with-pcre1 but it made no difference. There are quite a lot of packages in the repository for Linux Mint 17.2 with 'pcre' in the name and these are installed: > aptitude search pcre | grep ^i i libpcre3- Perl 5 Compatible Regular Expression Libra i libpcre3:i386 - Perl 5 Compatible Regular Expression Libra i libpcre3-dev- Perl 5 Compatible Regular Expression Libra i libpcrecpp0 - Perl 5 Compatible Regular Expression Libra Apparantly the '3' doesn't indicate an updated '2' version. The only packages with prce2 in the name are these: > aptitude search pcre2 v apertium-pcre2 - v apertium-pcre2:i386 - Suggestions welcome. -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___ 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: [ESS] TWITTER API environment variables
G'day Ista, Thanks for setting me straight on that. I was misled by the fact that my username on this machine is pat. Something led me to believe that the twitter environment would be TWITTER_WORK but I don't have remote access to check (and be disabused of that notion). In any case, the problem seems to have vanished. I'm a bit uncomfortable not understanding why the problem arose and disappeared with no error message. I've wasted hours on this issue. Best Patrick On Thu, 09-Apr-2020 at 10:32AM -0400, Ista Zahn wrote: |> Hi Patrick, |> |> Are you sure you've diagnosed the issue correctly? From what I can see |> the name of the environment variable is always TWITTER_PAT, at least |> in the current rtweet release (0.7.0). get_tokens calls twitter_pat |> (https://github.com/ropensci/rtweet/blob/v0.7.0/R/tokens.R#L120) and |> twitter_pat hard-codes TWITTER_PAT |> (https://github.com/ropensci/rtweet/blob/v0.7.0/R/tokens.R#L371). In |> short I don't see anything suggesting that the name of the environment |> variable includes a user name at all. |> |> Best, |> Ista |> |> On Wed, Apr 8, 2020 at 7:22 PM Patrick Connolly via ESS-help |> wrote: |> > |> > |> > I'm using the rtweet package which makes use of the Twitter API which |> > requires a token alluded to by an environment variable. |> > |> > That environment variable is automatically set up from the Twitter web |> > site and takes the name TWITTER_ (where is the |> > name of the user in block letters). That worked fine on my work |> > computer where my username is 'work'. When I copied that working |> > directory to my home computer, the environment variable became |> > TWITTER_HOME but the rtweet package was looking for |> > TWITTER_WORK. There was no error message: just a null result from the |> > search_users() function. |> > |> > I tried editing the ~/.Renviron entry to |> > TWITTER_WORK=/home/home/.rtweet_token.rds |> > |> > That worked for a short time but soon ceased working. Then I noticed |> > a new entry had been automatically added to ~/.Renviron |> > |> > TWITTER_HOME=/home/home/.rtweet_token1.rds |> > |> > So now I had two environment variables which also worked for a short |> > time. |> > |> > No such problem arises if R is run from the bash prompt or Rstudio, |> > but editing functions is so clunky that way. I've used ESS for more |> > than 20 years and find it preferable. |> > |> > R-3.6.3, ESS 17.11 |> > |> > Any ideas what could be causing the token connexion being lost |> > appreciated. |> > |> > -- |> > ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. |> >___Patrick Connolly |> > {~._.~} Great minds discuss ideas |> > _( Y )_ Average minds discuss events |> > (:_~*~_:) Small minds discuss people |> > (_)-(_) . Eleanor Roosevelt |> > |> > ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. |> > |> > __ |> > ESS-help@r-project.org mailing list |> > https://stat.ethz.ch/mailman/listinfo/ess-help -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_ Average minds discuss events (:_~*~_:) Small minds discuss people (_)-(_) . Eleanor Roosevelt ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. __ ESS-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/ess-help
[ESS] TWITTER API environment variables
I'm using the rtweet package which makes use of the Twitter API which requires a token alluded to by an environment variable. That environment variable is automatically set up from the Twitter web site and takes the name TWITTER_ (where is the name of the user in block letters). That worked fine on my work computer where my username is 'work'. When I copied that working directory to my home computer, the environment variable became TWITTER_HOME but the rtweet package was looking for TWITTER_WORK. There was no error message: just a null result from the search_users() function. I tried editing the ~/.Renviron entry to TWITTER_WORK=/home/home/.rtweet_token.rds That worked for a short time but soon ceased working. Then I noticed a new entry had been automatically added to ~/.Renviron TWITTER_HOME=/home/home/.rtweet_token1.rds So now I had two environment variables which also worked for a short time. No such problem arises if R is run from the bash prompt or Rstudio, but editing functions is so clunky that way. I've used ESS for more than 20 years and find it preferable. R-3.6.3, ESS 17.11 Any ideas what could be causing the token connexion being lost appreciated. -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_ Average minds discuss events (:_~*~_:) Small minds discuss people (_)-(_) . Eleanor Roosevelt ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. __ ESS-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/ess-help
Re: [R] TWITTER API environment variables
Apart from allowing the twitter app access, I didn't do anything to adjust the settings other than editing the ~/.Renviron file which set up the environment variable/s. It appears to me that they are appropriate since they work if I use R from the bash prompt or Rstudio. The problem is apparantly with ESS. I really don't want to use Rstudio. It's so clunky to edit and debug functions, and of course, the bash CLI is even more clunky. I'll ask on the ESS list. On Wed, 08-Apr-2020 at 12:32PM +0300, K. Elo wrote: |> Hi again, |> |> ok, I see. How about repeating the steps described in the tutorial on |> your second computer instead of cloning the settings from the computer |> #1? There might be some other settings not correctly copied. |> |> HTH, |> Kimmo |> |> ke, 2020-04-08 kello 19:02 +1200, Patrick Connolly kirjoitti: |> > Hello Kimmo, |> > |> > Yes. I did that and it worked fine -- as far as it goes. But it |> > didn't cover what to do when using the same twitter account on a |> > computer with a different user name -- which is what my question was |> > about. |> > |> > |> > On Wed, 08-Apr-2020 at 08:55AM +0300, K. Elo wrote: |> > |> > > > Hi! |> > > > |> > > > Have you already read this: |> > > > |> > > > |> https://cran.r-project.org/web/packages/rtweet/vignettes/auth.html |> > > > |> > > > I think they explain rather well how to use Twitter tokens with |> > > > rtweet... |> > > > |> > > > HTH, |> > > > Kimmo |> > > > |> > > > ke, 2020-04-08 kello 17:19 +1200, Patrick Connolly kirjoitti: |> > > > > I'm using the rtweet package which makes use of the Twitter API |> > > > > which |> > > > > requires a token alluded to by an environment variable. |> > > > > |> > > > > That environment variable is automatically set up from the |> > > > > Twitter |> > > > > web |> > > > > site and takes the name TWITTER_ (where is |> > > > > the |> > > > > name of the user in block letters). That worked fine on my |> > > > > work |> > > > > computer where my username is 'work'. When I copied that |> > > > > working |> > > > > directory to my home computer, the environment variable became |> > > > > TWITTER_HOME but the rtweet package was looking for |> > > > > TWITTER_WORK. There was no error message: just a null result |> > > > > from the |> > > > > search_users() function. |> > > > > |> > > > > I tried editing the ~/.Renviron entry to |> > > > > TWITTER_WORK=/home/home/.rtweet_token.rds |> > > > > |> > > > > That worked for a short time but soon ceased working. Then I |> > > > > noticed |> > > > > a new entry had been automatically added to ~/.Renviron |> > > > > |> > > > > TWITTER_HOME=/home/home/.rtweet_token1.rds |> > > > > |> > > > > So now I had two environment variables which also worked for a |> > > > > short |> > > > > time. |> > > > > |> > > > > Recommendations please. -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___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] TWITTER API environment variables
Hello Kimmo, Yes. I did that and it worked fine -- as far as it goes. But it didn't cover what to do when using the same twitter account on a computer with a different user name -- which is what my question was about. On Wed, 08-Apr-2020 at 08:55AM +0300, K. Elo wrote: |> Hi! |> |> Have you already read this: |> |> https://cran.r-project.org/web/packages/rtweet/vignettes/auth.html |> |> I think they explain rather well how to use Twitter tokens with |> rtweet... |> |> HTH, |> Kimmo |> |> ke, 2020-04-08 kello 17:19 +1200, Patrick Connolly kirjoitti: |> > I'm using the rtweet package which makes use of the Twitter API which |> > requires a token alluded to by an environment variable. |> > |> > That environment variable is automatically set up from the Twitter |> > web |> > site and takes the name TWITTER_ (where is the |> > name of the user in block letters). That worked fine on my work |> > computer where my username is 'work'. When I copied that working |> > directory to my home computer, the environment variable became |> > TWITTER_HOME but the rtweet package was looking for |> > TWITTER_WORK. There was no error message: just a null result from the |> > search_users() function. |> > |> > I tried editing the ~/.Renviron entry to |> > TWITTER_WORK=/home/home/.rtweet_token.rds |> > |> > That worked for a short time but soon ceased working. Then I noticed |> > a new entry had been automatically added to ~/.Renviron |> > |> > TWITTER_HOME=/home/home/.rtweet_token1.rds |> > |> > So now I had two environment variables which also worked for a short |> > time. |> > |> > Recommendations please. |> > |> |> __ |> 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. -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___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.
[R] TWITTER API environment variables
I'm using the rtweet package which makes use of the Twitter API which requires a token alluded to by an environment variable. That environment variable is automatically set up from the Twitter web site and takes the name TWITTER_ (where is the name of the user in block letters). That worked fine on my work computer where my username is 'work'. When I copied that working directory to my home computer, the environment variable became TWITTER_HOME but the rtweet package was looking for TWITTER_WORK. There was no error message: just a null result from the search_users() function. I tried editing the ~/.Renviron entry to TWITTER_WORK=/home/home/.rtweet_token.rds That worked for a short time but soon ceased working. Then I noticed a new entry had been automatically added to ~/.Renviron TWITTER_HOME=/home/home/.rtweet_token1.rds So now I had two environment variables which also worked for a short time. Recommendations please. -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___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] The "--slave" option
On Wed, 18-Sep-2019 at 02:58PM -0700, Jeff Newmiller wrote: |> I think there is no confusion except in the minds of those with |> nothing better to do. I agree with Antirez, quoted in [1], which |> nevertheless indicates that perspective lost the debate. I agree with Jeff. Automotive hydraulics have used terms such as 'master-cylinders' and 'slave-cylinders' without such an issue for a century or more. If we have nothing else to do, we might want to purge ESS of its so-called 'inferior processes', but it ain't me, Babe. BTW: I've used R for 20+ years and never used a --slave option. Should I get an award? |> Any accurate alternative notation will have similar connotations |> because in fact the "slave" side of that relationship is completely |> subordinate to the "master" side... there is no escaping that |> fact. It requires a very different and more complicated |> architecture to achieve a "peer" relationship, which often is not |> worth the effort or even appropriate. |> So while Dr Lang may be mollified by a change in notation, someone |> else is going to find the new words offensive and make the same PC |> argument since the implications of the architecture have not |> changed. In fact there should never have been a parallel drawn |> between the morality of human slavery and computing architectures |> to begin with. |> [1] https://www.vice.com/en_us/article/8x7akv/masterslave-terminology-was-removed-from-python-programming-language |> |> On September 18, 2019 11:57:32 AM PDT, "Patrick (Malone Quantitative)" wrote: |> >For what it's worth, this is an ongoing conversation in computer |> >science and engineering. And has been so for decades. |> > |> >Not R, but related to this it's only in the past few months that a |> >fork of the photo-manipulation software GIMP (slur for handicapped) |> >renames it (GLIMPSE). |> > |> >Note, I am not saying this isn't a battle worth fighting. |> > |> >On Wed, Sep 18, 2019 at 1:52 PM Benjamin Lang |> >wrote: |> >> |> >> Dear R project, |> >> |> >> I have a very simple question: |> >> |> >> How, in late 2019, is there an option called "--slave" to "make R run |> >as |> >> quietly as possible"? |> >> |> >> Let me reiterate that it is 2019, i.e. "The Future", rather than 1970 |> >when |> >> R was presumably developed, based on its atrocious syntax, |> >documentation |> >> and usability (I think I only need to say "NaN", "NULL", and "NA"). |> >> |> >> This is a disgrace and it should have been addressed one or two |> >decades |> >> ago. Why not just "--quiet"? |> >> |> >> Please do not mention "backwards compatibility". For the historically |> >> inclined, it does not make much of a difference whether the term |> >evokes the |> >> Roman, Greek, American or modern kind of slavery for you: it is as |> >> disgusting as it gets. |> >> |> >> Thank you, |> >> Ben |> >> |> >> -- |> >> Benjamin Lang, PhD |> >> http://orcid.org/-0001-6358-8380 |> >> |> >> Marie Sklodowska-Curie Postdoctoral Fellow (MSCA-IF) |> >> Gene Function and Evolution (Dr. Gian Tartaglia) |> >> Centre for Genomic Regulation (CRG), Barcelona, Spain |> >> |> >> [[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. |> > |> >__ |> >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. -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___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] Bounding box on plotting files inserted into a LaTeX document
On Thu, 16-May-2019 at 07:52PM -0400, Marc Schwartz wrote: |> |> |> > On May 16, 2019, at 7:04 PM, Patrick Connolly wrote: |> > [...] |> |> |> Patrick, |> |> Are you explicitly calling postscript() in an R session to create the figure? |> |> If so, see the Details section of ?postscript, which notes the following: |> |> The postscript produced for a single R plot is EPS (Encapsulated |> PostScript) compatible, and can be included into other documents, |> e.g., into LaTeX, using \includegraphics{}. For use in |> this way you will probably want to use setEPS() to set the defaults |> as horizontal = FALSE, onefile = FALSE, paper = "special". Note |> that the bounding box is for the device region: if you find the |> white space around the plot region excessive, reduce the margins of |> the figure region via par(mar = ). |> So essentially: |> |> postscript("YourPlot.eps", width = 6.0, height = 6.0, |>horizontal = FALSE, onefile = FALSE, paper = "special") I failed to understand what the 'onefile' argument was about. I thought I needed it to be TRUE because I was making a single plot in a single file. :-( I knew there was something simple I was missing. I would have noticed it if I'd read that Details section properly. |> |> Plot code here... |> |> dev.off() |> |> |> |> Note that instead of pdflatex, you can also use latex, followed by |> dvips and then ps2pdf, if you want to go that way with the CLI |> workflow. Might depend upon whether or not you use other PS |> specific markup in the .tex file, like pstricks. For example: I used to have a little shell script that did the dvips and ps2pdf but I recently found that pdflatex seems to do that anyway, so I thought that was easier and more transportable. Thanks, Marc. |> latex YourTeXFile.tex |> dvips YourTeXFile -o YourTexFile.ps |> ps2pdf YourTeXFile.ps YourTeXFile.pdf |> |> |> Regards, |> |> Marc Schwartz |> -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___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.
[R] Bounding box on plotting files inserted into a LaTeX document
I'm trying to write basic latex code to insert a pdf graphic into a document. I can use Rstudio to knit an Rmd file successfully inserting the plot into the document. I can get the latex code if the "save tex" box is ticked, so I get the correct syntax used. I don't need all the fancy things that .Rmd files can handle. I just want a simple .tex file. However, if I try to use a pdf file normally produced by using the pdf device, I get a message about a missing bounding box. So I thought it might work to use R to make an eps file, which pdflatex automatically converts to a pdf. It does import the graphic, but it takes up a whole page, which indicates that it ignores the bounding box. What does work is to use Rstudio interactively to export the graphic to a pdf file which pdflatex handles correctly. But that's a clunky procedure which I'd like to avoid. It must be possible since graphs were included in LaTeX documents for decades before there was Rstudio. TIA -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___ 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] Debugging Rmarkdown
knitr::purl -- thats a great tip! As soon as got hold of a reqular .R script, I spotted the reason why my Fmd file wouldn't knit in a matter of seconds. Thank you Jeff. Thanks also to all the other suggestions. On Fri, 19-Apr-2019 at 02:44PM -0700, Jeff Newmiller wrote: |> I just run each chunk in sequence starting from an fresh restart of |> R by copying code to the R console. However you can use knitr::purl |> to extract all of the code into a regular R script to do whatever |> debugging you are most familiar with. |> On April 19, 2019 2:03:00 PM PDT, Patrick Connolly wrote: |> > |> >On 19/04/19 12:13 AM, Thierry Onkelinx wrote: |> >> Dear Patrick, |> >> |> >> This is not easy to debug without a reprex |> >> |> >> I would check the content of zzz and wide.i in the loop |> >> |> >> str(wide.i) |> >> zzz <- rbind(zzz, wide.i) |> >> str(zzz) |> >> |> >That's just what I'm trying to achieve but the debugging doesn't work |> >how it does with regular R code. |> > |> >> Note that the Rmd always runs in a clean environment. This might |> >> explain the difference |> >> |> >The data frames xx and yy are defined in earlier code chunks. Maybe I |> >need to define them again. |> > |> > |> >I'll look closer at it after Easter. |> > |> > |> >Thanks for the suggestion. |> > |> >> Best regards, |> >> |> >> ir. Thierry Onkelinx |> >> Statisticus / Statistician |> >> |> >> Vlaamse Overheid / Government of Flanders |> >> INSTITUUT VOOR NATUUR- EN BOSONDERZOEK / RESEARCH INSTITUTE FOR |> >NATURE |> >> AND FOREST |> >> Team Biometrie & Kwaliteitszorg / Team Biometrics & Quality Assurance |> >> thierry.onkel...@inbo.be <mailto:thierry.onkel...@inbo.be> |> >> Havenlaan 88 bus 73, 1000 Brussel |> >> www.inbo.be <http://www.inbo.be> |> >> |> >> |> >/// |> >> To call in the statistician after the experiment is done may be no |> >> more than asking him to perform a post-mortem examination: he may be |> >> able to say what the experiment died of. ~ Sir Ronald Aylmer Fisher |> >> The plural of anecdote is not data. ~ Roger Brinner |> >> The combination of some data and an aching desire for an answer does |> >> not ensure that a reasonable answer can be extracted from a given |> >body |> >> of data. ~ John Tukey |> >> |> >/// |> >> |> >> <https://www.inbo.be> |> >> |> >> |> >> Op do 18 apr. 2019 om 11:53 schreef Patrick Connolly |> >> mailto:p_conno...@slingshot.co.nz>>: |> >> |> >> I have a function that works in ESS, but it fails if I include it |> >in |> >> an .Rmd file that I tried to knit using Rstudio. I found advice |> >at: |> >> |> >https://www.rstudio.com/products/rstudio/release-notes/debugging-with-rstudio/ |> >> |> >> It seems to be not referring to markdown files. Somewhere else |> >> suggested calling render() in the console pane. I tried that. |> >The |> >> browser() function interrupts correctly, but I can't find out |> >what the |> >> object zzz in the code below looks like. Nothing prints the way |> >it |> >> would in a "normal" R buffer. |> >> |> >> code outline: making zzz out of two dataframes xx and yy |> >> |> >> ## |> >> zzz <- NULL |> >> for(i in xx$Sample){ |> >> raw.i <- |> >> |> >> etc. etc. |> >> |> >> zzz <- rbind(zzz, wide.i) |> >> } |> >> browser() |> >> |> >> names(zzz) <- c("Cultivar", "Test", "Change") |> >> That line fails, with a complaint about zzz being NULL. |> >> |> >> It appears as though the rbind doesn't do anything, but I can't |> >see |> >> what wide.i looks like to get an idea what could be the cause. |> >> |> >> Ideas what I should try are welcome. I have no idea why the code |> >> works in an R environment but not an Rmd one. |> >> |> >> |> >> R-3.5.2, |> >> platform x86_64-pc-linux-gnu |> >>
Re: [R] Debugging Rmarkdown
There are options to set echo and messages but AFAIK, the text appears in the resultant file, but if the script fails, there's no file to inspect. On 20/04/19 9:50 AM, Bert Gunter wrote: > This might be offbase, but do you need to set options to cache the > results in the original code chunks to reuse in later chunks? (I > haven't worked with knitr lately, so this may be nonsense). > > Cheers, > Bert > > On Fri, Apr 19, 2019 at 2:03 PM Patrick Connolly > mailto:p_conno...@slingshot.co.nz>> wrote: > > > On 19/04/19 12:13 AM, Thierry Onkelinx wrote: > > Dear Patrick, > > > > This is not easy to debug without a reprex > > > > I would check the content of zzz and wide.i in the loop > > > > str(wide.i) > > zzz <- rbind(zzz, wide.i) > > str(zzz) > > > That's just what I'm trying to achieve but the debugging doesn't work > how it does with regular R code. > > > Note that the Rmd always runs in a clean environment. This might > > explain the difference > > > The data frames xx and yy are defined in earlier code chunks. Maybe I > need to define them again. > > > I'll look closer at it after Easter. > > > Thanks for the suggestion. > > > Best regards, > > > > ir. Thierry Onkelinx > > Statisticus / Statistician > > > > Vlaamse Overheid / Government of Flanders > > INSTITUUT VOOR NATUUR- EN BOSONDERZOEK / RESEARCH INSTITUTE FOR > NATURE > > AND FOREST > > Team Biometrie & Kwaliteitszorg / Team Biometrics & Quality > Assurance > > thierry.onkel...@inbo.be <mailto:thierry.onkel...@inbo.be> > <mailto:thierry.onkel...@inbo.be <mailto:thierry.onkel...@inbo.be>> > > Havenlaan 88 bus 73, 1000 Brussel > > www.inbo.be <http://www.inbo.be> <http://www.inbo.be> > > > > > > /// > > To call in the statistician after the experiment is done may be no > > more than asking him to perform a post-mortem examination: he > may be > > able to say what the experiment died of. ~ Sir Ronald Aylmer Fisher > > The plural of anecdote is not data. ~ Roger Brinner > > The combination of some data and an aching desire for an answer > does > > not ensure that a reasonable answer can be extracted from a > given body > > of data. ~ John Tukey > > > > /// > > > > <https://www.inbo.be> > > > > > > Op do 18 apr. 2019 om 11:53 schreef Patrick Connolly > > mailto:p_conno...@slingshot.co.nz> > <mailto:p_conno...@slingshot.co.nz > <mailto:p_conno...@slingshot.co.nz>>>: > > > > I have a function that works in ESS, but it fails if I > include it in > > an .Rmd file that I tried to knit using Rstudio. I found > advice at: > > > > https://www.rstudio.com/products/rstudio/release-notes/debugging-with-rstudio/ > > > > It seems to be not referring to markdown files. Somewhere else > > suggested calling render() in the console pane. I tried > that. The > > browser() function interrupts correctly, but I can't find > out what the > > object zzz in the code below looks like. Nothing prints the > way it > > would in a "normal" R buffer. > > > > code outline: making zzz out of two dataframes xx and yy > > > > ## > > zzz <- NULL > > for(i in xx$Sample){ > > raw.i <- > > > > etc. etc. > > > > zzz <- rbind(zzz, wide.i) > > } > > browser() > > > > names(zzz) <- c("Cultivar", "Test", "Change") > > That line fails, with a complaint about zzz being NULL. > > > > It appears as though the rbind doesn't do anything, but I > can't see > > what wide.i looks like to get an idea what could be the cause. > > > > Ideas what I should try are welcome. I have no idea why the > code > > works in an R environment but not an R
Re: [R] Debugging Rmarkdown
On 19/04/19 12:13 AM, Thierry Onkelinx wrote: > Dear Patrick, > > This is not easy to debug without a reprex > > I would check the content of zzz and wide.i in the loop > > str(wide.i) > zzz <- rbind(zzz, wide.i) > str(zzz) > That's just what I'm trying to achieve but the debugging doesn't work how it does with regular R code. > Note that the Rmd always runs in a clean environment. This might > explain the difference > The data frames xx and yy are defined in earlier code chunks. Maybe I need to define them again. I'll look closer at it after Easter. Thanks for the suggestion. > Best regards, > > ir. Thierry Onkelinx > Statisticus / Statistician > > Vlaamse Overheid / Government of Flanders > INSTITUUT VOOR NATUUR- EN BOSONDERZOEK / RESEARCH INSTITUTE FOR NATURE > AND FOREST > Team Biometrie & Kwaliteitszorg / Team Biometrics & Quality Assurance > thierry.onkel...@inbo.be <mailto:thierry.onkel...@inbo.be> > Havenlaan 88 bus 73, 1000 Brussel > www.inbo.be <http://www.inbo.be> > > /// > To call in the statistician after the experiment is done may be no > more than asking him to perform a post-mortem examination: he may be > able to say what the experiment died of. ~ Sir Ronald Aylmer Fisher > The plural of anecdote is not data. ~ Roger Brinner > The combination of some data and an aching desire for an answer does > not ensure that a reasonable answer can be extracted from a given body > of data. ~ John Tukey > /////// > > <https://www.inbo.be> > > > Op do 18 apr. 2019 om 11:53 schreef Patrick Connolly > mailto:p_conno...@slingshot.co.nz>>: > > I have a function that works in ESS, but it fails if I include it in > an .Rmd file that I tried to knit using Rstudio. I found advice at: > > https://www.rstudio.com/products/rstudio/release-notes/debugging-with-rstudio/ > > It seems to be not referring to markdown files. Somewhere else > suggested calling render() in the console pane. I tried that. The > browser() function interrupts correctly, but I can't find out what the > object zzz in the code below looks like. Nothing prints the way it > would in a "normal" R buffer. > > code outline: making zzz out of two dataframes xx and yy > > ## > zzz <- NULL > for(i in xx$Sample){ > raw.i <- > > etc. etc. > > zzz <- rbind(zzz, wide.i) > } > browser() > > names(zzz) <- c("Cultivar", "Test", "Change") > That line fails, with a complaint about zzz being NULL. > > It appears as though the rbind doesn't do anything, but I can't see > what wide.i looks like to get an idea what could be the cause. > > Ideas what I should try are welcome. I have no idea why the code > works in an R environment but not an Rmd one. > > > R-3.5.2, > platform x86_64-pc-linux-gnu > arch x86_64 > os linux-gnu > system x86_64, linux-gnu > > Rstudio Version 1.1.383 > > > > -- > ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. > > ___ Patrick Connolly > {~._.~} Great minds discuss ideas > _( Y )_ Average minds discuss events > (:_~*~_:) Small minds discuss people > (_)-(_) . Eleanor Roosevelt > > ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. > > __ > R-help@r-project.org <mailto: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. > [[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.
[R] Debugging Rmarkdown
I have a function that works in ESS, but it fails if I include it in an .Rmd file that I tried to knit using Rstudio. I found advice at: https://www.rstudio.com/products/rstudio/release-notes/debugging-with-rstudio/ It seems to be not referring to markdown files. Somewhere else suggested calling render() in the console pane. I tried that. The browser() function interrupts correctly, but I can't find out what the object zzz in the code below looks like. Nothing prints the way it would in a "normal" R buffer. code outline: making zzz out of two dataframes xx and yy ## zzz <- NULL for(i in xx$Sample){ raw.i <- etc. etc. zzz <- rbind(zzz, wide.i) } browser() names(zzz) <- c("Cultivar", "Test", "Change") That line fails, with a complaint about zzz being NULL. It appears as though the rbind doesn't do anything, but I can't see what wide.i looks like to get an idea what could be the cause. Ideas what I should try are welcome. I have no idea why the code works in an R environment but not an Rmd one. R-3.5.2, platform x86_64-pc-linux-gnu arch x86_64 os linux-gnu system x86_64, linux-gnu Rstudio Version 1.1.383 -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___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: [ESS] How to type an underscore "_" in emacs with ESS in a SAS program
On Thu, 11-Apr-2019 at 11:58AM -0600, Karen Taves via ESS-help wrote: |> I am new to using ESS and am using ESS 18.10.2 and trying to type |> an underscore "_" in emacs in a SAS program and am getting the |> following error message: Symbol's function definition is void: |> ess-smart-S-assign I don't know about SAS, but in R, typing a second underscore bypasses what normally happens, i.e. makes an assignment, i.e. " <- " (without the quotes). HTH |> |> I suspect that I need to add something to my .emacs file. |> My .emacs file as the following 2 lines (and I don’t understand the format of this file so need specific instruction): |> (add-to-list 'load-path "/home/scripts/ess-18.10.2/lisp") |> (load "ess-autoloads”) |> |> Thank you, |> Karen |> |> |> |> |> [[alternative HTML version deleted]] |> |> __ |> ESS-help@r-project.org mailing list |> https://stat.ethz.ch/mailman/listinfo/ess-help -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_ Average minds discuss events (:_~*~_:) Small minds discuss people (_)-(_) . Eleanor Roosevelt ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. __ ESS-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/ess-help
[R] BLUPS from lme models
The bottom of page 276 of the "Gold Book" Modern Applied Statistics by Venables and Ripley, 4th edition, the last sentence states: "Random effects are set either to zero or to their BLUP values." Am I correct in inferring from that, it amounts respectively to removing the random term from the model, or setting it as a fixed effect? To get something meaningful, one needs to choose which random effects are relevant to the topic under study? Thank you. -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___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] Corrupting files while copying (was Re: saveRDS() and readRDS() Why? [solved, pretty much anyway])
I'd be interested to know if anyone can replicate what I experienced. VBox version: 5.1.22 r115126 (Qt5.6.2) Versions of R and OSes below: On Sun, 18-Nov-2018 at 09:44PM +1300, Patrick Connolly wrote: |> Sequence of steps: |> |> Using R-3.5.1 and Windows 7 with the latest Rstudio, shared directory |> as working directory on Virtual Box host machine: |> |> > x <- airquality |> > saveRDS(x, file = "x.rds") |> > saveRDS(x, file = "y.rds") |> |> On guest machine Mint Linux 17.3, KDE desktop, copy x.rds & y.rds to |> working directory PWD using file manager Dolphin. |> |> (Don't have the precise version of VirtualBox right now.) Update: VBox version: 5.1.22 r115126 (Qt5.6.2) |> |> > x <- readRDS(file = "x.rds") |> Error in readRDS(file = "x.rds") : error reading from connection |> > x <- readRDS(file = "y.rds") |> |> > tools::md5sum(c("x.rds", "y.rds")) |> x.rds y.rds |> "5fef054848f39b4be02b7c54f1c71a20" "978a64d1dd342d16a381c9ca728d3665" |> |> Yet, if instead of using Dolphin, use bash commands from the shared |> directory |> |> $ cp *.rds ~/PWD/ |> |> no error reading from the connection or other differences between |> x.rds and y.rds. |> |> head(x) |> |> > head(datasets::airquality) |> Ozone Solar.R Wind Temp Month Day |> 141 190 7.4 67 5 1 |> 236 118 8.0 72 5 2 |> 312 149 12.6 74 5 3 |> 418 313 11.5 62 5 4 |> 5NA NA 14.3 56 5 5 |> 628 NA 14.9 66 5 6 |> > |> |> On Thu, 15-Nov-2018 at 09:53AM -0500, Ista Zahn wrote: |> |> |> Hi Patrick, |> |> |> |> I think it would help to start from the beginning and give complete |> |> (but concise!) replication instructions, including telling us what |> |> host and gest operating systems you are using (including the |> |> versions), the version |> |> of virtualbox you used, and exactly what steps are needed to |> |> reproduce the surprising behavior. |> |> |> |> Best, |> |> Ista |> |> On Wed, Nov 14, 2018 at 2:36 AM Patrick Connolly |> |> wrote: |> |> > |> |> > Thanks William, |> |> > |> |> > I've used Dolphin for years and never encountered that phenomenon. |> |> > Even so, that description doesn't fit what's going on here. 1.7 |> |> > kilobytes is hardly a 'large directory'. |> |> > |> |> > The problem seems to be with the way VirtualBox mounts directories |> |> > which isn't an R issue, nor is the fact that copying from Linux to |> |> > Windows isn't affected. But the fact that it happens only with rds |> |> > files that use the name of the R object as part of their own names |> |> > must be an R issue (that surfaces only when other conditions are |> |> > present). |> |> > |> |> > Theories short of divine intervention appreciated. |> |> > |> |> > |> |> > |> |> > On Tue, 13-Nov-2018 at 02:22PM -0800, William Dunlap wrote: |> |> > |> |> > |> Perhaps you got bitten by Dolphin's non-modal dialogs, as described in |> |> > |> https://userbase.kde.org/Dolphin/File_Management: |> |> > |> |> |> > |> Non Modal Dialogs |> |> > |> |> |> > |> When Moving, Copying or Deleting files/directories the dialog disappears |> |> > |> even when the operation has not yet completed. A progress bar then appears |> |> > |> in the bottom right of the screen, this then disappears also, if you want |> |> > |> see the progress you need to click a small (i) information icon in the |> |> > |> system tray. |> |> > |> |> |> > |> |> |> > |> Warning |> |> > |> New users who are not used to this way of working (and even experienced |> |> > |> users) can get caught out by this, if you are Moving, Copying or Deleting |> |> > |> large directories then you need to use the icon to monitor the progress of |> |> > |> your operation. If you don't then any subsequent actions you do, may well |> |> > |> use an incomplete file structure resulting in corrupted files. You have |> |> > |> been warned! |> |> > |> |> |> > |> Bill Dunlap |> |> > |> TIBCO Software |> |> > |> wdunlap tibco.com |> |> > |> |> |> > |> On Tue, Nov 13, 2018 at 2:10 PM, p_connolly |> |> > |&g
Re: [R] Corrupting files while copying (was Re: saveRDS() and readRDS() Why? [solved, pretty much anyway])
Sequence of steps: Using R-3.5.1 and Windows 7 with the latest Rstudio, shared directory as working directory on Virtual Box host machine: > x <- airquality > saveRDS(x, file = "x.rds") > saveRDS(x, file = "y.rds") On guest machine Mint Linux 17.3, KDE desktop, copy x.rds & y.rds to working directory PWD using file manager Dolphin. (Don't have the precise version of VirtualBox right now.) > x <- readRDS(file = "x.rds") Error in readRDS(file = "x.rds") : error reading from connection > x <- readRDS(file = "y.rds") > tools::md5sum(c("x.rds", "y.rds")) x.rds y.rds "5fef054848f39b4be02b7c54f1c71a20" "978a64d1dd342d16a381c9ca728d3665" Yet, if instead of using Dolphin, use bash commands from the shared directory $ cp *.rds ~/PWD/ no error reading from the connection or other differences between x.rds and y.rds. head(x) > head(datasets::airquality) Ozone Solar.R Wind Temp Month Day 141 190 7.4 67 5 1 236 118 8.0 72 5 2 312 149 12.6 74 5 3 418 313 11.5 62 5 4 5NA NA 14.3 56 5 5 628 NA 14.9 66 5 6 > On Thu, 15-Nov-2018 at 09:53AM -0500, Ista Zahn wrote: |> Hi Patrick, |> |> I think it would help to start from the beginning and give complete |> (but concise!) replication instructions, including telling us what |> host and gest operating systems you are using (including the |> versions), the version |> of virtualbox you used, and exactly what steps are needed to |> reproduce the surprising behavior. |> |> Best, |> Ista |> On Wed, Nov 14, 2018 at 2:36 AM Patrick Connolly |> wrote: |> > |> > Thanks William, |> > |> > I've used Dolphin for years and never encountered that phenomenon. |> > Even so, that description doesn't fit what's going on here. 1.7 |> > kilobytes is hardly a 'large directory'. |> > |> > The problem seems to be with the way VirtualBox mounts directories |> > which isn't an R issue, nor is the fact that copying from Linux to |> > Windows isn't affected. But the fact that it happens only with rds |> > files that use the name of the R object as part of their own names |> > must be an R issue (that surfaces only when other conditions are |> > present). |> > |> > Theories short of divine intervention appreciated. |> > |> > |> > |> > On Tue, 13-Nov-2018 at 02:22PM -0800, William Dunlap wrote: |> > |> > |> Perhaps you got bitten by Dolphin's non-modal dialogs, as described in |> > |> https://userbase.kde.org/Dolphin/File_Management: |> > |> |> > |> Non Modal Dialogs |> > |> |> > |> When Moving, Copying or Deleting files/directories the dialog disappears |> > |> even when the operation has not yet completed. A progress bar then appears |> > |> in the bottom right of the screen, this then disappears also, if you want |> > |> see the progress you need to click a small (i) information icon in the |> > |> system tray. |> > |> |> > |> |> > |> Warning |> > |> New users who are not used to this way of working (and even experienced |> > |> users) can get caught out by this, if you are Moving, Copying or Deleting |> > |> large directories then you need to use the icon to monitor the progress of |> > |> your operation. If you don't then any subsequent actions you do, may well |> > |> use an incomplete file structure resulting in corrupted files. You have |> > |> been warned! |> > |> |> > |> Bill Dunlap |> > |> TIBCO Software |> > |> wdunlap tibco.com |> > |> |> > |> On Tue, Nov 13, 2018 at 2:10 PM, p_connolly |> > |> wrote: |> > |> |> > |> > This is getting more strange. |> > |> > |> > |> > I normally copy from the shared folder to the appropriate directory using |> > |> > Dolphin, the KDE file manager. If instead I use the standard bash cp |> > |> > command, no corruption happens -- at least with the limited testing I have |> > |> > done. There also seems to be no problem copying from Linux to Windows. I |> > |> > installed R-3.5.1 for Windows just to eliminate that possible issue. |> > |> > |> > |> > However, R has *something* to do with it because it was used to make the |> > |> > .rds file. Just how the relationship between the name of the R object and |> > |> > the name of the .rds file comes into it, I can't imagine. |> > |> > |> > |> > Thanks
[R] Corrupting files while copying (was Re: saveRDS() and readRDS() Why? [solved, pretty much anyway])
Thanks William, I've used Dolphin for years and never encountered that phenomenon. Even so, that description doesn't fit what's going on here. 1.7 kilobytes is hardly a 'large directory'. The problem seems to be with the way VirtualBox mounts directories which isn't an R issue, nor is the fact that copying from Linux to Windows isn't affected. But the fact that it happens only with rds files that use the name of the R object as part of their own names must be an R issue (that surfaces only when other conditions are present). Theories short of divine intervention appreciated. On Tue, 13-Nov-2018 at 02:22PM -0800, William Dunlap wrote: |> Perhaps you got bitten by Dolphin's non-modal dialogs, as described in |> https://userbase.kde.org/Dolphin/File_Management: |> |> Non Modal Dialogs |> |> When Moving, Copying or Deleting files/directories the dialog disappears |> even when the operation has not yet completed. A progress bar then appears |> in the bottom right of the screen, this then disappears also, if you want |> see the progress you need to click a small (i) information icon in the |> system tray. |> |> |> Warning |> New users who are not used to this way of working (and even experienced |> users) can get caught out by this, if you are Moving, Copying or Deleting |> large directories then you need to use the icon to monitor the progress of |> your operation. If you don't then any subsequent actions you do, may well |> use an incomplete file structure resulting in corrupted files. You have |> been warned! |> |> Bill Dunlap |> TIBCO Software |> wdunlap tibco.com |> |> On Tue, Nov 13, 2018 at 2:10 PM, p_connolly |> wrote: |> |> > This is getting more strange. |> > |> > I normally copy from the shared folder to the appropriate directory using |> > Dolphin, the KDE file manager. If instead I use the standard bash cp |> > command, no corruption happens -- at least with the limited testing I have |> > done. There also seems to be no problem copying from Linux to Windows. I |> > installed R-3.5.1 for Windows just to eliminate that possible issue. |> > |> > However, R has *something* to do with it because it was used to make the |> > .rds file. Just how the relationship between the name of the R object and |> > the name of the .rds file comes into it, I can't imagine. |> > |> > Thanks for the suggestion William. |> > |> > |> > On 2018-11-14 06:26, William Dunlap wrote: |> > |> >> It seems like copying the files corrupted them. How did you copy them |> >> (with R |> >> or cp or copy or ftp, etc.)? I don't see how this has anything to do |> >> with R. |> >> |> >> Bill Dunlap |> >> TIBCO Software |> >> wdunlap tibco.com [1] |> >> On Mon, Nov 12, 2018 at 7:10 PM, p_connolly |> >> wrote: |> >> |> > [...] |> > |> > -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___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] saveRDS() and readRDS() Why? [solved, pretty much anyway)
The solution was very simple. Don't use the same name for the rds file as used for the R object, viz a vie: saveRDS(x, file = "x.rds") and x <- readRDS(file = "x.rds") will not work; however saveRDS(x, file = "y.rds") and x <- readRDS(file = "y.rds") will work. An undocumented feature? Thanks to all who contributed. On Sat, 10-Nov-2018 at 08:48PM +1300, Patrick Connolly wrote: |> On Thu, 08-Nov-2018 at 11:06AM +0100, Martin Maechler wrote: |> |> |> >>>>> Patrick Connolly |> |> >>>>> on Thu, 8 Nov 2018 20:27:24 +1300 writes: |> |> [...] |> |> |> > |> |> > I still don't know Why, but I know How. |> |> |> |> Hmm.. and nobody has been able to reproduce your problem, right? |> |> |> |> IIUC, currently you are suggesting that [on Windows], if you do |> |> |> |> saveRDS(rawdata, file="rawdata.rds") |> |> |> |> the resulting file is does not work withreadRDS() on Linux. |> |> What again are your R versions on the two platforms? |> |> |> It's an old version on Windows. I haven't used Windows R since then. |> |> major 3 |> minor 2.4 |> year 2016 |> month 03 |> day16 |> |> |> I've tried R-3.5.0 and R-3.5.1 Linux versions. The problem might be |> entirely because of the ancient Windows version. |> |> |> |> |> |> Could you dput() -- provide a (short if possible) version of rawdata where |> |> that problem occurs ? |> |> I can't make a smaller version of rawdata which comes from scraping a |> non-public web address, but next week when I'm back where those |> machines are, I'll try it with a small data frame which is |> reproducible. |> |> |> |> |> |> |> Best, |> |> Martin |> |> |> |> |> |> > ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. |> |> >___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. |> |> -- |> ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. |>___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. -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___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] saveRDS() and readRDS() Why? [solved, kind of]
On Thu, 08-Nov-2018 at 11:06AM +0100, Martin Maechler wrote: |> >>>>> Patrick Connolly |> >>>>> on Thu, 8 Nov 2018 20:27:24 +1300 writes: [...] |> > |> > I still don't know Why, but I know How. |> |> Hmm.. and nobody has been able to reproduce your problem, right? |> |> IIUC, currently you are suggesting that [on Windows], if you do |> |> saveRDS(rawdata, file="rawdata.rds") |> |> the resulting file is does not work withreadRDS() on Linux. |> What again are your R versions on the two platforms? It's an old version on Windows. I haven't used Windows R since then. major 3 minor 2.4 year 2016 month 03 day16 I've tried R-3.5.0 and R-3.5.1 Linux versions. The problem might be entirely because of the ancient Windows version. |> |> Could you dput() -- provide a (short if possible) version of rawdata where |> that problem occurs ? I can't make a smaller version of rawdata which comes from scraping a non-public web address, but next week when I'm back where those machines are, I'll try it with a small data frame which is reproducible. |> |> Best, |> Martin |> |> |> > ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. |> >___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. -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___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] saveRDS() and readRDS() Why? [solved, kind of]
Many thanks to Berwin, Eric, Robert, and Jan for their input. I had hoped it was as simple as because I typed saveRDS("rawData", file = "rawData.rds") on the Windows side. but that wasn't the case. Robert Burbridge suggested: windows (not run) f <- file("rawData.rds", open="w") serialize(rawData, f, xdr = FALSE) close(f) # linux rawData <- unserialize(file = "rawData.rds") That didn't work: Error in unserialize(file = "rawData.rds") : unused argument (file = "rawData.rds") (the argument isn't 'file') Nor did > rawData <- unserialize("rawData.rds") Error in unserialize("rawData.rds") : character vectors are no longer accepted by unserialize() However readRDS(file = "rawData.rds") did! So what I needed was serialize but not unserialize. I still don't know Why, but I know How. -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___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] saveRDS() and readRDS() Why?
On Wed, 07-Nov-2018 at 08:27AM +, Robert David Burbidge wrote: |> Hi Patrick, |> |> From the help: "save writes a single line header (typically |> "RDXs\n") before the serialization of a single object". |> |> If the file sizes are the same (see Eric's message), then the |> problem may be due to different line terminators. Try serialize and |> unserialize for low-level control of saving/reading objects. I'll have to find out what 'serialize' means. On Windows, it's a huge table, looks like it's all hexadecimal. On Linux, it's just the text string 'rawData' -- a lot more than line terminators. Have I misunderstood what the idea is? I thought I'd get an identical object, irrespective of how different the OS stores and zips it. |> |> Rgds, |> |> Robert |> |> |> On 07/11/18 08:13, Eric Berger wrote: |> >What do you see at the OS level? |> >i.e. on windows |> >DIR rawData.rds |> >on linux |> >ls -l rawData.rds |> >compare the file sizes on both. |> > |> > |> >On Wed, Nov 7, 2018 at 9:56 AM Patrick Connolly |> >wrote: |> > |> >> From a Windows R session, I do |> >> |> >>>object.size(rawData) |> >>31736 bytes # from scraping a non-reproducible web address. |> >>>saveRDS(rawData, file = "rawData.rds") |> >>Then copy to a Linux session |> >> |> >>>rawData <- readRDS(file = "rawData.rds") |> >>>rawData |> >>[1] "rawData" |> >>>object.size(rawData) |> >>112 bytes |> >>>rawData |> >>[1] "rawData" # only the name and something to make up 112 bytes |> >>Have I misunderstood the syntax? |> >> |> >>It's an old version on Windows. I haven't used Windows R since then. |> >> |> >>major 3 |> >>minor 2.4 |> >>year 2016 |> >>month 03 |> >>day16 |> >> |> >> |> >>I've tried R-3.5.0 and R-3.5.1 Linux versions. |> >> |> >>In case it's material ... |> >> |> >>I couldn't get the scraping to work on either of the R installations |> >>but Windows users told me it worked for them. So I thought I'd get |> >>the R object and use it. I could understand accessing the web address |> >>could have different permissions for different OSes, but should that |> >>affect the R objects? |> >> |> >>TIA |> >> |> >>-- |> >>~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. |> >>___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. |> >> |> >[[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. -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___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] saveRDS() and readRDS() Why?
They're both about 3kb. On 7/11/18 9:13 PM, Eric Berger wrote: > What do you see at the OS level? > i.e. on windows > DIR rawData.rds > on linux > ls -l rawData.rds > compare the file sizes on both. > > > On Wed, Nov 7, 2018 at 9:56 AM Patrick Connolly > mailto:p_conno...@slingshot.co.nz>> wrote: > > From a Windows R session, I do > > > object.size(rawData) > 31736 bytes # from scraping a non-reproducible web address. > > saveRDS(rawData, file = "rawData.rds") > > Then copy to a Linux session > > > rawData <- readRDS(file = "rawData.rds") > > rawData > [1] "rawData" > > object.size(rawData) > 112 bytes > > rawData > [1] "rawData" # only the name and something to make up 112 bytes > > > > Have I misunderstood the syntax? > > It's an old version on Windows. I haven't used Windows R since then. > > major 3 > minor 2.4 > year 2016 > month 03 > day 16 > > > I've tried R-3.5.0 and R-3.5.1 Linux versions. > > In case it's material ... > > I couldn't get the scraping to work on either of the R installations > but Windows users told me it worked for them. So I thought I'd get > the R object and use it. I could understand accessing the web address > could have different permissions for different OSes, but should that > affect the R objects? > > TIA > > -- > ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. > > ___ Patrick Connolly > {~._.~} Great minds discuss ideas > _( Y )_ Average minds discuss events > (:_~*~_:) Small minds discuss people > (_)-(_) . Eleanor Roosevelt > > ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. > > __ > R-help@r-project.org <mailto: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. > [[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.
[R] saveRDS() and readRDS() Why?
>From a Windows R session, I do > object.size(rawData) 31736 bytes # from scraping a non-reproducible web address. > saveRDS(rawData, file = "rawData.rds") Then copy to a Linux session > rawData <- readRDS(file = "rawData.rds") > rawData [1] "rawData" > object.size(rawData) 112 bytes > rawData [1] "rawData" # only the name and something to make up 112 bytes > Have I misunderstood the syntax? It's an old version on Windows. I haven't used Windows R since then. major 3 minor 2.4 year 2016 month 03 day16 I've tried R-3.5.0 and R-3.5.1 Linux versions. In case it's material ... I couldn't get the scraping to work on either of the R installations but Windows users told me it worked for them. So I thought I'd get the R object and use it. I could understand accessing the web address could have different permissions for different OSes, but should that affect the R objects? TIA -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___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] Corrupted package?[solved]
On Thu, 01-Nov-2018 at 08:51PM +1300, Patrick Connolly wrote: |> On Wed, 31-Oct-2018 at 07:30PM +0100, peter dalgaard wrote: |> |> |> Hm, a source install to r-devel gave me |> |> |> |> Peter-Dalgaards-MacBook-Air:BUILD pd$ ls -l library/pkgconfig/R/pkgconfig.rdb |> |> -rw-r--r-- 1 pd staff 4515 Oct 31 19:15 library/pkgconfig/R/pkgconfig.rdb |> |> Peter-Dalgaards-MacBook-Air:BUILD pd$ ls -l library/pkgconfig/help/pkgconfig.rdb |> |> -rw-r--r-- 1 pd staff 5748 Oct 31 19:15 library/pkgconfig/help/pkgconfig.rdb |> |> |> |> and an install to R_3.4.1 (yes, 4...) said [...] I searched and found someone had a message about a corrupted package and found the problem disappeared when R was restarted. So, I tried that, And. sure enough, it worked! It would have been good to get some understanding of those strange file sizes, but I suspect it will remain one of Life's little mysteries. That might help someone else who gets a corrupt package message. -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___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] Corrupted package?
odels_0.2-7 rvest_0.3.2xml2_1.2.0 [9] wordcloud_2.6 RColorBrewer_1.1-2 wordcloud2_0.2.1 tm_0.7-5 [13] NLP_0.2-0 tidytext_0.2.0 forcats_0.3.0 stringr_1.3.1 [17] purrr_0.2.5readr_1.1.1tidyr_0.8.2tibble_1.4.2 [21] ggplot2_3.1.0 tidyverse_1.2.1knitr_1.20 slam_0.1-43 [25] RcppParallel_4.4.1 tokenizers_0.2.1 dplyr_0.7.7lattice_0.20-35 loaded via a namespace (and not attached): [1] Rcpp_0.12.19 here_0.1 lubridate_1.7.4 rprojroot_1.3-2 [5] assertthat_0.2.0 digest_0.6.18 R6_2.3.0 cellranger_1.1.0 [9] plyr_1.8.4backports_1.1.2 stats4_3.5.1 httr_1.3.1 [13] pillar_1.3.0 rlang_0.3.0.1 curl_3.2 lazyeval_0.2.1 [17] readxl_1.1.0 rstudioapi_0.8data.table_1.11.8 Matrix_1.2-14 [21] selectr_0.4-1 htmlwidgets_1.3 munsell_0.5.0 broom_0.5.0 [25] compiler_3.5.1janeaustenr_0.1.5 spacyr_0.9.91 modelr_0.1.2 [29] pkgconfig_2.0.2 htmltools_0.3.6 tidyselect_0.2.5 crayon_1.3.4 [33] withr_2.1.2 SnowballC_0.5.1 grid_3.5.1nlme_3.1-137 [37] jsonlite_1.5 gtable_0.2.0 magrittr_1.5 scales_1.0.0 [41] cli_1.0.1 stringi_1.2.4 stopwords_0.9.0 fastmatch_1.1-0 [45] tools_3.5.1 glue_1.3.0hms_0.4.2 parallel_3.5.1 [49] colorspace_1.3-2 bindr_0.1.1 haven_1.1.2 modeltools_0.2-22 > |> -pd |> [..] -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___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.
[R] Corrupted package?
I got this message while using a dplyr mutate call: Error in get0(oNam, envir = ns) : lazy-load database '/home/hrapgc/local/R-3.5.1/library/pkgconfig/R/pkgconfig.rdb' is corrupt I had only just installed R-3.5.1 and updated the packages (using the function update.packages with the checkBuild parameter to TRUE) in the library I use with that version. So, I checked the size of pkgconfig.rdb with the previous version from the bash prompt: > ll `locate pkgconfig.rdb` -rw-r--r-- 1 hrapgc hrapgc 5335 May 8 14:06 /home/hrapgc/local/R-3.5.0/library/pkgconfig/help/pkgconfig.rdb -rw-r--r-- 1 hrapgc hrapgc 15669 May 8 14:06 /home/hrapgc/local/R-3.5.0/library/pkgconfig/R/pkgconfig.rdb -rw-r--r-- 1 hrapgc hrapgc 5359 Oct 31 16:12 /home/hrapgc/local/R-3.5.1/library/pkgconfig/help/pkgconfig.rdb -rw-r--r-- 1 hrapgc hrapgc 4367 Oct 31 16:12 /home/hrapgc/local/R-3.5.1/library/pkgconfig/R/pkgconfig.rdb While the pkgconfig.rdb filesize in the help directory is nearly identical in size to that in R-3.5.0 (and previous versions) the one in the R directory is very much smaller. So the error message probably makes sense. The question is: how could that have happened? I removed the package and reinstalled it, but that made no difference. Is this documented anywhere? TIA -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___ 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.
[R] Why can't I make use of tcltk in this installation?
> sessionInfo() R 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 [3] LC_TIME=en_NZ.UTF-8LC_COLLATE=en_NZ.UTF-8 [5] LC_MONETARY=en_NZ.UTF-8LC_MESSAGES=en_NZ.UTF-8 [7] LC_PAPER=en_NZ.UTF-8 LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_NZ.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] utils stats grDevices graphics methods base other attached packages: [1] lattice_0.20-35 loaded via a namespace (and not attached): [1] Rcpp_0.12.17 dplyr_0.7.6 assertthat_0.2.0 grid_3.5.0 [5] R6_2.2.2 magrittr_1.5 pillar_1.2.3 rlang_0.2.1 [9] bindrcpp_0.2.2 tools_3.5.0 glue_1.2.0 purrr_0.2.5 [13] compiler_3.5.0 pkgconfig_2.0.1 bindr_0.1.1 tidyselect_0.2.4 [17] tibble_1.4.2 > capabilities() jpeg pngtiff tcltk X11aqua TRUETRUETRUE FALSETRUE FALSE http/ftp sockets libxmlfifo cledit iconv TRUETRUETRUETRUE FALSETRUE NLS profmem cairo ICU long.double libcurl TRUE FALSETRUETRUETRUETRUE > If I try to load tcltk, no surprise... > require(tcltk) Loading required package: tcltk Error: package or namespace load failed for ‘tcltk’: .onLoad failed in loadNamespace() for 'tcltk', details: call: fun(libname, pkgname) error: Tcl/Tk support is not available on this system Warning message: S3 methods ‘as.character.tclObj’, ‘as.character.tclVar’, ‘as.double.tclObj’, ‘as.integer.tclObj’, ‘as.logical.tclObj’, ‘as.raw.tclObj’, ‘print.tclObj’, ‘[[.tclArray’, ‘[[<-.tclArray’, ‘$.tclArray’, ‘$<-.tclArray’, ‘names.tclArray’, ‘names<-.tclArray’, ‘length.tclArray’, ‘length<-.tclArray’, ‘tclObj.tclVar’, ‘tclObj<-.tclVar’, ‘tclvalue.default’, ‘tclvalue.tclObj’, ‘tclvalue.tclVar’, ‘tclvalue<-.default’, ‘tclvalue<-.tclVar’, ‘close.tkProgressBar’ were declared in NAMESPACE but not found > The question is: What do I have to do to get Tcl/Tk support? >From the bash prompt: > aptitude search tcltk p hfsutils-tcltk - Tcl/Tk interfaces for reading and writing Macintosh volumes p hfsutils-tcltk:i386- Tcl/Tk interfaces for reading and writing Macintosh volumes p libtcltk-ruby - Tcl/Tk interface for Ruby p libtcltk-ruby1.9.1 - Tcl/Tk interface for Ruby 1.9.1 p libtcltk-ruby1.9.1:i386- Tcl/Tk interface for Ruby 1.9.1 p r-cran-tcltk2 - GNU R package for Tcl/Tk additions p ruby2.0-tcltk - Ruby/Tk for Ruby 2.0 p ruby2.0-tcltk:i386 - Ruby/Tk for Ruby 2.0 That's the same as what I get on another computer on which tcktl is available, so it didn't surprise me when installing the r-cran-tcktl package didn't help. Where else should I be looking for a difference? TIA -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___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
On Sat, 25-Aug-2018 at 08:10PM -0400, 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. I'm using Rstudio to try to output ioslides which runs into the font problem which doesn't arise when plotting to the plot pane. RStudio's no advantage when the objective is ioslides. That observation gives rise to my hypothesis that to produce ioslides, Cairo is utilized in ways incomprehensible to me. |> |> >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). It has something to do with X11 which I guess MacOS doesn't use. > sessionInfo() R 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 [3] LC_TIME=en_NZ.UTF-8LC_COLLATE=en_NZ.UTF-8 [5] LC_MONETARY=en_NZ.UTF-8LC_MESSAGES=en_NZ.UTF-8 [7] LC_PAPER=en_NZ.UTF-8 LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_NZ.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] utils stats grDevices graphics methods base other attached packages: [1] lattice_0.20-35 loaded via a namespace (and not attached): [1] Rcpp_0.12.17 bindr_0.1.1 magrittr_1.5 tidyselect_0.2.4 [5] munsell_0.5.0colorspace_1.3-2 xtable_1.8-2 R6_2.2.2 [9] rlang_0.2.1 plyr_1.8.4 dplyr_0.7.6 tools_3.5.0 [13] grid_3.5.0 htmltools_0.3.6 crosstalk_1.0.0 leaflet_2.0.1 [17] assertthat_0.2.0 digest_0.6.15tibble_1.4.2 bindrcpp_0.2.2 [21] shiny_1.1.0 purrr_0.2.5 later_0.7.3 htmlwidgets_1.2 [25] promises_1.0.1 glue_1.2.0 mime_0.5 compiler_3.5.0 [29] pillar_1.2.3 scales_0.5.0 httpuv_1.4.4.2 pkgconfig_2.0.1 |> |> 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) |> >|> >``` |&g
Re: [R] Plots in ioslides and R markdown
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
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
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. I took it as read that the plotting functions themselves aren't an issue since they operate as intended outside of the Rmarkdown space. Any function that uses the function plot() successfully will do. I was trying to ascertain how I should be setting up the scaling. |> 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. The objects loaded from .RData took hours of simulating and it's out of the question to run them again inside Rmarkdown. Though the script used in the creation of .RData is reproducable, perhaps it would be clearer for me to have saved the objects to a file by a different name. Is there a better way to do that?? |> On August 23, 2018 2:15:19 AM PDT, Patrick Connolly wrote: |> >I'm having difficulty getting plots into ioslides. It seems to me |> >that the scale is completely out, but I can't figure out what to do |> >about it. Whatever I try, I get the title slide, then a second with a |> >horizontal line and a vertical line in the bottom right corner. It |> >looks like a badly scaled plot about 25 times the size of the plotting |> >area, so only a fragment is visible. |> > |> >This is the code I've tried: |> > |> >--- |> >title: "Barking up the wrong tree" |> >author: "Patrick Connolly" |> >date: "`r format(Sys.time(), '%a %d/%m/%Y %H:%M')`" |> >output: ioslides_presentation |> >--- |> > |> >```{r global_options, echo=FALSE} |> >knitr::opts_chunk$set(tidy=TRUE, |> > warning=FALSE, |> > message=FALSE, |> > cache=FALSE, |> > dpi=600) |> >``` |> > |> >```{r use these functions, echo= FALSE} |> > load(".RData") ## code for 6 plotting functions |> > |> >`` |> >## 6 different Trees |> > |> >```{r 6 different Trees, echo = FALSE, messages=FALSE, fig.width = 7, |> >fig.height = 5} |> > |> >### par(mfrow = c(2, 3)) |> >plot1() |> >plot2() |> >plot3() |> >plot4() |> >plot5() |> >plot6() |> >} |> >``` |> > |> >If I run the plot functions in the Console, it all works and displays |> >correctly in Rstudiio's plot panel, even the mfrow bit. But I haven't |> >worked out how to include the code into Rmarkdown. I thought it might |> >be less taxing to not try putting the 6 plots on the same slide, but |> >it makes no difference when I commented out the mfrow bit. |> > |> >I'm not very familiar with the workings of Markdown or Rstudio, but it |> >does seem strange to me that I need to specifically load the global |> >environment otherwise it's not visible. Is that to be expected? |> > |> >Ideas welcome, particularly about scaling. |> |> -- |> Sent from my phone. Please excuse my brevity. -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___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.
[R] Plots in ioslides and R markdown
I'm having difficulty getting plots into ioslides. It seems to me that the scale is completely out, but I can't figure out what to do about it. Whatever I try, I get the title slide, then a second with a horizontal line and a vertical line in the bottom right corner. It looks like a badly scaled plot about 25 times the size of the plotting area, so only a fragment is visible. This is the code I've tried: --- title: "Barking up the wrong tree" author: "Patrick Connolly" date: "`r format(Sys.time(), '%a %d/%m/%Y %H:%M')`" output: ioslides_presentation --- ```{r global_options, echo=FALSE} knitr::opts_chunk$set(tidy=TRUE, warning=FALSE, message=FALSE, cache=FALSE, dpi=600) ``` ```{r use these functions, echo= FALSE} load(".RData") ## code for 6 plotting functions `` ## 6 different Trees ```{r 6 different Trees, echo = FALSE, messages=FALSE, fig.width = 7, fig.height = 5} ### par(mfrow = c(2, 3)) plot1() plot2() plot3() plot4() plot5() plot6() } ``` If I run the plot functions in the Console, it all works and displays correctly in Rstudiio's plot panel, even the mfrow bit. But I haven't worked out how to include the code into Rmarkdown. I thought it might be less taxing to not try putting the 6 plots on the same slide, but it makes no difference when I commented out the mfrow bit. I'm not very familiar with the workings of Markdown or Rstudio, but it does seem strange to me that I need to specifically load the global environment otherwise it's not visible. Is that to be expected? Ideas welcome, particularly about scaling. -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___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] parallel processing in r...
If you use gkrellm, you'll get a plot of each core's activity so it's easy to see how many are being used. yum install gkrellm. HTH On 07/01/2018 06:16 AM, Jeff Newmiller wrote: > Use "top" at the bash prompt. > > Read about the "mc.cores" parameter to mclapply. > > Make a simplified example version of your analysis and post your question in > the context of that example [1][2][3]. You will learn about the issues you > are dealing with in the process of trimming your problem, and will have code > you can share that demonstrates the issue without exposing private > information. > > Running parallel does not necessarily improve performance because other > factors like task switching overhead and Inter-process-communication (data > sharing) can drag it down. Read about the real benefits and drawbacks of > parallelism... there are many discussions out there out there... you might > start with [4]. > > > [1] > http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example > > [2] http://adv-r.had.co.nz/Reproducibility.html > > [3] https://cran.r-project.org/web/packages/reprex/index.html (read the > vignette) > > [4] > https://nceas.github.io/oss-lessons/parallel-computing-in-r/parallel-computing-in-r.html > > On June 30, 2018 10:07:49 AM PDT, akshay kulkarni > wrote: >> dear members, >> I am using mclapply to parallelize my code. I am using Red Hat Linux in >> AWS. >> >> When I use mclapply, I see no speed increase. I doubt that the Linux OS >> is allowing fewer than the maximum number of cores to mclapply ( by >> default, mclapply takes all the available cores to it). >> >> How do you check if the number of workers is less than the output given >> by detectCores(), in Linux? Is there any R function for it? >> >> I do acknowledge that help on an OS is not suitable for this mailing >> list, but even Internet could'nt help me. Therefore this mail.. >> >> very many thanks for your time and effort... >> yours sincerely, >> AKSHAY M KULKARNI >> >> [[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. [[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] OT --- grammar.
How about "Physics / politics / economics are my favoruite subject"? Might be fun to see how long we could make that list. It seems to be a fact of life that it's impossible to make a (useful) language that has totally consistent grammar. Something else to consider:I knew an English teacher who frowned on what Rolf wrote (to quote) "...almost never .. " which *should be* "... hardly ever ... " How boring it would be if we all agreed. :-) On Mon, 25-Jun-2018 at 12:16PM +1200, Rolf Turner wrote: |> On 25/06/18 12:03, Bert Gunter wrote: |> >Ted, et. al.: |> > |> >Re: "Data is" vs "data are" ... Heh heh! |> > |> >"This is the kind of arrant pedantry up with which I will not put." |> >(Attributed to Churchill in one form or another, likely wrongly.) |> > |> >See here for some semi-authoritative dicussion: |> > |> >http://www.onlinegrammar.com.au/top-10-grammar-myths-data-is-plural-so-must-take-a-plural-verb/ |> |> I beg to differ. "The data was out of date" sounds just plain |> stupid to my sensitive ears. |> |> It's rather like using the phrase "begs the question" to mean |> "raises the question" or "invites the question" rather than to |> carry its *correct* meaning of "assumes what is to be proved". The |> fact that the phrase is almost always used in its *incorrect* sense |> these days, and almost never in its *correct* sense, does not |> diminish the fact that those who use it incorrectly are ignorant |> scumbags! The language is weakened and diminished by the |> encroachment of incorrect usage. |> |> 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. -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___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: [ESS] ess-insert-function-outline
On Fri, 04-May-2018 at 10:23AM +0200, Lionel Henry wrote: |> |> |> > On 4 mai 2018, at 10:05, Patrick Connolly <p_conno...@slingshot.co.nz> wrote: |> > |> > That's the same as what's in my lisp/old directory. What am I to |> > learn from that? |> |> You can copy-paste its contents into your emacs configuration file. |> . Many thanks, Lionel. It works fine now. And apologies for my ignorance. -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_ Average minds discuss events (:_~*~_:) Small minds discuss people (_)-(_) . Eleanor Roosevelt ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. __ ESS-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/ess-help
Re: [ESS] ess-insert-function-outline
Thanks Lionel. On Thu, 03-May-2018 at 11:14AM +0200, Lionel Henry wrote: |> |> |> > On 3 mai 2018, at 10:54, Patrick Connolly |> > <p_conno...@slingshot.co.nz> wrote: |> > What could be the thinking behind that? |> |> This function is strictly less useful than the alternatives mentioned by |> Alex (yasnippet is an excellent package). You can copy the old definition |> in your configuration file if you'd like to continue using it. Which configuration file are you referring to? Not the function-outline.S in etc/ because it's already there. Something in the lisp/ directory? Anything that contains reference to function-outline seems to be the same. I'm pretty ignorant of how the idea of .el and .elc files in lisp works. I just use emacs to write R code. The yasnippet package would take me ages to get my head around, and I don't have use for most of what it seems to do. |> |> https://github.com/emacs-ess/ESS/blob/master/lisp/old/ess-old-s.el That's the same as what's in my lisp/old directory. What am I to learn from that? best -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_ Average minds discuss events (:_~*~_:) Small minds discuss people (_)-(_) . Eleanor Roosevelt ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. __ ESS-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/ess-help
Re: [ESS] ess-insert-function-outline
G'day Alex, On Wed, 02-May-2018 at 09:19AM -0500, Alex Branham wrote: [...] |> |> It looks like ess-insert-function-outline was retired to the old/ |> directory, so it isn't defined in newer ESS versions. What could be the thinking behind that? The outline file is still there in the etc/ directory, so I never would have imagined dumping ess-insert-function-outline into the old/ directory. |> I'm guessing you updated ESS while tinkering with .emacs/.Rprofile? Good guess. |> |> I never used it myself, but it looks like it's supposed to insert a |> function skeleton? If that's the case, there are a few replacements you |> can use, including the builtin skeleton.el or yasnippet, available on |> ELPA. How do I use that? There's /usr/share/emacs/24.3/lisp/skeleton.elc that I could copy to the lisp/ directory or make a link from there to it. Would that make sense? If not, I'll just stick with an older version that works fine. There's nothing new that makes it worth forgoing the function skeleton. Thanks for your help. -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_ Average minds discuss events (:_~*~_:) Small minds discuss people (_)-(_) . Eleanor Roosevelt ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. __ ESS-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/ess-help
[ESS] ess-insert-function-outline
After many years of loyal service, ess-insert-function-outline has stopped working. I get the message: Symbol's function definition is void: ess-insert-function-outline During my recent issue with the R dump function (not an ESS issue as it turns out) I might have inadvertantly modified something, but only .emacs and .Rprofile were involved AFAIR and I don't notice anything when comparing old versions of those files. It might be a coincidence that I had been dealing with the buffer created by ess-dump-object-into-edit-buffer but with nothing else to go on, it appears slightly more likely to be the source of the problem. I have the function-outline.S file in $ESS-HOME/etc/ directory where it has always worked. What conveys the instructions to 'insert' it? If I try the same in an Emacs window that has been running for several weeks, i.e. before I tinkered with .emacs and .Rprofile, it works as it has always done. What does that fact tell us? TIA -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_ Average minds discuss events (:_~*~_:) Small minds discuss people (_)-(_) . Eleanor Roosevelt ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. __ ESS-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/ess-help
[ESS] SOLVED Re: ess-dump-object-into-edit-buffer
x1On Tue, 24-Apr-2018 at 10:38PM -0400, Ista Zahn wrote: [...] |> > |> > Well, I thought I did that with what I posted on 16/4/18, though I did |> > neglect to give the system information: |> |> I cannot reproduce it, which means either that you didn't give clear |> reproduction steps, or that I failed to follow them. As it turns out, there are more than those two possibilities. There is a difference between the set ups, and that difference is not in the .emacs file. In fact, there is a ~/.Rprofile which I'd forgotten about. The discussion in this thread about the R function dump() led me find an addition to that file I made centuries ago. options(deparse.max.lines = 4) IIRC That was to deal with an issue with the browser() function that would spew out all the code adjacent to where browser() appeared in the function. There was a lot of superflous code filling up screen real-estate. I don't understand how that change didn't lead to the current issue at the time, but removing that line in .Rprofile is the answer to my question. Many thanks to all the contributors to this thread, -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_ Average minds discuss events (:_~*~_:) Small minds discuss people (_)-(_) . Eleanor Roosevelt ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. __ ESS-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/ess-help
Re: [ESS] ess-dump-object-into-edit-buffer
On Tue, 24-Apr-2018 at 08:20AM -0400, Ista Zahn wrote: |> On Tue, Apr 24, 2018 at 4:13 AM, Patrick Connolly |> <p_conno...@slingshot.co.nz> wrote: |> > On Mon, 16-Apr-2018 at 09:02AM -0400, Ista Zahn wrote: |> > |> > [...] |> > |> > |> This suggests to me that you did _not_ start with emacs -q, so indeed |> > |> you should start looking at your configuration to see where the |> > |> problem is. Did you try commenting out the 'ess-source-directory' |> > |> setting to see if that is the problem? |> > |> > I tried that, half-expecting it to make the difference. But it didn't |> > -- which was only half-unexpected. However, I *still* get the problem |> > even starting with emacs -q. That was completely unexpected since it |> > would indicate that the problem is not with my .emacs file. |> > |> > Where else is there to investigate? It's getting curiouser and |> > curiouser. |> |> Hi Patrick, |> |> What I've been trying to tell you is that we need explicit |> step-by-step instructions for reproducing the problem, as well as the |> details of your set up such as operating system and emacs and ess |> versions. Basically, please provide a standard, reproducible, and |> complete bugreport. Well, I thought I did that with what I posted on 16/4/18, though I did neglect to give the system information: GNU Emacs 24.3.1 (x86_64-pc-linux-gnu, GTK+ Version 3.10.8) of 2017-09-20 on lcy01-35, modified by Debian ess-17.11 > sessionInfo() R version 3.4.4 (2018-03-15) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 14.04.5 LTS Matrix products: default BLAS: /home/pat/local/R-3.4.4/lib/libRblas.so LAPACK: /home/pat/local/R-3.4.4/lib/libRlapack.so locale: [1] LC_CTYPE=en_NZ.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_NZ.UTF-8LC_COLLATE=en_NZ.UTF-8 [5] LC_MONETARY=en_NZ.UTF-8LC_MESSAGES=en_NZ.UTF-8 [7] LC_PAPER=en_NZ.UTF-8 LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_NZ.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] utils stats grDevices graphics methods base other attached packages: [1] lattice_0.20-35 loaded via a namespace (and not attached): [1] compiler_3.4.4 magrittr_1.5 https://www.antiaging-systems.com/articles/31-bec-5-the-treatment-of-choice-for-non-melanoma-skin-cancers assertthat_0.2.0 R6_2.2.1 [5] tools_3.4.4 pillar_1.2.1 bindrcpp_0.2.2 glue_1.2.0 [9] dplyr_0.7.4 tibble_1.4.2 Rcpp_0.12.16 grid_3.4.4 [13] pkgconfig_2.0.1 rlang_0.2.0 bindr_0.1.1 > best Patrick -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_ Average minds discuss events (:_~*~_:) Small minds discuss people (_)-(_) . Eleanor Roosevelt ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. __ ESS-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/ess-help
Re: [ESS] ess-dump-object-into-edit-buffer
On Mon, 16-Apr-2018 at 09:02AM -0400, Ista Zahn wrote: [...] |> This suggests to me that you did _not_ start with emacs -q, so indeed |> you should start looking at your configuration to see where the |> problem is. Did you try commenting out the 'ess-source-directory' |> setting to see if that is the problem? I tried that, half-expecting it to make the difference. But it didn't -- which was only half-unexpected. However, I *still* get the problem even starting with emacs -q. That was completely unexpected since it would indicate that the problem is not with my .emacs file. Where else is there to investigate? It's getting curiouser and curiouser. Thanks for looking into it. -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_ Average minds discuss events (:_~*~_:) Small minds discuss people (_)-(_) . Eleanor Roosevelt ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. __ ESS-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/ess-help
Re: [ESS] ess-dump-object-into-edit-buffer
This is about the shortest I can get that shows what happens: Just what the example function does is not material to my question. ## from the bash prompt mkdir ~/Temp/First cd ~/Temp/First emacs & # start R using M-x R ## within the *R* buffer make a short function bringLibrary <- function(lastR = "3.0.2", latestR = "3.1.0", Rloc = "~/local/"){ ### Purpose:- Bring library from older R version to newer one. ### (Idea is to then update the packages that need to be) ### -- ### Modified from:- ### -- ### Arguments:- lastR: version of R that has the packages desired ### latestR: latest version of R of interest ### Rloc: where R versions are located (probably not the default) ###Make sure there's a trailing "/" ### ---------- ### Author:- Patrick Connolly, Date:- 29 May 2014, 11:08 ### -- ### Revisions:- 22/08/14 fixed mistaken swap of lastR & latestR ### 15/10/15 location of R installions made adjustable ### 7//2017 Rloc changed back to ~/local now <- system(paste0("ls ", Rloc, "R-", latestR, "/library"), TRUE) was <- system(paste0("ls ", Rloc, "R-", lastR, "/library"), TRUE) need <- was[!is.element(was, now)] ### Check if it's already been done if(length(need) < 1) stop("Nothing in R-", lastR, " that isn't already in R-", latestR, ".\n") for(i in need) # reason for running this function system(paste0("cp -prv ", Rloc, "R-", lastR, "/library/", i, " ", Rloc, "R-", latestR, "/library/")) ### Notify it's finished and give pastable text to update copied packages cat(length(need), " packages copied into R-", latestR, " directory.\nProbably a good idea to start R-", latestR, " and run\n update.packages(checkBuilt = TRUE, ask = FALSE)\n", sep = "") } ## now save and exit then start in another directory: > q() Save workspace image? [y/n/c]: y ## from the bash prompt mkdir ~/Temp/Second cd ~/Temp/Second emacs & # start R using M-x R ## Within the *R* buffer > attach("../First/.RData") > ls(pos = 2) [1] "bringLibrary" "repos" ## Then 'M-x ess-dump-object-into-edit-buffer bringLibrary ' bringLibrary <- function(lastR = "3.0.2", latestR = "3.1.0", Rloc = "~/local/") { ### Purpose:- Bring library from older R version to newer one. ### (Idea is to then update the packages that need to be) ... ## but in the *R* buffer all code and comment are there. > bringLibrary function(lastR = "3.0.2", latestR = "3.1.0", Rloc = "~/local/") { ### Purpose:- Bring library from older R version to newer one. ### (Idea is to then update the packages that need to be) ### -- ### Modified from:- ### ------ ### Arguments:- lastR: version of R that has the packages desired ### latestR: latest version of R of interest ### Rloc: where R versions are located (probably not the default) ###Make sure there's a trailing "/" ### -- ### Author:- Patrick Connolly, Date:- 29 May 2014, 11:08 ### -- ### Revisions:- 22/08/14 fixed mistaken swap of lastR & latestR ### 15/10/15 location of R installions made adjustable ### 7//2017 Rloc cchanged back to ~/local now <- system(paste0("ls ", Rloc, "R-", latestR, "/library"), TRUE) was <- system(paste0("ls ", Rloc, "R-", lastR, "/library"), TRUE) need <- was[!is.element(was, now)] ### Check if it's already been done if(length(need) < 1) stop("Nothing in R-", lastR, " that isn't already in R-", latestR, ".\n") for(i in need) # reason for running this function system(paste0("cp -prv ", Rloc, "R-", lastR, "/library/", i, " ", Rloc, "R-", latestR, "/library/")) ### Notify it's finished and give pastable text to update copied packages cat(length(need), " packages copied into R-", latestR, " directory.\nProbably a good idea to start R-", latestR, " and run\n
Re: [ESS] ess-dump-object-into-edit-buffer
G'day Ista, I'm having trouble getting an example small enough to show. Some work properly and others (usually longer ones) don't. Can't imagine what makes the difference. I'll be at the machine where I normally work and there I'll find a small example. Thanks for looking at my problem. best Patrick On Thu, 12-Apr-2018 at 11:08PM -0400, Ista Zahn wrote: |> Hi Patrick, |> |> I don't use ess-dump-object-into-edit-buffer, so I'm not sure what |> exactly you expect it to do. A specific example would help, i.e., a |> description of exactly what you did, exactly what happened, and how |> what happened differed from you expectation. |> |> For example, if I start R with 'M-x R ' and do 'M-x |> ess-dump-object-into-edit-buffer getwd ' I see a new buffer |> is created containing |> |> getwd <- |> function () |> .Internal(getwd()) |> |> Is that what you see? If so, how does it differ from what you expect? |> If you see something different, how does your setup differ from mine? |> I'm running Emacs 25.3 and ESS 17.11 [elpa: 20180412.315] |> |> Best, |> Ista |> |> On Thu, Apr 12, 2018 at 7:19 PM, Patrick Connolly |> <p_conno...@slingshot.co.nz> wrote: |> > Thanks Ista. |> > |> > The result is not the same, but it's equally useless. It produces almost |> > the same as typing the name of the function and pressing . That is to |> > say, unless the function has been edited in the working directory, it lists |> > all the code without any of the comments almost in the form of a list |> > element labelled "structure" and a second element labelled "source" which |> > contains all the source in the form of a character vector. Quite a lot of |> > text wrangling is required to get that text into the form of an editable |> > function. |> > |> > There is a slight difference from what results from typing the function name |> > and pressing in that the word "structure" is not in the latter and |> > the source is an attr. |> > |> > (I say "almost" because neither form is exactly the same as how a list is |> > displayed.) |> > |> > Is that intended behaviour? |> > |> > TIA |> > Patrick |> > |> > On 04/13/2018 01:48 AM, Ista Zahn wrote: |> > |> > On Thu, Apr 12, 2018 at 3:56 AM, Patrick Connolly |> > <p_conno...@slingshot.co.nz> wrote: |> > |> > Thanks for the response, however, if I start Emacs with a '-q' none of |> > my ~/.emacs file is read, so Emacs doesn't know how to start R. More |> > to the point, I'm unable to run R within Emacs any other way. |> > |> > The usual recipe is to start with emacs -q and then evaluate |> > |> > (package-initialize) |> > (require 'ess-site) |> > |> > in the scratch buffer, then check to see if you can reproduce the bug. |> > If you have ESS installed in a way that it is not in your load-path by |> > default you may have to do something along the lines of |> > |> > (add-to-list 'load-path "/path/to/ESS/lisp/") |> > (load "ess-site") |> > |> > Best, |> > Ista |> > |> > |> > |> > I gather there is a way of applying individual lines of the .emacs |> > files but a bear with a small brain doesn't know how to do that (or |> > where to look in the manual how to do it), |> > |> > It would appear, if it doesn't reproduce, that the problem is |> > somewhere in my .emacs file. That's a hodge-podge of various things |> > I've picked up over the decades so it wouldn't be surprising to find |> > some incompatibilities. |> > |> > Ideas appreciated. |> > |> > |> > On Wed, 11-Apr-2018 at 07:44AM -0400, Ista Zahn wrote: |> > |> > |> I can't reproduce it with the latest ESS from melpa. Can you give |> > |> reproduction steps starting with |> > |> |> > |> emacs -q |> > |> |> > |> ? |> > |> |> > |> --Ista |> > |> |> > |> On Wed, Apr 11, 2018 at 4:58 AM, Patrick Connolly |> > |> <p_conno...@slingshot.co.nz> wrote: |> > |> > For a long time I used to be able to use |> > |> > |> > |> > ess-dump-object-into-edit-buffer |> > |> > |> > |> > to create a buffer that could be used to edit the designated function |> > |> > from anywhere on the search path to make a local version. |> > |> > |> > |> > Starting at about ess-15.x, only the first 5 or so lines of code is |> > |> > made available which I took to be a bug that would be fixed. However, |> > |&
Re: [ESS] ess-dump-object-into-edit-buffer
Thanks for the response, however, if I start Emacs with a '-q' none of my ~/.emacs file is read, so Emacs doesn't know how to start R. More to the point, I'm unable to run R within Emacs any other way. I gather there is a way of applying individual lines of the .emacs files but a bear with a small brain doesn't know how to do that (or where to look in the manual how to do it), It would appear, if it doesn't reproduce, that the problem is somewhere in my .emacs file. That's a hodge-podge of various things I've picked up over the decades so it wouldn't be surprising to find some incompatibilities. Ideas appreciated. On Wed, 11-Apr-2018 at 07:44AM -0400, Ista Zahn wrote: |> I can't reproduce it with the latest ESS from melpa. Can you give |> reproduction steps starting with |> |> emacs -q |> |> ? |> |> --Ista |> |> On Wed, Apr 11, 2018 at 4:58 AM, Patrick Connolly |> <p_conno...@slingshot.co.nz> wrote: |> > For a long time I used to be able to use |> > |> > ess-dump-object-into-edit-buffer |> > |> > to create a buffer that could be used to edit the designated function |> > from anywhere on the search path to make a local version. |> > |> > Starting at about ess-15.x, only the first 5 or so lines of code is |> > made available which I took to be a bug that would be fixed. However, |> > I was mistaken. I installed ess-17.11 and it's still the same. Being |> > a bear with only a small brain, I can't imagine what use that would be |> > if it's what is intended. |> > |> > Could it be that there is an additional setting that allows all of the |> > function (including comments) to be dumped into that buffer? Perhaps, |> > more difficult to track down, I have something else in my ~/.emacs |> > file that is incompatible. |> > |> > TIA for suggestions. |> > |> > -- |> > ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. |> >___Patrick Connolly |> > {~._.~} Great minds discuss ideas |> > _( Y )_ Average minds discuss events |> > (:_~*~_:) Small minds discuss people |> > (_)-(_) . Eleanor Roosevelt |> > |> > ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. |> > |> > ______ |> > ESS-help@r-project.org mailing list |> > https://stat.ethz.ch/mailman/listinfo/ess-help -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_ Average minds discuss events (:_~*~_:) Small minds discuss people (_)-(_) . Eleanor Roosevelt ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. __ ESS-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/ess-help
Re: [R] Using gutenbergr with a firewall
My question was to ascertain whether anyone had a similar problem with their firewall before I make a request to the controllers of our firewall. With any luck, I might get information that will be useful in ascertaining where the bottle-neck is. So far, nobody has indicated that they can use gutenberg_download if they're behind a firewall, which might indicate that it is not possible to do, whatever the firewall settings are. If that's the case, I may as well not bother trying to get our firewall warrior to work out what can be changed and still achieve what is considered necessary. Anyone succeed? On Tue, 13-Feb-2018 at 11:25PM -0800, Jeff Newmiller wrote: |> Saying "a firewall" is like saying "a weapon". Some firewalls are |> much more strict than others, and yours may be different than any |> someone here might have encountered. You might also be having |> trouble with anti virus software. -- |> Sent from my phone. Please excuse my brevity. |> |> On February 13, 2018 10:55:40 PM PST, Patrick Connolly <p_conno...@slingshot.co.nz> wrote: |> >I can use the gutenberg_download() function in the gutenbergr package |> >on a computer that doeson't use a firewall, but on an almost identical |> >installation that is behind a firewall, nothing happens, not even a |> >time-out. |> > |> >Has anyone succeeded in using gutenberg_download() successfully with a |> >firewall? I tried raising an issue at |> >https://github.com/ropenscilabs/gutenbergr/issues/17 with no usable |> >response. I also tried contacting the maintainer but got no response. |> > |> >The firewall might be a red-herring, but I thought it worthwhile |> >eliminating it as a factor. |> > |> >I would welcome any information on anyone else's experience. |> > |> >Thank you. -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___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.
[R] Using gutenbergr with a firewall
I can use the gutenberg_download() function in the gutenbergr package on a computer that doeson't use a firewall, but on an almost identical installation that is behind a firewall, nothing happens, not even a time-out. Has anyone succeeded in using gutenberg_download() successfully with a firewall? I tried raising an issue at https://github.com/ropenscilabs/gutenbergr/issues/17 with no usable response. I also tried contacting the maintainer but got no response. The firewall might be a red-herring, but I thought it worthwhile eliminating it as a factor. I would welcome any information on anyone else's experience. Thank you. -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___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] Updating Rcpp package when it is claimed by dplyr
On Fri, 02-Feb-2018 at 10:25AM +0100, peter dalgaard wrote: |> Or, to avoid accusing you of lying. what you think is "vanilla" |> probably isn't. What exactly did you do? On Unix-likes, I would do |> something like this |> echo 'options(repos=list(CRAN="cran.r-project.org"));install.packages("Rcpp")' | R --vanilla |> |> (or maybe https://cloud.r-project.org is better...) Thanks for the suggestion. I simply did R -- vanilla I tried it again this morning so that I could compare the output. However, it *worked* fine -- just as I thought it would done yesterday. Why it didn't work yesterday is a mystery. I've had a few other things behaving strangely on this machine so there might be an OS issue, not an R issue. Thanks for taking the time. Patrick |> |> -pd |> |> |> |> > On 2 Feb 2018, at 08:15 , Jeff Newmiller <jdnew...@dcn.davis.ca.us> wrote: |> > |> > Your last statement is extremely unlikely to be true. The dplyr package should not be present in a vanilla environment, so there should be no such conflict. |> > -- |> > Sent from my phone. Please excuse my brevity. |> > |> > On February 1, 2018 11:00:01 PM PST, Patrick Connolly <p_conno...@slingshot.co.nz> wrote: |> >> When i tried to install the hunspell package, I got this error |> >> message: |> >> |> >> Error: package ‘Rcpp’ 0.12.3 was found, but >= 0.12.12 is required by |> >> ‘hunspell’ |> >> |> >> So I set about installing a new version of Rcpp but I get this message: |> >> |> >> Error in unloadNamespace(pkg_name) : |> >> namespace ‘Rcpp’ is imported by ‘dplyr’ so cannot be unloaded |> >> |> >> How does one get around that? I tried installing Rcpp in a vanilla |> >> session but the result was the same. |> >> |> >> TIA |> >> Patrick |> >> |> >> |> >>> sessionInfo() |> >> R version 3.4.3 (2017-11-30) |> >> Platform: x86_64-pc-linux-gnu (64-bit) |> >> Running under: Ubuntu 14.04.5 LTS |> >> |> >> Matrix products: default |> >> BLAS: /home/pat/local/R-3.4.3/lib/libRblas.so |> >> LAPACK: /home/pat/local/R-3.4.3/lib/libRlapack.so |> >> |> >> locale: |> >> [1] LC_CTYPE=en_NZ.UTF-8 LC_NUMERIC=C |> >> [3] LC_TIME=en_NZ.UTF-8LC_COLLATE=en_NZ.UTF-8 |> >> [5] LC_MONETARY=en_NZ.UTF-8LC_MESSAGES=en_NZ.UTF-8 |> >> [7] LC_PAPER=en_NZ.UTF-8 LC_NAME=C |> >> [9] LC_ADDRESS=C LC_TELEPHONE=C |> >> [11] LC_MEASUREMENT=en_NZ.UTF-8 LC_IDENTIFICATION=C |> >> |> >> attached base packages: |> >> [1] utils stats grDevices graphics methods base |> >> |> >> other attached packages: |> >> [1] lattice_0.20-35 |> >> |> >> loaded via a namespace (and not attached): |> >> [1] compiler_3.4.3 magrittr_1.5 R6_2.1.2 assertthat_0.1 |> >> parallel_3.4.3 |> >> [6] tools_3.4.3DBI_0.3.1 dplyr_0.4.3Rcpp_0.12.3 |> >> grid_3.4.3 |> >> |> >> |> >> -- |> >> ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. |> >> |> >> ___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. |> > |> > __ |> > 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. |> |> -- |> Peter Dalgaard, Professor, |> Center for Statistics, Copenhagen Business School |> Solbjerg Plads 3, 2000 Frederiksberg, Denmark |> Phone: (+45)38153501 |> Office: A 4.23 |> Email: pd@cbs.dk
[R] Updating Rcpp package when it is claimed by dplyr
When i tried to install the hunspell package, I got this error message: Error: package ‘Rcpp’ 0.12.3 was found, but >= 0.12.12 is required by ‘hunspell’ So I set about installing a new version of Rcpp but I get this message: Error in unloadNamespace(pkg_name) : namespace ‘Rcpp’ is imported by ‘dplyr’ so cannot be unloaded How does one get around that? I tried installing Rcpp in a vanilla session but the result was the same. TIA Patrick > sessionInfo() R version 3.4.3 (2017-11-30) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 14.04.5 LTS Matrix products: default BLAS: /home/pat/local/R-3.4.3/lib/libRblas.so LAPACK: /home/pat/local/R-3.4.3/lib/libRlapack.so locale: [1] LC_CTYPE=en_NZ.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_NZ.UTF-8LC_COLLATE=en_NZ.UTF-8 [5] LC_MONETARY=en_NZ.UTF-8LC_MESSAGES=en_NZ.UTF-8 [7] LC_PAPER=en_NZ.UTF-8 LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_NZ.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] utils stats grDevices graphics methods base other attached packages: [1] lattice_0.20-35 loaded via a namespace (and not attached): [1] compiler_3.4.3 magrittr_1.5 R6_2.1.2 assertthat_0.1 parallel_3.4.3 [6] tools_3.4.3DBI_0.3.1 dplyr_0.4.3Rcpp_0.12.3grid_3.4.3 -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___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.
[R] Function gutenberg_download in the gutenbergr package
I've been working through https://www.tidytextmining.com/tidytext.html wherein everything worked until I got to this part in section 1.5 > hgwells <- gutenberg_download(c(35, 36, 5230, 159)) Determining mirror for Project Gutenberg from http://www.gutenberg.org/robot/harvest Error in open.connection(con, "rb") : Failed to connect to www.gutenberg.org port 80: Connection timed out Which indicates the problem is at the very start: if (is.null(mirror)) { mirror <- gutenberg_get_mirror(verbose = verbose) } The documentation for gutenberg_get_mirror indicates there's nothing different I could set. So I tried specifying my usual mirror: > hgwells <- gutenberg_download(c(1260, 768, 969, 9182, 767), mirror = > "http://cran.stat.auckland.ac.nz;) Error in read_zip_url(full_url) : could not find function "read_zip_url" > Which is, indeed, strange since according to > help.search("read_zip_url") Help files with alias or concept or title matching ‘read_zip_url’ using regular expression matching: gutenbergr::read_zip_url Read a file from a .zip URL Aliases: read_zip_url [...] And according to library(help = "gutenbergr") [...] Index: gutenberg_authors Metadata about Project Gutenberg authors gutenberg_download Download one or more works using a Project Gutenberg ID gutenberg_get_mirrorGet the recommended mirror for Gutenberg files gutenberg_metadata Gutenberg metadata about each work gutenberg_strip Strip header and footer content from a Project Gutenberg book gutenberg_subjects Gutenberg metadata about the subject of each work gutenberg_works Get a filtered table of Gutenberg work metadata read_zip_urlRead a file from a .zip URL [...] However, when I look at the list for that part of the search(), there is no read_zip_url but all the rest of that list are present. So it's not surprising that it isn't found. But it puzzles me that it is not there. Ideas as to where I should proceed gratefully appreciated. > sessionInfo() R version 3.4.2 (2017-09-28) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 14.04.5 LTS Matrix products: default BLAS: /home/hrapgc/local/R-3.4.2/lib/libRblas.so LAPACK: /home/hrapgc/local/R-3.4.2/lib/libRlapack.so locale: [1] LC_CTYPE=en_NZ.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_NZ.UTF-8LC_COLLATE=en_NZ.UTF-8 [5] LC_MONETARY=en_NZ.UTF-8LC_MESSAGES=en_NZ.UTF-8 [7] LC_PAPER=en_NZ.UTF-8 LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_NZ.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] grDevices utils stats graphics methods base other attached packages: [1] sos_2.0-0 brew_1.0-6 gutenbergr_0.1.3 ggplot2_2.2.1 [5] stringr_1.2.0 bindrcpp_0.2 dplyr_0.7.4janeaustenr_0.1.5 [9] tidytext_0.1.6 FactoMineR_1.38readxl_1.0.0 tm_0.7-3 [13] NLP_0.1-11 wordcloud_2.5 RColorBrewer_1.1-2 lattice_0.20-35 loaded via a namespace (and not attached): [1] Rcpp_0.12.13 cellranger_1.1.0 compiler_3.4.2 [4] plyr_1.8.4 bindr_0.1tokenizers_0.1.4 [7] tools_3.4.2 gtable_0.2.0 tibble_1.3.4 [10] nlme_3.1-131 pkgconfig_2.0.1 rlang_0.1.2 [13] Matrix_1.2-11psych_1.7.8 curl_3.0 [16] parallel_3.4.2 xml2_1.1.1 cluster_2.0.6 [19] hms_0.3 flashClust_1.01-2grid_3.4.2 [22] scatterplot3d_0.3-40 glue_1.1.1 ellipse_0.3-8 [25] R6_2.2.2 foreign_0.8-69 readr_1.1.1 [28] purrr_0.2.4 tidyr_0.7.2 reshape2_1.4.2 [31] magrittr_1.5 scales_0.5.0 SnowballC_0.5.1 [34] MASS_7.3-47 leaps_3.0assertthat_0.2.0 [37] mnormt_1.5-5 colorspace_1.3-2 labeling_0.3 [40] stringi_1.1.5lazyeval_0.2.1 munsell_0.4.3 [43] slam_0.1-42 broom_0.4.2 > -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___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.
[R] Distributions for gbm models
On page 409 of "Applied Predictive Modeling" by Max Kuhn, it states that the gbm function can accomodate only two class problems when referring to the distribution parameter. >From gbm help re: the distribution parameter: Currently available options are "gaussian" (squared error), "laplace" (absolute loss), "tdist" (t-distribution loss), "bernoulli" (logistic regression for 0-1 outcomes), "huberized" (huberized hinge loss for 0-1 outcomes), "multinomial" (classification when there are more than 2 classes), "adaboost" (the AdaBoost exponential loss for 0-1 outcomes), "poisson" (count outcomes), "coxph" (right censored observations), "quantile", or "pairwise" (ranking measure using the LambdaMart algorithm). I would have thought that huberized and multinomial would also be possible. Is that not so? In any case, how would anything different from bernoulli (the default) be specified when using the caret train function since distribution appears not to be among the list of parameters that caret recognises? > getModelInfo("gbm")[["gbm"]]$parameters parameter class label 1 n.trees numeric # Boosting Iterations 2 interaction.depth numeric Max Tree Depth 3 shrinkage numeric Shrinkage 4n.minobsinnode numeric Min. Terminal Node Size Is that a limitation of the caret package? Or is there something I'm not getting? -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___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.
[R] Using bartMachine with the caret package
Dave Langer in this video https://www.youtube.com/watch?v=z8PRU46I3NY uses the titanic data as an example of using caret to create xgbTree models. The caret train() function has a tuneGrid parameter which takes a list set up like so: tune.grid <- expand.grid(eta = c(0.05, 0.075, 0.1), nrounds = c(50, 75, 100), max_depth = 6:8, min_child_weight = c(2, 2.25, 2.5), colsample_bytree = (3:5)/10, gamma = 0, subsample = 1) That approach also worked with my data. By making the corresponding adjustments, I was also successful with gbm, bstTree and extraTree models but I can't get it to work with bartMachine models. I get dozens of messages like these: bartMachine initializing with 50 trees... bartMachine vars checked... bartMachine java init... bartMachine factors created... bartMachine before preprocess... bartMachine after preprocess... 19 total features... bartMachine sigsq estimated... bartMachine initializing with 30 trees... bartMachine vars checked... bartMachine java init... bartMachine factors created... bartMachine before preprocess... bartMachine after preprocess... 19 total features... bartMachine sigsq estimated... [...] And eventually, this: Something is wrong; all the RMSE metric values are missing: RMSERsquaredMAE Min. : NA Min. : NA Min. : NA 1st Qu.: NA 1st Qu.: NA 1st Qu.: NA Median : NA Median : NA Median : NA Mean :NaN Mean :NaN Mean :NaN 3rd Qu.: NA 3rd Qu.: NA 3rd Qu.: NA Max. : NA Max. : NA Max. : NA NA's :2 NA's :2 NA's :2 If I omit the tuneGrid parameter, I get a model and predictions comparable to those from the other models. If I could tune the parameters I would possibly get better predictions. Possibly relevant is the fact that formula method of defining the model seems not to work. I had to use the method of supplying x and y specifically. I couldn't find how to use the 'recipe' method. All the specific links in the help files were dead. Any suggestions welcome. -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___ 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.
[R] Final models from caret's train function
Using caret on the Titanic data from Kaggle, I tried various models, including rfRules which produces a model, partly described as such: > caret.rfRules.cv$finalModel $model len freq err [1,] "2" "0.0368" "0" [2,] "2" "0.032" "0.05" [3,] "2" "0.1824" "0.0526315789473685" [4,] "4" "0.0656" "0.0975609756097561" [5,] "4" "0.0304" "0.105263157894737" [6,] "3" "0.4384" "0.105839416058394" [7,] "3" "0.0112" "0.142857142857143" [8,] "4" "0.0256" "0.1875" [9,] "3" "0.1088" "0.279411764705882" [10,] "3" "0.056" "0.342857142857143" [11,] "1" "0.0128" "0.25" condition pred [1,] "X[,4]<=7 & X[,11]<=4.5""1" [2,] "X[,7]<=31.33125 & X[,11]>4.5" "0" [3,] "X[,2]<=0.5 & X[,3]<=0.5" "1" [4,] "X[,2]>0.5 & X[,4]<=30.5 & X[,5]>0.5 & X[,9]>0.5" "0" [5,] "X[,3]<=0.5 & X[,4]<=30.2031919426199 & X[,4]>21.5 & X[,9]<=0.5""1" [6,] "X[,3]>0.5 & X[,4]>9.5 & X[,7]<=26.26875" "0" [7,] "X[,2]>0.5 & X[,7]>13.90835 & X[,7]<=15.3729" "0" [8,] "X[,4]<=40.8653667208804 & X[,4]>25 & X[,7]>26.14375 & X[,11]<=1.5" "1" [9,] "X[,3]>0.5 & X[,4]>8.16718191075288 & X[,4]<=77""0" [10,] "X[,3]<=0.5 & X[,4]<=38.5 & X[,4]>12.5" "1" [11,] "X[,1]==X[,1]" "0" [...] Does that 11th row make sense? X[,1]==X[,1] will always be true, so is that saying anything? Or is it a case of a model for prediction being useless for inference? > version _ platform x86_64-pc-linux-gnu arch x86_64 os linux-gnu system x86_64, linux-gnu status major 3 minor 4.1 year 2017 month 06 day30 svn rev72865 language R version.string R version 3.4.1 (2017-06-30) nickname Single Candle -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___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.
[R] How to install packages from GitHubb
R-3.4.1 Running the train function from the latest version of the caret package on CRAN fails with this message: unable to find variable "optimismBoot" The purported workaround is to use devtools::install_github('topepo/caret/pkg/caret') to get the development version. However, that evidently has the same problem with southern hemisphere timezones that install.packages() does -- via download.packages(). i.e. it hangs. The workaround with that one is to use method = "internal". What is the equivalent for install_github()? TIA -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___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] Error in readRDS(dest) SOLVED
On Wed, 31-May-2017 at 10:05AM -0400, Martin Morgan wrote: |> On 05/31/2017 04:38 AM, Patrick Connolly wrote: |> >When I check out those directories in a terminal, there's a big diffrence: |> > |> >With R-3.4.0 |> >~ > ll /tmp/RtmpFUhtpY |> >total 4 |> >drwxr-xr-x 2 hrapgc hrapgc 4096 May 31 10:45 downloaded_packages/ |> >-rw-r--r-- 1 hrapgc hrapgc0 May 31 10:56 repos_http%3A%2F%2Fcran.stat.auckland.ac.nz%2Fsrc%2Fcontrib.rds |> > |> > |> |> The file |> repos_http%3A%2F%2Fcran.stat.auckland.ac.nz%2Fsrc%2Fcontrib.rds was |> likely created earlier in your R session. Likely the download a few |> lines down |> |> download.file(url = paste0(repos, "/PACKAGES.rds"), |> destfile = dest, method = method, |> cacheOK = FALSE, quiet = TRUE, |> mode = "wb") |> |> 'succeeded' but created a zero-length file. |> |> You could try to troubleshoot this with something like the |> following, downloading to a temporary location |> |> dest = tempfile() |> url = "http://cran.stat.auckland.ac.nz/src/contrib/PACKAGES.rds; |> download.file(url, dest) |> file.size(dest) That works fine using R-3.3.3 but with R-3.4.0, this happens: > download.file(url, dest) trying URL 'http://cran.stat.auckland.ac.nz/src/contrib/PACKAGES.rds' Error in download.file(url, dest) : cannot open URL 'http://cran.stat.auckland.ac.nz/src/contrib/PACKAGES.rds' In addition: Warning message: In download.file(url, dest) : URL 'http://cran.stat.auckland.ac.nz/src/contrib/PACKAGES.rds': status was 'Couldn't connect to server' > Which seems to indicate that something else is preventing connexion to the server. Is there something that's changed with the way proxy servers are used? was the question that led me to check out the changes in R 3.4.0 which mentions visible changes to download.file(). So I tried method = "internal" which worked! So making the same setting to the call to install.packages() fixed my problem. Thanks for all the suggestions which led me to the solution. I just wonder if there could be a more informative error message. -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___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] Error in readRDS(dest) (was Re: Error with installed.packages with R 3.4.0 on Windows)
On Tue, 23-May-2017 at 12:20PM +0200, Martin Maechler wrote: [...] |> |> Given the above stack trace. |> It may be easier to just do |> |> debugonce(available.packages) |> install.packages("withr") |> |> and then inside available.packages, (using 'n') step to the |> point _before_ the tryCatch(...) call happens; there, e.g. use |> |> ls.str() |> |> which gives an str() of all your local objects, notably 'dest' |> and 'method'. |> but you can also try other things once inside |> available.packages(). I couldn't see any differences between R-3.3.3 (which works) and R-3.4.0 (which doesn't) until I got to here, a few lines before the download.file line: Browse[2]> debug: dest <- file.path(tempdir(), paste0("repos_", URLencode(repos, TRUE), ".rds")) Browse[2]> When I check out those directories in a terminal, there's a big diffrence: With R-3.4.0 ~ > ll /tmp/RtmpFUhtpY total 4 drwxr-xr-x 2 hrapgc hrapgc 4096 May 31 10:45 downloaded_packages/ -rw-r--r-- 1 hrapgc hrapgc0 May 31 10:56 repos_http%3A%2F%2Fcran.stat.auckland.ac.nz%2Fsrc%2Fcontrib.rds With R-3.3.3 ~ > ll /tmp/RtmpkPgL3A total 380 drwxr-xr-x 2 hrapgc hrapgc 4096 May 31 11:01 downloaded_packages/ -rw-r--r-- 1 hrapgc hrapgc 8214 May 31 11:01 libloc_185_3165c7f52d5fdf96.rds -rw-r--r-- 1 hrapgc hrapgc 372263 May 31 11:01 repos_http%3A%2F%2Fcran.stat.auckland.ac.nz%2Fsrc%2Fcontrib.rds So, if I could figure out what makes *that* difference I could get somewhere. I see there's considerably extra code in the newer of the two versions of available.packages() but being a bear with a small brain, I can't figure out what differences should be expected. I have no idea what populates those 'dest' directories. TIA -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___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] Error in readRDS(dest) (was Re: Error with installed.packages with R 3.4.0 on Windows)
On Tue, 23-May-2017 at 12:20PM +0200, Martin Maechler wrote: [...] |> |> Given the above stack trace. |> It may be easier to just do |> |> debugonce(available.packages) |> install.packages("withr") |> |> and then inside available.packages, (using 'n') step to the |> point _before_ the tryCatch(...) call happens; there, e.g. use |> |> ls.str() I got: contriburl : chr [1:2] "http://cran.stat.auckland.ac.nz/src/contrib; ... dest : chr "/tmp/Rtmp6D0KNY/repos_http%3A%2F%2Fcran.stat.auckland.ac.nz%2Fsrc%2Fcontrib.rds" fields : chr [1:16] "Package" "Version" "Priority" "Depends" "Imports" "LinkingTo" ... filters : NULL localcran : logi FALSE method : repos : chr "http://cran.stat.auckland.ac.nz/src/contrib; requiredFields : chr [1:16] "Package" "Version" "Priority" "Depends" "Imports" "LinkingTo" ... res : chr[0 , 1:17] type : chr "source" So I thought the missing method was the problem. However, it's exactly the same with R-3.3.3. So still no answwer. Then I tried: debugonce(readRDS) install.packages("withr") Browse[2]> con A connection with description "/tmp/RtmpqzKzzK/repos_http%3A%2F%2Fcran.stat.auckland.ac.nz%2Fsrc%2Fcontrib.rds" class "gzfile" mode"rb" text"binary" opened "opened" can read"yes" can write "no" ## With R-3.3.3 Browse[2]> con description "/home/hrapgc/local/R-3.3.3/library/abind/Meta/package.rds" class "gzfile" mode "rb" text "binary" opened "opened" can read "yes" can write "no" So, in 3.4.0, con refers to a repo and is zero length whereas 3.3.3 refers to a library. To me that would appear to be a major difference. That must have something to do with it. But what? Since the latter works and the former doesn't, it seems as though the problem is with 3.4.0's readRDS(). But others seem not to have the same problem. I'm no closer to understanding what's happenning. -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___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.
[R] Error in readRDS(dest) (was Re: Error with installed.packages with R 3.4.0 on Windows)
On Mon, 22-May-2017 at 05:43AM -0400, Martin Morgan wrote: |> On 05/22/2017 05:10 AM, Patrick Connolly wrote: |> >Apparently it isn't harmless. |> > |> >>install.packages("withr") |> >Error in readRDS(dest) : error reading from connection |> |> that seems like a plain-old network connectivity issue, or perhaps |> an issue with the CRAN mirror you're using. Can you debug on your |> end, e.g,. |> |> options(error=recover) |> install.packages("withr") |> ... |> |> then select the 'frame' where the error occurs, look around |> |> ls() |> |> find the value of 'dest', and e.g., try to open dest in your browser. This is what I get > options(error=recover) > install.packages("withr") ^C Enter a frame number, or 0 to exit 1: install.packages("withr") 2: available.packages(contriburl = contriburl, method = method) 3: tryCatch({ download.file(url = paste0(repos, "/PACKAGES.rds"), destfile 4: tryCatchList(expr, classes, parentenv, handlers) 5: tryCatchOne(expr, names, parentenv, handlers[[1]]) 6: doTryCatch(return(expr), name, parentenv, handler) 7: download.file(url = paste0(repos, "/PACKAGES.rds"), destfile = dest, method Selection: 7 Called from: eval(substitute(browser(skipCalls = skip), list(skip = 7 - which)), envir = sys.frame(which)) Browse[1]> dest Error during wrapup: object 'dest' not found That indicates to me that the problem is further back but I have no idea how make use of that information. Browse[1]> ls() [1] "cacheOK" "destfile" "extra""method" "mode" "quiet""url" Browse[1]> url [1] "http://cran.stat.auckland.ac.nz/src/contrib/PACKAGES.rds; Browse[1]> destfile [1] "/tmp/RtmpplJSrB/repos_http%3A%2F%2Fcran.stat.auckland.ac.nz%2Fsrc%2Fcontrib.rds" Browse[1]> The destfile above is zero-length and I suppose is where dest is intended to end up. Where else should I be looking? Earlier installations never had this issue so I don't have anything to compare. TIA -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___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] Error with installed.packages with R 3.4.0 on Windows
On Fri, 28-Apr-2017 at 07:04PM +0200, peter dalgaard wrote: |> |> > On 28 Apr 2017, at 12:08 , Duncan Murdoch <murdoch.dun...@gmail.com> wrote: |> > |> > On 28/04/2017 4:45 AM, Thierry Onkelinx wrote: |> >> Dear Peter, |> >> |> >> It actually breaks install.packages(). So it is not that innocent. |> > |> > I don't think he meant that it is harmless, he meant that the fix is easy, and is in place in R-patched and R-devel. You should use R-patched and you won't have the problem. |> |> Read more carefully: I said that the _fix_ is harmless for this case, but might not be so in general. |> |> -pd Apparently it isn't harmless. > install.packages("withr") Error in readRDS(dest) : error reading from connection > > > sessionInfo() R version 3.4.0 Patched (2017-05-19 r72713) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 14.04.5 LTS Matrix products: default BLAS: /home/hrapgc/local/R-patched/lib/libRblas.so LAPACK: /home/hrapgc/local/R-patched/lib/libRlapack.so locale: [1] LC_CTYPE=en_NZ.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_NZ.UTF-8LC_COLLATE=en_NZ.UTF-8 [5] LC_MONETARY=en_NZ.UTF-8LC_MESSAGES=en_NZ.UTF-8 [7] LC_PAPER=en_NZ.UTF-8 LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_NZ.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] grDevices utils stats graphics methods base other attached packages: [1] lattice_0.20-35 loaded via a namespace (and not attached): [1] compiler_3.4.0 tools_3.4.0grid_3.4.0 > Has anyone a workaround? -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___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.
[R] R-3.4.0 fails test
After installing R-3.4.0 I ran 'make check' which halted here: $ > tail reg-tests-1d.Rout.fail -n 16 > ## format()ing invalid hand-constructed POSIXlt objects > d <- as.POSIXlt("2016-12-06"); d$zone <- 1 > tools::assertError(format(d)) > d$zone <- NULL > stopifnot(identical(format(d),"2016-12-06")) > d$zone <- "CET" # = previous, but 'zone' now is last > tools::assertError(format(d)) > dlt <- structure( + list(sec = 52, min = 59L, hour = 18L, mday = 6L, mon = 11L, year = 116L, + wday = 2L, yday = 340L, isdst = 0L, zone = "CET", gmtoff = 3600L), + class = c("POSIXlt", "POSIXt"), tzone = c("", "CET", "CEST")) > dlt$sec <- 1 + 1:10 # almost three hours & uses re-cycling .. > fd <- format(dlt) > stopifnot(length(fd) == 10, identical(fd, format(dct <- as.POSIXct(dlt Error: identical(fd, format(dct <- as.POSIXct(dlt))) is not TRUE Execution halted ... so, of course, the remaining tests aren't done. AFAICT, that test will fail anywhere outside of tzone CET, but I could be missing something. What is the point of this test and is there a better way to move on to the remaining tests besides editing the corresponding .R file? Changing the line > stopifnot(length(fd) == 10, identical(fd, format(dct <- as.POSIXct(dlt to > stopifnot(length(fd) == 10, identical(fd, format(dct <- as.POSIXlt(dlt would pass. But would that be any use? TIA (Linux Mint 17.3) -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___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.
[R] What is se.fit in a glm predict list?
I'm trying to calculate a CI for predictions from a Poisson GLM object egg.glm. Browse[2]> aa <- as.data.frame(predict(egg.glm, newdat, type = "response", se.fit = TRUE)[-3]) Browse[2]> bb <- as.data.frame(predict(egg.glm, newdat, se.fit = TRUE)[-3]) Browse[2]> aa fit se.fit 1 6.144212e-07 0.0005114257 2 2.452632e+01 5.4657657443 3 1.44e+01 2.5817126393 4 4.389796e+01 4.5533997800 5 3.820455e+01 4.4827326393 6 6.226667e+01 5.6589154967 Browse[2]> bb fit se.fit 1 -14.302585 832.36979026 2 3.199747 0.22285311 3 2.667228 0.17928560 4 3.781868 0.10372691 5 3.642954 0.11733506 6 4.131426 0.09088194 Browse[2]> bb$fit is clearly log of aa$fit but just what is se.fit? How do I use it to get a CI which is calculated on the log scale? The first one is a bit messy since it is entirely from zeros. Should I remove those or would that be unnecessary? TIA -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___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.
[R] ASReml-R lack of documentation
Has anyone had any success contacting VSNi, distributors of the non-free R package ASReml-R? I tried posting a question on their forum page but the forum software seems to have a bug too. So I tried emailing their support address but with no success. If anyone has had recent success with either, please let me know what you did to achieve it. Better still. if you have experience with predictions from asreml.binomial models, I have a question about a possible bug if you'd bee so kind. TIA -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___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] > Understanding strip.default & strip.custom
On Wed, 29-Jun-2016 at 10:15PM +1000, Duncan Mackay wrote: |> Patrick |> |> Have a look at |> https://stat.ethz.ch/pipermail/r-help/2006-August/110621.html |> and |> https://stat.ethz.ch/pipermail/r-help/2008-June/165279.html |> |> I remember working it out with an example but I cannot remember any of the |> details It would be amazing for anyone to remember those details. ;-) |> |> Regards |> |> Duncan |> |> |> -Original Message- |> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Patrick |> Connolly |> Sent: Wednesday, 29 June 2016 18:30 |> To: Bert Gunter |> Cc: r-h...@stat.math.ethz.ch |> Subject: Re: [R] > Understanding strip.default & strip.custom |> |> On Mon, 27-Jun-2016 at 10:17PM -0700, Bert Gunter wrote: |> |> [...] |> |> |> |> |> You seem to be making this way more difficult than you should. |> |> Though I didn't get any closer to an understanding of which.panel, the |> question I asked was simply answered by |> |> panel.custom(factor.levels = ) |> |> Thanks to Duncan Mackay also. |> |> -- |> ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. |>___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. -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___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] > Understanding strip.default & strip.custom
On Wed, 29-Jun-2016 at 07:57AM -0700, Bert Gunter wrote: |> Did you mean: strip.custom(factor.levels...) ? |> Aaamm yes. Must stop doing this stuff so late. |> (I know of no "panel.custom()" function) |> |> |> -- Bert |> Bert Gunter |> |> "The trouble with having an open mind is that people keep coming along |> and sticking things into it." |> -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) |> |> |> On Wed, Jun 29, 2016 at 1:29 AM, Patrick Connolly |> <p_conno...@slingshot.co.nz> wrote: |> > On Mon, 27-Jun-2016 at 10:17PM -0700, Bert Gunter wrote: |> > |> > [...] |> > |> > |> |> > |> You seem to be making this way more difficult than you should. |> > |> > Though I didn't get any closer to an understanding of which.panel, the |> > question I asked was simply answered by |> > |> > panel.custom(factor.levels = ) |> > |> > Thanks to Duncan Mackay also. |> > |> > -- |> > ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. |> >___Patrick Connolly |> > {~._.~} Great minds discuss ideas |> > _( Y )_ Average minds discuss events |> > (:_~*~_:) Small minds discuss people |> > (_)-(_) . Eleanor Roosevelt |> > |> > ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___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] > Understanding strip.default & strip.custom
On Mon, 27-Jun-2016 at 10:17PM -0700, Bert Gunter wrote: [...] |> |> You seem to be making this way more difficult than you should. Though I didn't get any closer to an understanding of which.panel, the question I asked was simply answered by panel.custom(factor.levels = ) Thanks to Duncan Mackay also. -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___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] R 3.2.4-revised is released
My CRAN mirror still says this: The latest release (Thursday 2016-03-10, Very Secure Dishes) R-3.2.4.tar.gz, read what's new in the latest version. Should that not be updated? Anyone who has not seen that post won't know to look further. On Wed, 16-Mar-2016 at 08:39PM +, Peter Dalgaard wrote: |> The 3.2.4 release had two annoyances which we would rather not have |> in an "ultra-stable" release, designed to hang around for the |> duration of the 3.3 series. One was a relatively minor Makefile |> issue affecting system using R's bundled lzma library. The other, |> rather more serious, affected printing and formatting of POSIXlt |> objects, which would unpredictably get the Daylight Savings Time |> wrong. |> Accordingly a revised version has been created. |> |> You can get the source code from |> |> http://cran.r-project.org/src/base/R-3/R-3.2.4-revised.tar.gz |> |> or wait for it to be mirrored at a CRAN site nearer to you. |> |> Maintainers of binary versions are requested to rebuild their binaries using the revised sources. |> |> |> For the R Core Team, |> |> Peter Dalgaard |> |> New md5 sums are |> |> MD5 (NEWS) = b0b43ac87a5b5858098da065966551af |> MD5 (R-3/R-3.2.4-revised.tar.gz) = 552b0c8088bab08ca4188797b919a58f |> |> The relevant NEWS file entry is |> |> BUG FIXES: |> |> • format.POSIXlt() behaved wrongly, e.g., |> format(as.POSIXlt(paste0(1940:2000,"-01-01"), tz="CET"), |> usetz=TRUE) ended in two "CEST" time formats. |> |> -- |> Peter Dalgaard, Professor, |> Center for Statistics, Copenhagen Business School |> Solbjerg Plads 3, 2000 Frederiksberg, Denmark |> Phone: (+45)38153501 |> Office: A 4.23 |> Email: pd@cbs.dk Priv: pda...@gmail.com |> |> ___ |> r-annou...@r-project.org mailing list |> https://stat.ethz.ch/mailman/listinfo/r-announce |> __ |> 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. -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___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] What "method" does sort() use?
I did look at the Comparison help but totally overlooked this part; Comparison of strings in character vectors is lexicographic within the strings using the collating sequence of the locale in use: see ‘locales’. The collating sequence of locales such as ‘en_US’ is normally different from ‘C’ (which should use ASCII) and can be surprising. I've recently changed to a different Linux distribution and was trying to work out why I was getting a different order of the factor levels even though it was the same code. I thought I'd inadvertantly changed something somehow. Much clearer now -- even if still confusing. Thanks for the pointer. On Fri, 18-Mar-2016 at 10:19AM +0100, peter dalgaard wrote: |> Ooops, that was answering the question you actually asked. The one you meant to ask is answered by this part: |> |> The sort order for character vectors will depend on the collating sequence of the locale in use: see Comparison. |> |> ...and collating sequences is a weird and woolly subject, where you cannot even be sure that locales of the same name on two different platforms sort strings in the same order. |> |> -pd |> |> |> |> On 18 Mar 2016, at 10:13 , peter dalgaard <pda...@gmail.com> wrote: |> |> > |> > On 18 Mar 2016, at 10:02 , Patrick Connolly <p_conno...@slingshot.co.nz> wrote: |> > |> >> I don't follow why this happens: |> >> |> >>> sort(c(LETTERS[1:5], letters[1:5])) |> >> [1] "a" "A" "b" "B" "c" "C" "d" "D" "e" "E" |> >> |> >> The help for sort() says: |> >> |> >> method: character string specifying the algorithm used. Not |> >> available for partial sorting. Can be abbreviated. |> >> |> >> But what are the methods available? The help mentions xtfrm but that |> >> doesn't illuminate, I'd have thought that at least by default it would |> >> have something to do with ASCII codes. But that's not the case since |> >> all the uppercase ones would be before the lowercase ones. |> >> |> >> I know something different is happening but I don't know what it is |> >> (do you, Mr Jones?). Apologies to Bob Dylan. |> >> |> > |> > |> > Um, read _all_ of the help file? |> > |> > sort.int(x, partial = NULL, na.last = NA, decreasing = FALSE, |> > method = c("shell", "quick"), index.return = FALSE) |> > |> > [snip] |> > |> > Method "shell" uses Shellsort (an O(n^{4/3}) variant from Sedgewick (1986)). If x has names a stable modification is used, so ties are not reordered. (This only matters if names are present.) |> > |> > Method "quick" uses Singleton (1969)'s implementation of Hoare's Quicksort method and is only available when x is numeric (double or integer) and partial is NULL. (For other types of x Shellsort is used, silently.) It is normally somewhat faster than Shellsort (perhaps 50% faster on vectors of length a million and twice as fast at a billion) but has poor performance in the rare worst case. (Peto's modification using a pseudo-random midpoint is used to make the worst case rarer.) This is not a stable sort, and ties may be reordered. |> > |> > Factors with less than 100,000 levels are sorted by radix sorting when method is not supplied: see sort.list. |> > |> > -pd |> > |> > |> > -- |> > Peter Dalgaard, Professor, |> > Center for Statistics, Copenhagen Business School |> > Solbjerg Plads 3, 2000 Frederiksberg, Denmark |> > Phone: (+45)38153501 |> > Office: A 4.23 |> > Email: pd@cbs.dk Priv: pda...@gmail.com |> |> -- |> Peter Dalgaard, Professor, |> Center for Statistics, Copenhagen Business School |> Solbjerg Plads 3, 2000 Frederiksberg, Denmark |> Phone: (+45)38153501 |> Office: A 4.23 |> Email: pd@cbs.dk Priv: pda...@gmail.com |> -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___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.
[R] What "method" does sort() use?
I don't follow why this happens: > sort(c(LETTERS[1:5], letters[1:5])) [1] "a" "A" "b" "B" "c" "C" "d" "D" "e" "E" The help for sort() says: method: character string specifying the algorithm used. Not available for partial sorting. Can be abbreviated. But what are the methods available? The help mentions xtfrm but that doesn't illuminate, I'd have thought that at least by default it would have something to do with ASCII codes. But that's not the case since all the uppercase ones would be before the lowercase ones. I know something different is happening but I don't know what it is (do you, Mr Jones?). Apologies to Bob Dylan. -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___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] How to read ./configure messages
Thanks Peter. That certainly got me past that one, (Few more to go) On Mon, 01-Feb-2016 at 09:30PM -0800, Peter Langfelder wrote: |> I am not overly familar with Mint, but you need the "development |> version" of the readline library. If you have a GUI package manager |> installed, open it and search for readline. You should see a version |> that ends with -dev or -devel; you need to install that. |> |> HTH, |> |> Peter |> |> On Mon, Feb 1, 2016 at 3:06 PM, p_connolly <p_conno...@slingshot.co.nz> wrote: |> > |> > I've installed R from the tgz file since about R-0.9.x following the |> > INSTALL instructions and have always succeeded using rpm-based OSes. |> > With each new OS, that involved installing various additional packages |> > before the configure script would complete. Figuring out which |> > packages were required usually involved searching for rpms that |> > supplied missing .so or .h files, dev packages or something else I |> > could figure out. |> > |> > I'm now trying to do the same with LinuxMint 17.2 but I got stuck when |> > this message came up: |> > |> >checking for main in -ltermlib... no |> >checking for rl_callback_read_char in -lreadline... no |> >checking for history_truncate_file... no |> >configure: error: --with-readline=yes (default) and headers/libs are not |> > available |> > |> > Near the bottom of the log file it shows this: |> > |> >configure:6747: gcc -E -I/usr/local/include conftest.c |> >configure:6747: $? = 0 |> >configure:6761: gcc -E -I/usr/local/include conftest.c |> >conftest.c:17:28: fatal error: ac_nonexistent.h: No such file or |> > directory |> > #include |> >^ |> >compilation terminated. |> >configure:6761: $? = 1 |> >configure: failed program was: |> >| /* confdefs.h */ |> >| #define PACKAGE_NAME "R" |> > |> > So I'm assuming that's behind the failure. Searching shows the same |> > problem shows up in all sorts of places for decades, notably cygwin |> > users. But I didn't see anything that would help to work out what is |> > missing. |> > |> > Ideas greatly appreciated. |> > |> > |> > best |> > Patrick |> > |> > __ |> > 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. -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___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] Special characters in regular expressions
On Thu, 24-Sep-2015 at 12:38PM +0200, peter dalgaard wrote: |> |> On 24 Sep 2015, at 12:05 , Thierry Onkelinx <thierry.onkel...@inbo.be> wrote: |> |> > gsub("[A|K]\\|", "", x) |> |> That'll probably do it, but what was the point of the | in [A|K] ?? |> I don't think it does what I think you think it does... |> Somewhat safer, maybe: |> |> gsub("\\|[AK]\\|","\\|", x) |> |> (avoids surprises from, say, "LBAM 5|A|15A|3h") Thanks for that suggestion. Very simple now. |> |> -pd |> |> > [snip] |> > 2015-09-24 11:52 GMT+02:00 Patrick Connolly <p_conno...@slingshot.co.nz>: |> > |> >> I need to change a vector dd that looks like this: |> >> c("LBAM 5|A|15C|3h", "LBAM 5|K|15C|2h") |> >> |> >> into this: |> >> c("LBAM 5|15C|3h", "LBAM 5|15C|2h") |> >> |> >> It's not very imaginative, but I could use a complicated nesting of |> >> gsub() as so: |> >> |> >> gsub("-", "\\|", gsub("K-", "", gsub("A-", "", gsub("\\|", "-", dd |> >> |> >> Or I could make it a bit more readable by using interim objects, |> >> |> >> But I'd prefer to use a single regular expression that can detect "A|" |> >> *and* "K|" without collateral damage from the impact of special |> >> characters and regular characters. |> >> |> |> -- |> Peter Dalgaard, Professor, |> Center for Statistics, Copenhagen Business School |> Solbjerg Plads 3, 2000 Frederiksberg, Denmark |> Phone: (+45)38153501 |> Office: A 4.23 |> Email: pd@cbs.dk Priv: pda...@gmail.com |> |> |> |> |> |> |> |> |> -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___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.
[R] Special characters in regular expressions
I need to change a vector dd that looks like this: c("LBAM 5|A|15C|3h", "LBAM 5|K|15C|2h") into this: c("LBAM 5|15C|3h", "LBAM 5|15C|2h") It's not very imaginative, but I could use a complicated nesting of gsub() as so: gsub("-", "\\|", gsub("K-", "", gsub("A-", "", gsub("\\|", "-", dd Or I could make it a bit more readable by using interim objects, But I'd prefer to use a single regular expression that can detect "A|" *and* "K|" without collateral damage from the impact of special characters and regular characters. TIA -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___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.
[R] Getting predictions for skewed t-distribution
I have a small dataframe xxF, a summary of which looks like this: summary(xxF) T Dev Min. :10.44 Min. :0.008929 1st Qu.:10.44 1st Qu.:0.012048 Median :18.61 Median :0.031250 Mean :17.87 Mean :0.028286 3rd Qu.:22.24 3rd Qu.:0.041667 Max. :30.37 Max. :0.05 I managed to make a non-linear fit after a lot of fiddling with initial values but it looks overly complicated and biologically unconvincing in part. The general form of a skewed t-distribution looks more appropriate so I tried selm from the sn package thus: selmFt - with(xxF, selm(Dev ~ T, family = ST, method=MPLE)) coef(selmFt, param.type=DP) (Intercept.DP) T omega alpha nu -0.0158950990.0026892260.002306132 -5.6608704461.473210455 I wish to get predictions for values of T between 10 and 32 but I can't figure out how to use those coefficients. With an linear model or glm, even without a prediction method, it's fairly simple to get predictions from a range of values of the independent variable/s. For a skewed-t it's evidently less straightforward. Does it have to be done using CP type parameters? Ideas gratefully accepted In case it makes any difference sessionInfo() R version 3.2.1 (2015-06-18) Platform: i686-pc-linux-gnu (32-bit) locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_US.UTF-8LC_COLLATE=en_US.UTF-8 [5] LC_MONETARY=en_US.UTF-8LC_MESSAGES=en_US.UTF-8 [7] LC_PAPER=en_US.UTF-8 LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] stats4grDevices utils stats graphics methods base other attached packages: [1] dplyr_0.3.0.2 nlmrt_2013-9.25RColorBrewer_1.1-2 plyr_1.8.3 [5] stringr_1.0.0 reshape2_1.4.1 sn_1.2-2 lattice_0.20-31 loaded via a namespace (and not attached): [1] Rcpp_0.11.3 assertthat_0.1grid_3.2.1DBI_0.3.1 [5] magrittr_1.0.1stringi_0.4-1 lazyeval_0.1.10 tools_3.2.1 [9] numDeriv_2014.2-1 parallel_3.2.1mnormt_1.5-3 -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___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] Using and abusing %% (was Re: Why can't I access this type?)
On Fri, 27-Mar-2015 at 03:27PM +0100, Henric Winell wrote: | On 2015-03-26 07:48, Patrick Connolly wrote: | | On Wed, 25-Mar-2015 at 03:14PM +0100, Henric Winell wrote: | | ... | | | Well... Opinions may perhaps differ, but apart from '%%' being | | butt-ugly it's also fairly slow: | | Beauty, it is said, is in the eye of the beholder. I'm impressed by | the way using %% reduces or eliminates complicated nested brackets. | | I didn't dispute whether '%%' may be useful -- I just pointed out Likewise I didn't dispute that it might not be as fast as other ways, but I was disputing the claim that it was ugly. | that it is slow. However, it is only part of the problem: | 'filter()' and 'select()', although aesthetically pleasing, also | seem to be slow: So not 'butt ugly' like '%%'? | | mb - microbenchmark( | + f1(), f2(), f3(), f4(), f5(), f6(), | + times = 1000L | + ) | print(mb, signif = 3L) | Unit: microseconds | expr min lq mean median uq max neval cld | f1() 115 124 134.8812129 134 1500 1000 a | f2() 128 141 147.4694145 151 1520 1000 a | f3() 303 328 344.3175338 348 1740 1000 b | f4() 458 494 518.0830510 523 1890 1000 c | f5() 806 848 887.7270875 894 3510 1000d | f6() 971 1010 1056.5659 1040 1060 3110 1000 e | | So, using '%%', but leaving 'filter()' and 'select()' out of the | equation, as in 'f4()' is only half as bad as the full 'dplyr' | idiom in 'f6()'. In this case, since we're talking microseconds, | the speed-up is negligible but that *is* beside the point. Agreed that the more 'dplyr' used the slower it gets but don't agree that it's an issue except in packages that should be optimized. The lack of speed won't stop me using it any more than I'll stop using dataframes because matrices are much faster than them. The OP's example can be done using matrix syntax: state.x77[state.x77[, Frost] 150, Frost, drop = FALSE] which is more than an order of magnitude faster than subscripting a dataframe. See No 4. here: microbenchmark(## 1. using subset() subset(all.states, all.states$Frost 150, select = c(state,Frost)), ## 2. standard R indexing all.states[all.states$Frost 150, c(state,Frost)], ## 3. leave out redundant 'state' column all.states[all.states$Frost 150, Frost, drop = FALSE], ## 4. avoid using 'slow' dataframes altogether state.x77[state.x77[, Frost] 150, Frost, drop = FALSE], ## 5. easy, slow way without square brackets or quote marks all.states %% filter(Frost 150) %% select(state, Frost), times = 1000L ) Unit: microseconds expr subset(all.states, all.states$Frost 150, select = c(state, Frost)) all.states[all.states$Frost 150, c(state, Frost)] all.states[all.states$Frost 150, Frost, drop = FALSE] state.x77[state.x77[, Frost] 150, Frost, drop = FALSE] all.states %% filter(Frost 150) %% select(state, Frost) minlq meanmedianuq max neval cld 223.960 229.9290 236.16557 232.4060 241.4165 291.083 1000 c 177.187 182.6075 203.04666 185.1475 194.4815 7259.760 1000 c 125.281 130.4835 135.83826 132.6985 141.7375 210.576 1000 b 6.442 10.3860 10.61733 11.0405 11.4855 25.077 1000 a 1416.592 1437.7015 1562.91898 1447.5695 1473.4440 9394.071 1000d [...] | | In this tiny example it's not obvious but it's very clear if the | objective is to sort the dataframe by three or four columns and | various lots of aggregation then returning a largish number of | consecutive columns, omitting the rest. It's very easy to see what's | going on without the need for intermediate objects. | | Why are you opposed to using intermediate objects? In this case, I'm not opposed to intermediate objects nor to dogs. It's just easier to keep things tidy without either. | as can be seen from 'f3()', it will also have the benefit of being | faster than either '%%' or the full 'dplyr' idiom. | | | [...] | | It's no surprise that instructing a computer in something closer to | human language is an order of magnitude slower. | | Certainly not true, at least for compiled languages. In any case, | judging from off-list correspondence, it definitely came as a | surprise to some R users... | | Given that '%%' is so heavily marketed through 'dplyr', where the | latter is said to provide blazing fast performance for in-memory | data by writing key pieces in C++ and a fast, consistent tool for | working with data frame like objects, both in memory and out of | memory, I don't think it's far-fetched to expect that it should be | more performant than base R. | I've never come across 'marketing' of free software. Evidently that's a looser use of the word. ... | I spend 3 or 4 orders
Re: [R] Why can't I access this type?
On Thu, 26-Mar-2015 at 04:58PM -0400, yoursurrogate...@gmail.com wrote: [...] | I agree with you on the indexing approach. But even after using | within, I still get the same error. You leave us to guess just what you tried, but if you did this: all.states - within(as.data.frame(state.x77), state - rownames(state.x77)) and then again did this: cold.states - all.states[all.states$Frost 150, c(Name, Frost)] of course it will give the same error, because as you haven't addressed the problem as you've been told On Sun, 22-Mar-2015 at 08:06AM -0800, John Kane wrote: | Well, first off, you have no variable called Name. You have lost | the state names as they are rownames in the matrix state.x77 and | not a variable. If you did this: all.states - within(as.data.frame(state.x77), Name - rownames(state.x77)) instead of all.states - within(as.data.frame(state.x77), state - rownames(state.x77)) then this would worka; cold.states - all.states[all.states$Frost 150, c(Name, Frost)] Modify the above to match where my guess at what you tried is in error. HTH -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___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.
[R] Using and abusing %% (was Re: Why can't I access this type?)
On Wed, 25-Mar-2015 at 03:14PM +0100, Henric Winell wrote: ... | Well... Opinions may perhaps differ, but apart from '%%' being | butt-ugly it's also fairly slow: Beauty, it is said, is in the eye of the beholder. I'm impressed by the way using %% reduces or eliminates complicated nested brackets. In this tiny example it's not obvious but it's very clear if the objective is to sort the dataframe by three or four columns and various lots of aggregation then returning a largish number of consecutive columns, omitting the rest. It's very easy to see what's going on without the need for intermediate objects. | | . | Unit: microseconds | |expr | subset(all.states, all.states$Frost 150, select = c(state, | Frost)) |all.states[all.states$Frost 150, | c(state, Frost)] |all.states %% filter(Frost 150) %% | select(state, Frost) | min lq meanmedianuq max neval cld | 139.112 148.673 163.3960 159.1760 170.7895 1763.200 1000 b | 104.039 111.973 127.2138 120.4395 128.6640 1381.809 1000 a | 1010.076 1033.519 1133.1469 1107.8480 1175.1800 2932.206 1000 c It's no surprise that instructing a computer in something closer to human language is an order of magnitude slower. I'm sure you'd get something even quicker using machine code. I spend 3 or 4 orders of magnitude more time writing code than running it. It's much more important to me to be able to read and modify than it is to have it run at optimum speed. | | Of course, this doesn't matter for interactive one-off use. But | lately I've seen examples of the '%%' operator creeping into | functions in packages. That could indicate that %% is seductively easy to use. It's probably true that there are places where it should be done the hard way. | However, it would be nice to see a fast pipe operator as part of | base R. | | | Henric Winell | -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___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] Why can't I access this type?
On Sun, 22-Mar-2015 at 08:06AM -0800, John Kane wrote: | Well, first off, you have no variable called Name. You have lost | the state names as they are rownames in the matrix state.x77 and | not a variable. | | Try this. It's ugly and I have no idea why I had to do a cbind() You don't have to use cbind | but it seems to work. Personally I find subset easier to read than | the indexing approach. | state - rownames(state.x77) | all.states - as.data.frame(state.x77) | all.states - cbind(state, all.states) ### ? You don't have to use cbind() all.states - within(as.data.frame(state.x77), state - rownames(state.x77)) but I think cbind is simpler to read. | | coldstates - subset(all.states, all.states$Frost 50, | select = c(state,Frost) ) Tidier, even more so than subset(): require(dplyr) coldstates - all.states %% filter(Frost 150) %% select(state, Frost) Or, easier to see what's happening: coldstates - all.states %% filter(Frost 150) %% select(state, Frost) | | | John Kane | Kingston ON Canada | | | -Original Message- | From: yoursurrogate...@gmail.com | Sent: Sun, 22 Mar 2015 10:39:03 -0400 | To: r-help@r-project.org | Subject: [R] Why can't I access this type? | | Hi, I'm just learning my way around R. I got a bunch of states and would | like to access to get all of the ones where it's cold. But when I do the | following, I will get the following error: | | all.states - as.data.frame(state.x77) | cold.states - all.states[all.states$Frost 150, c(Name, Frost)] | Error in `[.data.frame`(all.states, all.states$Frost 150, c(Name, : |undefined columns selected | | I don't get it. When I look at all.states, this is what I see: | | str(all.states) | 'data.frame': 50 obs. of 8 variables: | $ Population: num 3615 365 2212 2110 21198 ... | $ Income: num 3624 6315 4530 3378 5114 ... | $ Illiteracy: num 2.1 1.5 1.8 1.9 1.1 0.7 1.1 0.9 1.3 2 ... | $ Life Exp : num 69 69.3 70.5 70.7 71.7 ... | $ Murder: num 15.1 11.3 7.8 10.1 10.3 6.8 3.1 6.2 10.7 13.9 ... | $ HS Grad : num 41.3 66.7 58.1 39.9 62.6 63.9 56 54.6 52.6 40.6 ... | $ Frost : num 20 152 15 65 20 166 139 103 11 60 ... | $ Area : num 50708 566432 113417 51945 156361 ... | | What am I messing up? | | [[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. | | | FREE ONLINE PHOTOSHARING - Share your photos online with your friends and family! | Visit http://www.inbox.com/photosharing to find out more! | | __ | 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. -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___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.
[R] Oddity using multcompView package
to show here) it makes more sense to modify the Group column by changing the e to a and moving the other letters along by 1. The code for the multcompLetters function is nicely commented but before I launch into checking it for bugs, I thought it prudent to ask if anyone else had encountered anything similar. Or am I simply asking too much of an unbalanced data set? sessionInfo() R version 3.1.1 (2014-07-10) Platform: i686-pc-linux-gnu (32-bit) locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_US.UTF-8LC_COLLATE=en_US.UTF-8 [5] LC_MONETARY=en_US.UTF-8LC_MESSAGES=en_US.UTF-8 [7] LC_PAPER=en_US.UTF-8 LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] grid grDevices utils stats graphics methods base other attached packages: [1] dplyr_0.3.0.2 multcompView_0.1-5 lattice_0.20-29 loaded via a namespace (and not attached): [1] assertthat_0.1 DBI_0.3.1 lazyeval_0.1.9 magrittr_1.0.1 parallel_3.1.1 [6] Rcpp_0.11.3tools_3.1.1 TIA -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_ Average minds discuss events (:_~*~_:) Small minds discuss people (_)-(_) . Eleanor Roosevelt ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. PS: the problem existed without dplyr and DBI __ 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] Unexpected behaviour of plyr::ddply
On Wed, 17-Sep-2014 at 12:36AM -0300, walmes . wrote: | Hello R users, | | I'm writing a brief tutorial of getting statistical measures by splitting | according strata and over columns. When I used plyr::ddply I got and | unexpected result, with NA/NaN for non existing cells. Below is a minimal | reproducible code with the result that I got. For comparison, the result of | aggregate is showed. Why this behaviour? What I can do to avoid it? | | require(plyr) | | hab - | + read.table(http://www.leg.ufpr.br/~walmes/data/ipea_habitacao.csv;, | +header=TRUE, sep=,, stringsAsFactors=FALSE, quote=, | +encoding=utf-8) | | hab - hab[,-ncol(hab)] | names(hab) - c(sig, cod, mun, agua, ener, tel, carro, | + comp, tot) | hab - transform(hab, sig=factor(sig)) | hab$siz - cut(hab$tot, breaks=c(-Inf, 5000, Inf), | +labels=c(P,G)) However: summary(hab$tot) Min. 1st Qu. MedianMean 3rd Qu.Max.NA's 2271328264082645440 3039000 89 Those NAs interfere with the cut() statement. The simplest work around is hab - na.omit(hab) Then ddply will play nicely. HTH -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_ Average minds discuss events (:_~*~_:) Small minds discuss people (_)-(_) . Eleanor Roosevelt ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. __ 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] yaxs Causes Boundary Line Colour to Change
I can't reproduce it either using x11 or pdf devices. I'm curious to know just how you manage to get that result. On Mon, 25-Aug-2014 at 10:15AM -0400, Sarah Goslee wrote: | I can't reproduce this on R 3.1.0 on linux or R 3.1.1 on Mac, using | the default graphics device on each. | | What graphics device are you using? | | If all else fails, you could use box() to draw over it. | | Sarah | | On Mon, Aug 25, 2014 at 8:00 AM, Dario Strbenac | dstr7...@uni.sydney.edu.au wrote: | Why is the bottom boundary plotted in a different colour to the other three sides ? | | set.seed() | data - rpois(10, 2) | plot(density(data), ann = FALSE, yaxs = 'i') # Grey bottom boundary. | plot(density(data), ann = FALSE) # All boundaries are black. | | Ideally, there would be black lines on all four sides. The documentation doesn't say the colour will change. | | sessionInfo() | R version 3.1.1 (2014-07-10) | Platform: x86_64-unknown-linux-gnu (64-bit) | | -- | Dario Strbenac | PhD Student | University of Sydney | Camperdown NSW 2050 | Australia | | __ | 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. | | | | -- | Sarah Goslee | http://www.functionaldiversity.org | | __ | 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. -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_ Average minds discuss events (:_~*~_:) Small minds discuss people (_)-(_) . Eleanor Roosevelt ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. __ 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] Fwd; Trellis devices and pointize
Thanks Deepayan, I'd never have figured that out for myself. On Sat, 21-Jun-2014 at 08:47PM +0530, Deepayan Sarkar wrote: | On Sat, Jun 21, 2014 at 1:00 PM, Patrick Connolly | p_conno...@slingshot.co.nz wrote: | Hello Deepayan, | | The question below I asked on the Rhelp list. For the first time in | my experience, what Brian Ripley says seems not to be the case. No | one else made any comment, hence this direction to the main Lattice | man. | | It might, indeed, be more of a grid issue which you would understand | better than the rest of us. Please direct me to any documentation | that covers the question. My searches have been unsuccessful. | | Basically, the settings are taken from | | trellis.par.get(fontsize) | $text | [1] 12 | | $points | [1] 8 | | I'll give a more detailed response on r-help. | | -Deepayan | | Thank you. | | | - Forwarded message from Patrick Connolly p_conno...@slingshot.co.nz - | | Date: Thu, 12 Jun 2014 21:01:20 +1200 | From: Patrick Connolly p_conno...@slingshot.co.nz | To: Prof Brian Ripley rip...@stats.ox.ac.uk | Cc: R-help r-help@r-project.org | Subject: Re: [R] Trellis devices and pointize | User-Agent: Mutt/1.5.21 (2010-09-15) | | On Mon, 09-Jun-2014 at 08:33AM +0100, Prof Brian Ripley wrote: | | | The issue here is not trellis.device. | | | | You are using lattice plots (without mentioning lattice), which are | | based on package 'grid' and so using the grid sub-system of a | | device. That sub-system does not use the 'pointsize' of the device | | as its initial font size. So you need to use | | | | grid::gpar(fontsize = 28) | | | | If I call that after opening the device I get what I guess you expected. | | I don't see it making any difference at all. At one time I supposed | that some clever inner workings rescaled everything to something more | sensible for a plotting region that size, but that is not the case. | |trellis.device(device = pdf, file = Singers.pdf, height = 160/25.4, | + width = 160/25.4) | | grid::get.gpar()$fontsize | [1] 12 | grid::gpar(fontsize = 8) | $fontsize | [1] 8 | | grid::get.gpar()$fontsize | [1] 12 | | | Evidently I missed something somewhere. Grid graphics is sometimes a | bit too subtle for me. I know gpar() doesn't work exactly analogously | to the way par() works. I can't find any examples in Paul's R | Graphics book or Deepayan's Lattice book (but that might just be | lack of searching skills). | | Then I tried putting it in the call to print.trellis: | |print(pik, plot.args = grid::gpar(fontsize = 8)) | | and in the bwplot() call similar to the way I'd done in panel functions | with an argument called gp but I get no error message or any | difference in my resulting plot. | | I know I can fiddle with trellis.par.get() and trellis.par.set() but | that's a bit long-winded when it's so simple to do in base graphics. | | TA | | | | | | | On 09/06/2014 07:54, Patrick Connolly wrote: | | How is the pointsize set in trellis.devices? | | | | From my reading of the trellis.device help file, I understood that the | | pointsize arg would be referenced to the call to the pdf function. | | | | So I set up a trellis pdf device as so: | | | |trellis.device(device = pdf, file = Singers.pdf, height = 160/25.4, | | width = 160/25.4, pointsize = 28) | | | | A base R graphics plot works as I'd expected. | | | |plot(1:10, 50:59) # silly plot with huge plotting characters and letters | | | | However, pointsize is ignored in trellis plots; | | | |pik - bwplot(voice.part ~ height, data = singer)# pointsize ignored | |print(pik) | |dev.off() | | | | There are many trellis cex-type settings, but FWIU they're all | | relative to the default size. My question is: How do I set that | | default? | | | | | | R version 3.0.2 (2013-09-25) | | Platform: i686-pc-linux-gnu (32-bit) | | | | locale: | | [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C | | [3] LC_TIME=en_US.UTF-8LC_COLLATE=en_US.UTF-8 | | [5] LC_MONETARY=en_US.UTF-8LC_MESSAGES=en_US.UTF-8 | | [7] LC_PAPER=en_US.UTF-8 LC_NAME=C | | [9] LC_ADDRESS=C LC_TELEPHONE=C | | [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C | | | | attached base packages: | | [1] grDevices utils stats graphics methods base | | | | other attached packages: | | [1] RColorBrewer_1.0-5 lattice_0.20-24 | | | | loaded via a namespace (and not attached): | | [1] grid_3.0.2 plyr_1.8tools_3.0.2 | | | | I've tried with R-3.1.0 on another machine so I don't think the | | problem is with an old version. | | | | I doubt it has much to do with pdf specifically. Attempts to use png, | | bitmap, postscript devices all produce equivalent results. | | | | | | | | (Here's all the example code uninterrupted:) | | | |trellis.device(device = pdf, file
Re: [R] Trellis devices and pointize
On Mon, 09-Jun-2014 at 08:33AM +0100, Prof Brian Ripley wrote: | The issue here is not trellis.device. | | You are using lattice plots (without mentioning lattice), which are | based on package 'grid' and so using the grid sub-system of a | device. That sub-system does not use the 'pointsize' of the device | as its initial font size. So you need to use | | grid::gpar(fontsize = 28) | | If I call that after opening the device I get what I guess you expected. I don't see it making any difference at all. At one time I supposed that some clever inner workings rescaled everything to something more sensible for a plotting region that size, but that is not the case. trellis.device(device = pdf, file = Singers.pdf, height = 160/25.4, + width = 160/25.4) grid::get.gpar()$fontsize [1] 12 grid::gpar(fontsize = 8) $fontsize [1] 8 grid::get.gpar()$fontsize [1] 12 Evidently I missed something somewhere. Grid graphics is sometimes a bit too subtle for me. I know gpar() doesn't work exactly analogously to the way par() works. I can't find any examples in Paul's R Graphics book or Deepayan's Lattice book (but that might just be lack of searching skills). Then I tried putting it in the call to print.trellis: print(pik, plot.args = grid::gpar(fontsize = 8)) and in the bwplot() call similar to the way I'd done in panel functions with an argument called gp but I get no error message or any difference in my resulting plot. I know I can fiddle with trellis.par.get() and trellis.par.set() but that's a bit long-winded when it's so simple to do in base graphics. TA | | | On 09/06/2014 07:54, Patrick Connolly wrote: | How is the pointsize set in trellis.devices? | | From my reading of the trellis.device help file, I understood that the | pointsize arg would be referenced to the call to the pdf function. | | So I set up a trellis pdf device as so: | |trellis.device(device = pdf, file = Singers.pdf, height = 160/25.4, | width = 160/25.4, pointsize = 28) | | A base R graphics plot works as I'd expected. | |plot(1:10, 50:59) # silly plot with huge plotting characters and letters | | However, pointsize is ignored in trellis plots; | |pik - bwplot(voice.part ~ height, data = singer)# pointsize ignored |print(pik) |dev.off() | | There are many trellis cex-type settings, but FWIU they're all | relative to the default size. My question is: How do I set that | default? | | | R version 3.0.2 (2013-09-25) | Platform: i686-pc-linux-gnu (32-bit) | | locale: | [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C | [3] LC_TIME=en_US.UTF-8LC_COLLATE=en_US.UTF-8 | [5] LC_MONETARY=en_US.UTF-8LC_MESSAGES=en_US.UTF-8 | [7] LC_PAPER=en_US.UTF-8 LC_NAME=C | [9] LC_ADDRESS=C LC_TELEPHONE=C | [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C | | attached base packages: | [1] grDevices utils stats graphics methods base | | other attached packages: | [1] RColorBrewer_1.0-5 lattice_0.20-24 | | loaded via a namespace (and not attached): | [1] grid_3.0.2 plyr_1.8tools_3.0.2 | | I've tried with R-3.1.0 on another machine so I don't think the | problem is with an old version. | | I doubt it has much to do with pdf specifically. Attempts to use png, | bitmap, postscript devices all produce equivalent results. | | | | (Here's all the example code uninterrupted:) | |trellis.device(device = pdf, file = Singers.pdf, height = 160/25.4, | width = 160/25.4, pointsize = 28) |plot(1:10, 50:59) # silly plot with huge plotting characters and letters |pik - bwplot(voice.part ~ height, data = singer)# pointsize ignored |print(pik) |dev.off() | | | TIA | | | | | -- | Brian D. Ripley, rip...@stats.ox.ac.uk | Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ | University of Oxford, Tel: +44 1865 272861 (self) | 1 South Parks Road, +44 1865 272866 (PA) | Oxford OX1 3TG, UKFax: +44 1865 272595 -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_ Average minds discuss events (:_~*~_:) Small minds discuss people (_)-(_) . Eleanor Roosevelt ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. __ 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] Trellis devices and pointize
How is the pointsize set in trellis.devices? From my reading of the trellis.device help file, I understood that the pointsize arg would be referenced to the call to the pdf function. So I set up a trellis pdf device as so: trellis.device(device = pdf, file = Singers.pdf, height = 160/25.4, width = 160/25.4, pointsize = 28) A base R graphics plot works as I'd expected. plot(1:10, 50:59) # silly plot with huge plotting characters and letters However, pointsize is ignored in trellis plots; pik - bwplot(voice.part ~ height, data = singer)# pointsize ignored print(pik) dev.off() There are many trellis cex-type settings, but FWIU they're all relative to the default size. My question is: How do I set that default? R version 3.0.2 (2013-09-25) Platform: i686-pc-linux-gnu (32-bit) locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_US.UTF-8LC_COLLATE=en_US.UTF-8 [5] LC_MONETARY=en_US.UTF-8LC_MESSAGES=en_US.UTF-8 [7] LC_PAPER=en_US.UTF-8 LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] grDevices utils stats graphics methods base other attached packages: [1] RColorBrewer_1.0-5 lattice_0.20-24 loaded via a namespace (and not attached): [1] grid_3.0.2 plyr_1.8tools_3.0.2 I've tried with R-3.1.0 on another machine so I don't think the problem is with an old version. I doubt it has much to do with pdf specifically. Attempts to use png, bitmap, postscript devices all produce equivalent results. (Here's all the example code uninterrupted:) trellis.device(device = pdf, file = Singers.pdf, height = 160/25.4, width = 160/25.4, pointsize = 28) plot(1:10, 50:59) # silly plot with huge plotting characters and letters pik - bwplot(voice.part ~ height, data = singer)# pointsize ignored print(pik) dev.off() TIA -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_ Average minds discuss events (:_~*~_:) Small minds discuss people (_)-(_) . Eleanor Roosevelt ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. __ 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] Character type and size using spatstats
On Thu, 15-May-2014 at 03:00PM +1200, Rolf Turner wrote: | | Dear Patrick, | | (a) Your attachment did not come through; only attachments with | extensions belonging to a limited class are passed through by the | list software. I should have made use of dput() twice instead. However, it can be got at https://db.tt/ic5YDzpN | | Perhaps you could email your data set to me privately, | | (b) I have only had a quick glance at your code. A few comments: | | * In your first call to ppp(), range(ColN), range(Row) will be | ignored. They would be used to construct a (rectangular) window | except for the fact that you have specified window explicitly. | | * the argument maxsize gets used only if the marks involved are | *numeric*; it'll be ignored when the marks are a factor. | | * the argument chars should take values which would be acceptable | as values of the pch argument to plot(). The levels of | Concept do not meet this requirement. But the elements of bb9$Pch do meet that requirement and that approach still fails. Something else is missing. The use of chars appears only once in that PDF file, so I didn't have enough to work it out for myself. | | * if I were me I wouldn't clutter things up by plotting the density | estimate initially. Just plot the pattern, until you get the | sort of result you want. *Then* overlay it on top of a density | plot. | | (c) If you send me the data off-list and explain in words what it | is that you want to achieve (Tell me what you want to do not how | you want to do it.) then I'm pretty sure that I can show you how | to achieve it. A picture is worth a thousand words. I think when you see what the example code produces, it will be clear what I wish to achieve. I'm sure it's something very simple but evidently too subtle for Pooh (who is a bear with only a small brain). Thanks for the help, Rolf. best Patrick | | cheers, | | Rolf | | On 15/05/14 14:25, p_connolly wrote: | The spatstat package has hundreds of useful functions but I'm having | trouble understanding the intricate ways it does things. I've read lots of | Rspatialcourse_CMIS_PDF Standard.pdf from here: | http://www.csiro.au/resources/pf16h but can't find what I need to know. I'm | particularly interested in how to set the plotting character and its | size in density plots. | | |require(spatstat) |load(CharacterSizeRData) # (attached to this message) |ls() | [1] all.win bb9 |head(bb9) | Col Row ColN Concept Pch VinesJune VinesAug New Event | 1A 10 3.33 Gold 4x 442 41 1 TRUE | 8A 16 3.33 Gold 4x 442 41 1 TRUE | 10 A 18 3.33 Gold 4x 442 41 1 TRUE | 11 A 19 3.33 Gold 4x 442 41 1 TRUE | 14 A 21 3.33 Gold 4x 442 41 1 TRUE | 18 A 24 3.33 Gold 4x 442 34 8 TRUE | | ## If I make a ppp class object from bb9, like so: |ppp9A - with(bb9, ppp(ColN, Row, range(ColN), range(Row), window = | all.win, | marks = Concept)) | ## I can do a density plot: |plot(density(ppp9A, 5, edge = FALSE, weights = bb9$New), main = ppp9A) | ## Adding to show the points: |plot(ppp9A, add = TRUE, cols = red, maxsize = max(bb9$New)/20) | ## works except that maxsize is ignored. | ## | ## If I make the ppp object like this: |ppp9B - with(bb9, ppp(ColN, Row, range(ColN), range(Row), window = | all.win, | marks = New)) |plot(density(ppp9B, 5, edge = FALSE, weights = bb9$New), main = ppp9B) |plot(ppp9B, add = TRUE, cols = red, maxsize = max(bb9$New)/20) | ## maxsize works how I intended. | ## | ## I tried to combine plotting character and size with a fancier use of | marks |ppp9C - with(bb9, ppp(ColN, Row, range(ColN), range(Row), window = | all.win, | marks = data.frame(New, Concept))) | ## Then try |plot(density(ppp9C, 5, edge = FALSE, weights = marks(ppp9C)$New), | main = ) |plot(ppp9C, add = TRUE, cols = red, chars = | levels(marks(ppp9C)$Concept), | maxsize = max(marks(ppp9C)$New)/20) | ## chars is ignored and no error message to complain or explain | | What I wish to know is how to get plotting character and size | information displayed simultaneously. I tried ways of specifying it | from bb9 dataframe instead of the ppp object, or specifying a fixed | value but it's always ignored. Ideally, I'd like to customize the | plotting characters used, but getting the defaults to work would be a | start. -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_ Average minds discuss events (:_~*~_:) Small minds discuss people (_)-(_) . Eleanor Roosevelt
Re: [R] how to make R plot under Linux
On Thu, 15-May-2014 at 09:37AM +0800, 友文 wrote: | In our server, R is already installed. But the X11 is DISABLE. | The operational system of server is Ubuntu. It is only a command | line system without graph interface. | Do you know how to Enable X11 in R on the Ubuntu server? | I have a short chat with the administrator, he told me it is | technical impossible to install X11 in the server. But I suspect | his answer. There should be ways to solve it. I understand that Rstudio can work through a browser to an Rstudio server without X11. I'd personally hate to work that way so I've never checked it out, but others are less fussy. It might work for you. | Thanks! | | | -- Original -- | From: MacQueen, Don;macque...@llnl.gov; | Date: May 15, 2014 | To: 815551...@qq.com; r-h...@stat.math.ethz.chr-h...@stat.math.ethz.ch; | | Subject: Re: [R] how to make R plot under Linux | | | | Yes, install R so that X11 is enabled, then do | | x11() | hist( c(1:10) ) | | and you should see your histogram. | | -- | Don MacQueen | | Lawrence Livermore National Laboratory | 7000 East Ave., L-627 | Livermore, CA 94550 | 925-423-1062 | | | | | | On 5/14/14 1:26 AM, Owen 815551...@qq.com wrote: | | Vojt??ch Zeisek Vojtech.Zeisek at opensuse.org writes: | | | On Linux You can use Rkward http://rkward.sourceforge.net/ - very nice | and | good graphical user interface for R. | | Dne P?? 19. ??nora 2010 19:39:53 xinwei at stat.psu.edu napsal(a): | Hi, I am using R in Linux environment. How can i make plot in Linux | just | like in windows? | | thanks | | __ | R-help at 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. | | Hi, | I have connected to the Linux server via ssh -X using Putty and can | successfully show xclock window in Xming. | However, when i used R and run command hist(c(1:10)), i cannot get the | figure in the Xming window (nothing happened in the Xming window). | The output of capabilities() is as following: | capabilities() | jpeg png tifftcltk X11 aqua http/ftp sockets | TRUE TRUEFALSEFALSEFALSEFALSE TRUE TRUE | libxml fifo clediticonv NLS profmemcairo | TRUE TRUE TRUE TRUE TRUEFALSE TRUE | | What should i do to see the popup plot of R? should i need to ask the | Administrator to enable X11? | Thanks! | | __ | 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. | | . | [[alternative HTML version deleted]] | | __ | 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. -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_ Average minds discuss events (:_~*~_:) Small minds discuss people (_)-(_) . Eleanor Roosevelt ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. __ 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] listserv subscription
You should have received an email each month with the link for modifying your subscription. If you can't find it, use this one. https://stat.ethz.ch/mailman/options/r-help On Thu, 20-Feb-2014 at 08:45AM -0500, Simone Gill-Alvarez wrote: | To Whom It May Concern: | | I am subscribed to this listserv, but I would like to switch my settings so | that I receive a daily batched email rather than individual messages. Is it | possible to do that, or do I need to unsubscribe and then resubscribe? | | Best, | | Simone Gill | | [[alternative HTML version deleted]] | | __ | 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. -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_ Average minds discuss events (:_~*~_:) Small minds discuss people (_)-(_) . Eleanor Roosevelt ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. __ 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] Categorizing and displaying excel data in tabular format
On Wed, 05-Feb-2014 at 08:20AM -0800, ashrafali wrote: | Thank you David. | | I tried the Table function with two columns | | table(R_format$Client.Mnemonic,R_format$Tasks) | | and got something like the one I have attached in this word file | Task_Summary_for_Clients.docx | http://r.789695.n4.nabble.com/file/n4684797/Task_Summary_for_Clients.docx | | I need to make something like a graphical plot which should be like the | image below: | | http://r.789695.n4.nabble.com/file/n4684797/Task.Client.jpg That doesn't look anything like any type of plot I've seen. It's more like a table in HTML. | | Is there any function which I can use for that. If that's what you need, check out the toHTML function in the tools package. HTH -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_ Average minds discuss events (:_~*~_:) Small minds discuss people (_)-(_) . Eleanor Roosevelt ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. __ 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] creating an equivalent of r-help on r.stackexchange.com ? (was: Re: Should there be an R-beginners list?)
On Tue, 04-Feb-2014 at 01:11AM +0100, Liviu Andronic wrote: | Dear Don and Bert, | Allow me to address some of your concerns below. | Which you do very clearly by positioning your responses underneath what you're commenting on. That doesn't seem to be possible on SE. [...] | On Mon, Feb 3, 2014 at 12:42 PM, MacQueen, Don | macque...@llnl.gov wrote: | - They waste copious amounts of screen space on irrelevant | things such as votes, the number of views, the elapsed time | since something or other happened, fancy web-page headers, and | so on. Oh, and advertisements. The Mathematica stackexchange | example given in a link in one of the emails below | (http://mathematica.stackexchange.com/) illustrates these | shortcomings -- and it's not the worst such example. | | Well, I've seen my fair share of advertisements on Gmail, Yahoo Mail | or what have you. I know some use dedicated clients, but not all do. Thunderbird with an IMAP setup avoids advertisements entirely even on Gmail and Yahoo Mail (and is quicker). | (And sofar I haven't noticed one single intrusive or distracting ad on | SE.) They do take up screen space where something more usable could use it. [...] | Right now, at this very moment, in my email client's window I | can see and browse the subject lines of 20 threads in | r-help. And that's using only about half of my screens vertical | space. In contrast, in the Mathematica stackexchange example, I | can see at most 10, and that only by using the entire vertical | space of my screen. The From column in my email client shows | the names of several of the people contributing to the thread, | which the browser interface does not. In the email client, I can | move through messages, and between messages in a thread using my | keyboard. In a browser, I have to do lots of mousing and | clicking, which is much less efficient. | | Again, fair point, but with SE you quickly realize that this is | irrelevant. On ML, even more so on r-help, the only sane way to | sort and filter the messages is using time. ... Call me insane but I find sorting by thread within subject far more useful. Seeing who else has already commented on the subject helps to give me a good idea whether it's a subject I'm interested in. If not I delete the whole thread and leave space on my screen where I can see 75 subject lines without scrolling. If it's an interesting thread, I save it to an appropriate folder on my disk. A browser interface can't come close to that usability. Many people have never seen mail displayed in threads and so have little idea what I'm referring to. [...] | It is also much easier to filter questions by topics: if you're | interested in GUI or plyr related questions, just display those | tags, and then answer relevant questions. On r-help you may only | guess from the subject line what the question could possibly be | about. My mail client allows me to filter by any string in the body of the message. It's rather useful. rant I'm evidently in a decreasing minority group who learnt to use computers with punch cards (and patch panels for differential equations) which probably colours my view. The fact that simpler effective means of communications are being taken over by whizz-bang complicated inefficient ones is a cause for concern. I belong to a group (as distinct from the aforementioned minority group) which has never known the delights of an efficient mailing list and flounders around trying to communicate via Facebook. The level of communication is appalling: nobody ever knows what's going on. We might as well be using punch cards./rant best -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_ Average minds discuss events (:_~*~_:) Small minds discuss people (_)-(_) . Eleanor Roosevelt ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. __ 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] Is this a bug or am I making a mistake?
On Mon, 06-Jan-2014 at 07:38PM +, William Dunlap wrote: | You could compare the outputs of | z1 - with(dd, dd$EVYEAR==2012 dd$EVMONTH=='02') Wouldn't with(dd, EVYEAR==2012 EVMONTH=='02') be sufficient when using with()? | (which is like subset()) and that of | z2 - dd$EVYEAR==2012 dd$EVMONTH=='02' | (evaluated from within the same context) with | table(z1, z2, exclude=NULL) | That may show something useful. | | Bill Dunlap | Spotfire, TIBCO Software | wdunlap tibco.com | | | -Original Message- | From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf | Of Walter Anderson | Sent: Monday, January 06, 2014 11:17 AM | To: Sarah Goslee | Cc: R Help | Subject: Re: [R] Is this a bug or am I making a mistake? | | On 01/06/2014 11:14 AM, Sarah Goslee wrote: | Hi Walter, | | I can't reproduce your results. Please provide some data that | demonstrates the problem. | | http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible- | example | | subset() and [ differ in their handling of NA values, and you don't | need the dd$ in the arguments to subset(). | | But those don't explain your result given the information provided. | Please provide more information. | | Sarah | | | On Mon, Jan 6, 2014 at 12:06 PM, Walter Anderson wandrso...@gmail.com wrote: | I have a data frame that I am extracting some records from and noticed the | following issue | | I originally used tmp - subset(dd, dd$EVYEAR==2012 dd$EVMONTH=='02') | | and noticed that I wasn't ending up with all of the records I should have; | however, when I used | | tmp - dd[dd$EVYEAR==2012 dd$EVMONTH=='02',] | | I did get all of the records I should have. | | I thought the two forms were equivalent, am I mistaken? | | Thanks everyone for the response. I didn't provide a reproducible test, | since the data I experienced this issue with was quite large ( 40MB) | and I have not been able to reproduce the problem with any other data | set. I have also performed the subset using Microsoft Access on the | original dbf file I use for the data frame and confirmed that the second | query format (dd[QUERY,]) is producing the correct results. It doesn't | appear that any of the impacted (or any in the data frame) contain NA | records. | | I am not really looking for any particular solution, but was surprised | by the different results from what I presumed to be the same query. If | it is believed to be a possible bug, I would be glad to package up the | data that is generating the issue, but not sure where to place such a | large data set. | | __ | 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-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. -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_ Average minds discuss events (:_~*~_:) Small minds discuss people (_)-(_) . Eleanor Roosevelt ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. __ 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] RWeka and multicore package
On Thu, 17-Oct-2013 at 02:21PM -0300, Luís Paulo F. Garcia wrote: | I work very mutch with the packages RWeka and multicore. If you try to run | J48 or any tree of RWeka with multicore we hava some errors. | | Example I: | | library(RWeka); | library(multicore); | | mclapply(1:100, function(i) { | J48(Species ~., iris); | }); | | | Output: Error in .jcall(o, \Ljava/lang/Class;\, \getClass\) : \n | java.lang.ClassFormatError: Incompatible magic value 1347093252 in class | file java/lang/ProcessEnvironment$StringEnvironment\n | | | Example II: | | library(multicore); | | mclapply(1:100, function(i) { | RWeka::J48(Species ~., iris); | }); | | Output: Erro em .jcall(x$classifier, S, toString) : | RcallMethod: attempt to call a method of a NULL object. | | | Do you know some way to work with parallel processing and RWeka? I tried | MPI and SNOW without success. Not much help, but I too have not been able to get parallelling RWeka to work. OTOH, what RWeka can do is very fast compared with, say, gbm (which does work well with mclapply). I suspect that it has something to do with how Java is set up, but I know nothing about setting up Java. | | R version 3.0.2 (2013-09-25) -- Frisbee Sailing | Ubuntu 12.04 x64 | | | -- | Lu?s Paulo Faina Garcia | Engenheiro de Computa??o - Universidade de S?o Paulo | S?o Carlos - SP - Brasil | | [[alternative HTML version deleted]] | | __ | 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. -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_ Average minds discuss events (:_~*~_:) Small minds discuss people (_)-(_) . Eleanor Roosevelt ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. __ 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] plot multiple graphs in one graph and in multiple windows
On Thu, 26-Sep-2013 at 04:47PM +, Hui Du wrote: | | Hi All, | | I have a question about plotting graphs. Supposedly, I want to plot | 12 graphs. Putting 12 graphs to one window seems too | crowded. Ideally, I want to put 4 pictures in one window and plot | them in three separate window. For exmaple, my psuedo code is like Depends how you use them. I'd be inclined to make them into a 3 page PDF file. However, if you really need to see them simultaneously on the screen and can see 3 plotting windows on your screen, it would be easier still to make the plotting window larger and do all 12 in that window using par(mfrow = c(4, 3)) pr par(mfrow = c(3, 4)). HTH | | par(mfrow = c(2, 2)) | | for( I in 1:12) | { | plot(rnorm(100)); | | if( i %% 4 == 0) | # | # open a New window with par(mfrow = c(2, 2)): | # My question is how to control here? Thank you for your help. | # | } | | HXD | | [[alternative HTML version deleted]] | | __ | 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. -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_ Average minds discuss events (:_~*~_:) Small minds discuss people (_)-(_) . Eleanor Roosevelt ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. __ 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] Appropriateness of R functions for multicore
On Sat, 17-Aug-2013 at 05:09PM -0700, Jeff Newmiller wrote: | In most threaded multitasking environments it is not safe to | perform IO in multiple threads. In general you will have difficulty | performing IO in parallel processing so it is best to let the | master hand out data to worker tasks and gather results from them | for storage. Keep in mind that just because you have eight cores | for processing doesn't mean you have eight hard disks, so if your | problem is IO bound in single processor operation then it will also | be IO bound in threaded operation. For tasks which don't involve I/O but fail with mclapply, how does one work out where the problem is? The handy browser() function which allows for interactive diagnosis won't work with parallel jobs. What other approaches can one use? Thanx --- | Jeff NewmillerThe . . Go Live... | DCN:jdnew...@dcn.davis.ca.usBasics: ##.#. ##.#. Live Go... | Live: OO#.. Dead: OO#.. Playing | Research Engineer (Solar/BatteriesO.O#. #.O#. with | /Software/Embedded Controllers) .OO#. .OO#. rocks...1k | --- | Sent from my phone. Please excuse my brevity. | | Hopkins, Bill bill.hopk...@level3.com wrote: | Has there been any systematic evaluation of which core R functions are | safe for use with multicore? Of current interest, I have tried calling | read.table() via mclapply() to more quickly read in hundreds of raw | data files (I have a 24 core system with 72 GB running Ubuntu, a | perfect platform for multicore). There was a 40% failure rate, which | doesn't occur when I invoke read.table() serially from within a single | thread. Another example was using pvec() to invoke | sapply(strsplit(),...) on a huge character vector (to pull out fields | from within a field). It looked like a perfect application for pvec(), | but it fails when serial execution works. | | I thought I'd ask before taking on the task of digging into the | underlying code to see what is might be causing failure in a multicore | (well, multi-threaded) context. | | As an alternative, I could define multiple cluster nodes locally, but | that shifts the tradeoff a bit in whether parallel execution is | advantageous - the overhead is significantly more, and even with 72 GB, | it does impose greater limits on how many cores can be used. | | Bill Hopkins | | __ | 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-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. -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_ Average minds discuss events (:_~*~_:) Small minds discuss people (_)-(_) . Eleanor Roosevelt ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. __ 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] Fwd: about plantbreeding library
On Sat, 17-Aug-2013 at 10:18AM +0500, Waqas Shafqat wrote: | -- Forwarded message -- | From: Waqas Shafqat waqas1...@gmail.com | Date: Sat, Aug 17, 2013 at 10:18 AM | Subject: Re: [R] about plantbreeding library | To: Marc Girondot marc_...@yahoo.fr | | | problem 1 | stability analysis | | setwd(E:/) | Data - read.table(file=setwd.csv, header=TRUE, sep=,) | | Data |environments genotypes relication yield | 1 1 1 134 | 2 1 1 235 [...] | 273 3 363 That tells you that there's a dataframe called Data but you then try to use something else which isn't there. | # stability analysis | data(multienv) | Warning message: | In data(multienv) : data set ?multienv? not found That's telling you that there's nothing called multienv but then you try to use it. | out - stability (dataframe = multienv , yvar = yield, genotypes = | genotypes, | + environments = environments, replication = replication) | Error: could not find function stability | out | Error: object 'out' not found Nothing called out could be created since to do so requires something you don't have. All of your errors have a similar basis. Maybe you need to look through a few tutorials to understand a few basics, such as using ls() to see what's in your working directory. [] HTH -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_ Average minds discuss events (:_~*~_:) Small minds discuss people (_)-(_) . Eleanor Roosevelt ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. __ 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] getting rid of .Rhistory and .RData
On Wed, 14-Aug-2013 at 04:01PM +0200, Jannis wrote: | Well, I have made some tests with the 'no save' option. This only | seems to control the saving of .RData files (at least none appeared | in the working directory in my tests). A file called .RHistory is | still created. I can now put some code to delete this file in .Last | function but somehow I think that R should provide an option not to | clutter the working directories in such ways. Or to use one central | .RHistory file. That would be a terrible idea. I have dozens of directories and I want to keep the objects, code and history pertinent to each one. | | Any ideas? | | Jannis | | On 14.08.2013 14:33, Jannis wrote: | Thanks, I will look into ways to tell ess/emacs to use such | options. I am, however, quite sure that I have never answered | yes to the question when quitting R. | | Cheers | Jannis | | | On 13.08.2013 20:21, MacQueen, Don wrote: | R --no-save | | __ | 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-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. -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_ Average minds discuss events (:_~*~_:) Small minds discuss people (_)-(_) . Eleanor Roosevelt ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. __ 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] Rmpi installs before R-3.0.0 but not since
With R-3.0.1 Loading required package: Rmpi Failed with error: ‘package ‘Rmpi’ was built before R 3.0.0: please re-install it’ And when I try to reinstall Rmpi, I get this after a whole bunch of 'yes's checking mpi.h usability... no checking mpi.h presence... no checking for mpi.h... no configure: error: Cannot find mpi.h header file ERROR: configuration failed for package ‘Rmpi’ And attempting to go back With R-2.15.3, I get these warnings: Warning messages: 1: package ‘gbm’ was built under R version 3.0.1 2: package ‘survival’ was built under R version 3.0.1 [1] Error in socketConnection(\localhost\, port = port, server = TRUE, blocking = TRUE, : \n cannot open the connection\n So there's no going back. Where do I look for reasons why Rmpi can't find mpi.h header even though it was findable before 3.0.1? I know not to take that message too literally since there is a file mpi.h that bash can find. Something else is being hinted at but what? sessionInfo() R version 3.0.1 (2013-05-16) Platform: x86_64-unknown-linux-gnu (64-bit) locale: [1] LC_CTYPE=en_NZ.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_NZ.UTF-8LC_COLLATE=en_NZ.UTF-8 [5] LC_MONETARY=en_NZ.UTF-8LC_MESSAGES=en_NZ.UTF-8 [7] LC_PAPER=C LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_NZ.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] parallel splines grDevices utils stats graphics methods [8] base other attached packages: [1] gbm_2.1 survival_2.37-4 cairoDevice_2.19 lattice_0.20-15 loaded via a namespace (and not attached): [1] grid_3.0.1 multicore_0.1-7 TIA -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_ Average minds discuss events (:_~*~_:) Small minds discuss people (_)-(_) . Eleanor Roosevelt ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. __ 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 Job taking longer in Linux than in Windows
On Fri, 02-Aug-2013 at 01:14PM -0700, alina andrei wrote: | Hello, | ? | I am running an R job on a Windows 7 machine, having 4 cores and | 16GB RAM?, R 3.0.1,?and it takes 1.5 hours to complete. I am | running the same job in R on a Linux enviroment (Platform: | x86_64-redhat-linux-gnu (64-bit)) with huge amounts of memory: 40 | cores and .5 TB RAM., and the?job takes 3h and 15min to complete | (no other concurrent jobs).? The job uses the glmnet package?to | perform?model selection on a simulated data set having 1 million | records and 150 variables. | My questions are: | 1. Why R doesn't take advantage of the avaialble RAM? | 2. Are there any changes that we can apply to the R configuration | file in order to see?superior performance? My expectations are that I'm guessing you're using mc.lapply from the parallel package, but I don't have any idea how you're calling it. That's where I'd be looking. 40 cores is rather larger than anything I've used. Even gkrellm would have a hard time displaying what's going on in that many 'CPU's but I'd suspect you're using only 1 of them. I've used mc.lapply with the brt package and occasionally would need to restart R to make it use all the cores. Maybe it's something like that, but it's more likely because of how you call it. HTH | the Linux enviroment would performe a lot better when compared to | the Windows enviroment. ? | Any help in sorting out these issues is much appreciated. | ? | Thank you in advance! | Alina? | [[alternative HTML version deleted]] | | __ | 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. -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_ Average minds discuss events (:_~*~_:) Small minds discuss people (_)-(_) . Eleanor Roosevelt ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. __ 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] .eps files and powerpoint
On Tue, 23-Jul-2013 at 10:23PM -0400, Richard M. Heiberger wrote: | I have colleagues who use powerpoint. When I send my colleagues pdf files | or ps files, powerpoint | rejects them. Powerpoint does accept some eps files. | [...] | Does anyone know a workaround that will get vector graphics from R into | powerpoint? | win.metafile is not acceptable. The resolution of emf files from R is | worse than png files. Maybe worse than png files at the default resolution which is 72 dpi. Change that to something like 300 and nobody will see a jagged edge in a PowerPoint slide. HTH | | Thanks | Rich | | [[alternative HTML version deleted]] | | __ | 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. -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_ Average minds discuss events (:_~*~_:) Small minds discuss people (_)-(_) . Eleanor Roosevelt ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. __ 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] Understanding how nls() works
I'm trying to understand what goes on in the process that nls() uses. This converges without much drama: rate.nls - nls(Dev ~ exp(rho * (T)) - exp(rho*Tmax - (Tmax - T)/del)+ + lam , data = xx, trace = TRUE, + start = c(rho = 0.15, del = 7, lam = .02, Tmax = 30)) 599.7841 : 0.15 7.00 0.02 30.00 4.69849 : 0.14673457 6.83443060 -0.01417782 29.94392535 0.06971343 : 0.14787121 6.75095966 -0.01281743 28.88851217 0.01197127 : 0.1460683 6.8334550 -0.0128118 30.1599472 0.008279834 : 0.14406976 6.92819920 -0.01281783 31.63914711 0.002267513 : 0.1437983 6.9426081 -0.0127973 31.9153204 0.002264977 : 0.14377323 6.94385235 -0.01279224 31.95091153 0.002264977 : 0.14378546 6.94326629 -0.01278643 31.95045828 0.002264977 : 0.14378124 6.94346882 -0.01278843 31.95065902 0.002264977 : 0.14378271 6.94339837 -0.01278772 31.95059050 If I make one parameter further away from optimum, I get this: rate.nls - nls(Dev ~ exp(rho * (T)) - exp(rho*Tmax - (Tmax - T)/del)+ + lam , data = xx, trace = TRUE, + nls.control(warnOnly = TRUE), + start = c(rho = 0.15, del = 7, lam = 1.02, Tmax = 30)) 59.80968 : 0.15 7.00 1.02 30.00 4.69849 : 0.14673457 6.83443060 -0.01417782 29.94392535 0.06973771 : 0.14787046 6.75099517 -0.01281668 28.88853959 0.0119916 : 0.1460709 6.8333430 -0.0128098 30.1600040 0.008369133 : 0.14406664 6.92834092 -0.01281926 31.63978393 0.002267664 : 0.1438008 6.9424901 -0.0127959 31.9151258 0.002264977 : 0.1437771 6.9436655 -0.0127904 31.9507300 0.002264977 : 0.14378253 6.94340678 -0.01278781 31.95059843 0.002264977 : 0.1437849 6.9432936 -0.0127867 31.9504860 Warning message: In nls(Dev ~ exp(rho * (T)) - exp(rho * Tmax - (Tmax - T)/del) + : step factor 0.000488281 reduced below 'minFactor' of 0.000976562 There's no surprise that the traces will be different, but I can't understand why the first iteration gives exactly the same result in both cases. *Then* they diverge. What is the explanation? (Maybe if I knew what the step factor refers to, it could be clearer but I suspect it doesn't come in at that stage.) I can't think of a way of making a minimal working example but I'd guess that it's not necessary to explain the procedure. I could supply my xx dataframe if it's indispensible to the explanation. TIA -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_ Average minds discuss events (:_~*~_:) Small minds discuss people (_)-(_) . Eleanor Roosevelt ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. __ 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] How to use parentheses and degree symbol together?
On Tue, 26-Mar-2013 at 05:05PM +0900, Pascal Oettli wrote: | Hi, | | You are right. The following should solve that problem: | | plot(0, 0, pch = ) | text(0, .5, expression(Temperature~(degree*C))) It's not *exactly* the same. It uses a different font family for the brackets, evidently from the Symbol family, not Helvetica (or whatever). Probably more appropriate since it's more akin to the other characters' features. So, not only more elegant, but better looking. | | HTH, | Pascal | | | On 26/03/13 16:55, Patrick Connolly wrote: | On Tue, 26-Mar-2013 at 04:20PM +0900, Pascal Oettli wrote: | | | Hi, | | | | Is it what you are looking for? | | | | plot(0, 0, pch = ) | | text(0, .5, expression(Temperature~(degree ~ C))) | | That produces an unwanted space between the degree symbol and the C. | The search continues. | | Thanks | | | text(0, .4, substitute(paste(Temperature, B * degree, C)), list(B | | = ())) | | | | Hope this help, | | Pascal | | | | | | | | On 26/03/13 16:12, Patrick Connolly wrote: | | I'm interested in using a regular bracket with the degree symbol as an | | axis label but it's somewhat simpler to show what I mean in a text | | statement. | | | | plot(0, 0, pch = ) | | | | If I'm easy to please, this would suffice: | | text(0, .5, expression(Temperature * degree ~ C)) | | | | But I'm not that easily pleased. I prefer it to look like this: | | text(0, .4, substitute(paste(Temperature, B * degree, C)), list(B = ())) | | | | It looks fine, but I'm sure there's a more elegant way to do it. | | | | Is there? | | | | | -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_ Average minds discuss events (:_~*~_:) Small minds discuss people (_)-(_) . Eleanor Roosevelt ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. __ 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.