[R] A new versatile discrete distribution.

2020-11-30 Thread Rolf Turner
To all and sundry, near and far, F. Christmas in particular ... --- A. A. Milne Just ignore that second line :-) A new package of mine, "hse", has just become available on CRAN. The source package is there; Uwe Ligges has informed me that the Windoze binary has been built so it

Re: [R] RGB -> CYMK, with consistent colors

2020-11-30 Thread Derek Jones
Martin, However after some testing. I totally agree that CMYK handling in R using pdf(..., colormodel = "cmyk") is not correct. I thought the issue may be OS specific, but I get similar behavior on a Mac. I have discovered the Cyan tool: http://cyan.fxarena.net/ and will try it out. As

Re: [R] RGB -> CYMK, with consistent colors

2020-11-30 Thread Martin Møller Skarbiniks Pedersen
On Sun, 29 Nov 2020 at 20:55, Derek M Jones wrote: [...] > > library("colorspace") > > two_c=rainbow(2) > x=runif(20) > y=runif(20) > plot(x, y, col=two_c[2]) > pdf(file="cmyk.pdf", colormodel="cmyk") > plot(x, y, col=two_c[2]) > dev.off() rainbow(2) gives two RGB-colours: #FF (=pure red)

Re: [R] [External] Re: Why is R making a copy-on-modification after using str?

2020-11-30 Thread luke-tierney
On Mon, 30 Nov 2020, Duncan Murdoch wrote: On 30/11/2020 5:12 a.m., Georg Kindermann wrote: Dear list members, I was wondering why R is making a copy-on-modification after using str. This isn't really an explanation, but adds a bit more data. If you inspect m before and after str(),

Re: [R] [External] Why is R making a copy-on-modification after using str?

2020-11-30 Thread luke-tierney
On Mon, 30 Nov 2020, Georg Kindermann wrote: Dear list members, I was wondering why R is making a copy-on-modification after using str. m <- matrix(1:12, 3) tracemem(m) #[1] "<0x559df861af28>" dim(m) <- 4:3 m[1,1] <- 0L m[] <- 12:1 str(m) # int [1:4, 1:3] 12 11 10 9 8 7 6 5 4 3 ... dim(m) <-

Re: [R] calling r from java (Eduard Drenth)

2020-11-30 Thread Adrian Trapletti
Calling R via Rserve is faster than a REST based solution. However, if you do some non-trivial computation in R, then the calling overhead is insignificant. A REST based solution is more flexible. A REST API can be called e.g. directly from a Javascript UI and the indirection via a Java backend is

Re: [R] Printing upon calling a function

2020-11-30 Thread Avi Gross via R-help
Steven, You need to mention what you actually did to get proper advice. Your problem is at the source. Simply put, the R interpreter does have somewhat different behavior when the program is directly typed in (or slightly indirectly as in R STUDIO) than when you ask it to open another file as

Re: [R] Printing upon calling a function

2020-11-30 Thread Duncan Murdoch
On 30/11/2020 11:51 a.m., Steven Yen wrote: Thanks to all. Presenting a large-scale, replicable example can be a burden to the READERs which was why I was reluctant. You shouldn't post a large scale reproducible example, you should simplify it to just the essentials. Often in doing that you

Re: [R] Printing upon calling a function

2020-11-30 Thread Avi Gross via R-help
TOPIC: Why some returned values do not automatically print. Again, not seeing the internals, my guess is the function returned not the expected but "invisible(expected)" which just marks it as not to be automatically printed. So if you want it printed, ask for it explicitly as in:

Re: [R] Printing upon calling a function

2020-11-30 Thread Steven Yen
Thanks to all. Presenting a large-scale, replicable example can be a burden to the READERs which was why I was reluctant. I am embarrassed to report that after having to restart Windows after the system hang on something unrelated, the issue was resolved and printing was normal. I bet it had

Re: [R] Need guidance on summarizing time data

2020-11-30 Thread Jeff Newmiller
Does table(DF$Time) do what you want? Seems kinda odd to me that you want to distinguish between 18:31 and 18:32 but you don't care which days those occur on. If your phenomenon is related to local time-of-day then perhaps you might want to correlate with sun elevation relative to the

Re: [R] Need guidance on summarizing time data

2020-11-30 Thread Thierry Onkelinx via R-help
Dear Bruce, I think this should be straightforward with tidyverse. If not please provide a small reproducible data set with dput(). library(tidyverse) count(Active, Time) count(Active, Date, Time) Best regards, ir. Thierry Onkelinx Statisticus / Statistician Vlaamse Overheid / Government of

Re: [R] C++11 requirements for package dependencies

2020-11-30 Thread Bert Gunter
package questions are usually better posted at r-package-devel 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 Mon, Nov 30, 2020 at 12:45 AM Mark Clements

[R] Need guidance on summarizing time data

2020-11-30 Thread Neotropical bat risk assessments and acoustic tools
Hi all, I need to summarize temporal activity. However date\times in R seem to be not easily handled. Seems I may need to convert date\time values to a recognizable format? My "raw data" is tab (text) includes a location ID, date and time(24 hr format). Format is like this: Location    Date 

Re: [R] Why is R making a copy-on-modification after using str?

2020-11-30 Thread Duncan Murdoch
On 30/11/2020 5:12 a.m., Georg Kindermann wrote: Dear list members, I was wondering why R is making a copy-on-modification after using str. This isn't really an explanation, but adds a bit more data. If you inspect m before and after str(), you'll see that str(m) leaves it with two

[R] Why is R making a copy-on-modification after using str?

2020-11-30 Thread Georg Kindermann
Dear list members, I was wondering why R is making a copy-on-modification after using str. m <- matrix(1:12, 3) tracemem(m) #[1] "<0x559df861af28>" dim(m) <- 4:3 m[1,1] <- 0L m[] <- 12:1 str(m) # int [1:4, 1:3] 12 11 10 9 8 7 6 5 4 3 ... dim(m) <- 3:4 #Here after str a copy is made

Re: [R] Printing upon calling a function

2020-11-30 Thread Duncan Murdoch
By not posting a reproducible example, you're wasting everyone's time. Duncan Murdoch On 30/11/2020 6:06 a.m., Steven Yen wrote: No, sorry. Line 1 below did not print for me and I had to go around and do line 2 to print: me.probit(obj) v<-me.probit(obj); v A puzzle. On 2020/11/30 下午

Re: [R] Printing upon calling a function

2020-11-30 Thread Steven Yen
No, sorry. Line 1 below did not print for me and I had to go around and do line 2 to print: me.probit(obj) v<-me.probit(obj); v A puzzle. On 2020/11/30 下午 07:00, Duncan Murdoch wrote: On 30/11/2020 5:41 a.m., Stefan Evert wrote: On 30 Nov 2020, at 10:41, Steven Yen wrote: Thanks. I

Re: [R] Printing upon calling a function

2020-11-30 Thread Duncan Murdoch
On 30/11/2020 5:41 a.m., Stefan Evert wrote: On 30 Nov 2020, at 10:41, Steven Yen wrote: Thanks. I know, my point was on why I get something printed by simply doing line 1 below and at other occasions had to do line 2. me.probit(obj) That means the return value of me.probit() has been

Re: [R] Printing upon calling a function

2020-11-30 Thread Steven Yen
No. I wrote the function so I am sure no "invisible" command was used. Strangely enough, compiling the function isto part of a package, results were NOT printed. Yes if I call the function during run, by preceding the call with a line that attach the source code: source("A:/.../R/oprobit.R")

Re: [R] Printing upon calling a function

2020-11-30 Thread Stefan Evert
> On 30 Nov 2020, at 10:41, Steven Yen wrote: > > Thanks. I know, my point was on why I get something printed by simply doing > line 1 below and at other occasions had to do line 2. > > me.probit(obj) That means the return value of me.probit() has been marked as invisible, so it won't

Re: [R] Printing upon calling a function

2020-11-30 Thread Steven Yen
Thanks. I know, my point was on why I get something printed by simply doing line 1 below and at other occasions had to do line 2. me.probit(obj) v<-me.probit(obj); v On 2020/11/30 下午 05:33, Jim Lemon wrote: Hi Steven, You seem to be assigning the result of me.oprobit(obj) to v instead of

Re: [R] Printing upon calling a function

2020-11-30 Thread Jim Lemon
Hi Steven, You seem to be assigning the result of me.oprobit(obj) to v instead of printing it. By appending ";v" tp that command line, you implicitly call "print". Jim On Mon, Nov 30, 2020 at 7:15 PM Steven Yen wrote: > > I hope I can get away without presenting a replicable set of codes >

[R] C++11 requirements for package dependencies

2020-11-30 Thread Mark Clements
A colleague uses a package I maintain (rstpm2) as a dependency in their package (rsimsum) with testing using GitHub Actions. They found that testing failed against R versions 3.3, 3.4 and 3.5 because recent versions of RcppArmadillo (which is a dependency in rstpm2) require C++11. As a dependency

Re: [R] calling r from java

2020-11-30 Thread Eduard Drenth
sun.misc that is -Original Message- From: Eduard Drenth To: r-help@r-project.org Subject: Re: [R] calling r from java Date: Mon, 30 Nov 2020 07:18:46 + First attempts to use jri on ubuntu 20.04 stranded. Steps I followed: 1) download rJava from https://www.rforge.net/rJava/files/

Re: [R] Printing upon calling a function

2020-11-30 Thread Jeff Newmiller
Answering you is also a burden without the reprodicible code. I'll pass on that. But I will say that mixing analysis with output in the same function is a terrible habit. Come to the functional side of coding... it is much more re-usable here. On November 30, 2020 12:14:35 AM PST, Steven Yen

[R] Printing upon calling a function

2020-11-30 Thread Steven Yen
I hope I can get away without presenting a replicable set of codes because doing so would impose burdens. I call a function which return a data frame, with the final line return(out) In one case the data frame gets printed (similar to a regression printout), with simply a call