[R] [Rd] R 4.4.2 is released

2024-10-31 Thread peter dalgaard
The build system rolled up R-4.4.2.tar.gz (codename "Pile of Leaves") this 
morning.

This is a minor update, with a few bug fixes.

The list below details the changes in this release. 

You can get the source code from

https://cran.r-project.org/src/base/R-4/R-4.4.2.tar.gz
https://cran.r-project.org/src/base/R-4/R-4.4.2.tar.xz

or wait for it to be mirrored at a CRAN site nearer to you.

Binaries for various platforms will appear in due course. 
(The Mac binaries will be delayed for a couple of days because the maintainer 
is traveling.)



For the R Core Team,

Peter Dalgaard


These are the checksums (md5 and SHA-256) for the freshly created files, in 
case you wish
to check that they are uncorrupted:

MD5 (AUTHORS) = 0ba932825aefae5566dc44822916b266
MD5 (COPYING) = eb723b61539feef013de476e68b5c50a
MD5 (COPYING.LIB) = a6f89e2100d9b6cdffcea4f398e37343
MD5 (FAQ) = 88c4aa9c580d8652c42540f8f21c40e0
MD5 (INSTALL) = 7893f754308ca31f1ccf62055090ad7b
MD5 (NEWS) = 3756fad0d8685742f334b2128d4437ea
MD5 (NEWS.0) = bfcd7c147251b5474d96848c6f57e5a8
MD5 (NEWS.1) = f8466e418dec6b958b4ce484a13f9a9d
MD5 (NEWS.2) = b38d94569700664205a76a7de836ba83
MD5 (NEWS.3) = 307e75ba323c08b8694f916e45886aa4
MD5 (R-latest.tar.gz) = 543fe0323713f3f8844fff7c97d2b1c9
MD5 (R-latest.tar.xz) = c2351f512e22d729a71bdaf95bc74561
MD5 (README) = f468f281c919665e276a1b691decbbe6
MD5 (RESOURCES) = a79b9b338cab09bd665f6b62ac6f455b
MD5 (THANKS) = 45b6d2e88a6ecb5b24fa33a781351cd5
MD5 (VERSION-INFO.dcf) = 519fb6bebe15709fa0c8e4e3adc3ad5f
MD5 (build-dist.log) = 730a7b33e87dfc97c37abfa7c043d5f1
MD5 (R-4/R-4.4.2.tar.gz) = 543fe0323713f3f8844fff7c97d2b1c9
MD5 (R-4/R-4.4.2.tar.xz) = c2351f512e22d729a71bdaf95bc74561

4cc9dcdfa46a2e2cff45c27df8f3a9f851ec97b44b8647ab8a9fbf844f37937f  AUTHORS
e6d6a009505e345fe949e1310334fcb0747f28dae2856759de102ab66b722cb4  COPYING
6095e9ffa777dd22839f7801aa845b31c9ed07f3d6bf8a26dc5d2dec8ccc0ef3  COPYING.LIB
dd27213819970941d0cc3c82dbefbaac0b859e968972da52143ea0f57f7b2088  FAQ
f87461be6cbaecc4dce44ac58e5bd52364b0491ccdadaf846cb9b452e9550f31  INSTALL
146d1e4147aeba06ce3d340a25fbf74a57944ad5295b93dadd55c207ab6b2f4e  NEWS
4e21b62f515b749f80997063fceab626d7258c7d650e81a662ba8e0640f12f62  NEWS.0
602f3a40ef759c7b2a6c485a33dc674af34249644ac5fb53b21283d4e12e808d  NEWS.1
cde079b6beab7d700d3d4ecda494e2681ad3b7f8fab13b68be090f949393ec62  NEWS.2
05f3f9fc664b845bb3dcc6492503860df72c63b3f179ab241c095e25bb7628f9  NEWS.3
1578cd603e8d866b58743e49d8bf99c569e81079b6a60cf33cdf7bdffeb817ec  
R-latest.tar.gz
1115ef040746d3c89d14ef53bafd66b55824f29e54fb834cd492f9b3d6dc7f5e  
R-latest.tar.xz
2fdd3e90f23f32692d4b3a0c0452f2c219a10882033d1774f8cadf25886c3ddc  README
8b7d3856100220f4555d4d57140829f2e81c27eccec5b441f5dce616e9ec9061  RESOURCES
8319c5415de58ee10d4bc058d79c370fd8e6b2ad09e25d7a1e04b74ca5f380a6  THANKS
f36c14836fd523ca634cb17df4aedf5e8ad95b2784f12d9d16f80faabe822603  
VERSION-INFO.dcf
172e9fbcf37c262904fa4a3e42a40865a03c1afe18f72904e0a4e7c8814c4b71  build-dist.log
1578cd603e8d866b58743e49d8bf99c569e81079b6a60cf33cdf7bdffeb817ec  
R-4/R-4.4.2.tar.gz
1115ef040746d3c89d14ef53bafd66b55824f29e54fb834cd492f9b3d6dc7f5e  
R-4/R-4.4.2.tar.xz

This is the relevant part of the NEWS file

CHANGES IN R 4.4.2:

  C-LEVEL FACILITIES:

* The S-compatibility macros F77_COM and F77_COMDECL defined in
  header R_ext/RS.h are deprecated and will be removed shortly.  We
  could find no record of their use.

  BUG FIXES:

* Mathlib function lgammacor(x) no longer warns about underflow to
  zero for large x.

* Text widths and heights were incorrectly reported by the Quartz
  device if the drawing context didn't exist yet (typically when
  drawing off-screen to a window that is yet to appear, see
  PR#18591).

* The Quartz device could segfault in cases where paths with spaces
  are used in the new glyph drawing API.  Thanks to Tomek
  Gieorgijewski (PR#18758).

* On macOS in R CRAN builds, it is again possible to read
  little-endian UTF-16 text with a BOM from a connection using
  encoding="UTF-16".  Users building R from source should avoid
  using the system libiconv in macOS 14.1 and later.

* methods' internal .requirePackage() now re-enables primitive
  method dispatch when needed; thanks to Ivan Krylov for
  demystifying CRAN package check failures on the R-devel mailing
  list.


-- 
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 https://www.R-project.org/posting-gu

Re: [R] OSX-specific Bug in randomForest

2024-10-24 Thread peter dalgaard
This is probably Apple Silicon specific, not OSX per se:

> sum(rep(1 / 9, 9)) - 1
[1] 0

> On 23 Oct 2024, at 07:26 , Stevie Pederson  
> wrote:
> 
> sum(rep(1 / 9, 9)) - 1
> # [1] 2.220446e-16

-- 
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-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 https://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] [Rd] R 4.4.2 scheduled for October 31

2024-10-11 Thread peter dalgaard
Full schedule is available on developer.r-project.org (pending update from SVN).

-- 
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-de...@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

___
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 https://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Is there a sexy way ...?

2024-09-30 Thread peter dalgaard
Yes, unsplit() it is. I was messing around with ave() (which can be hammered 
into submission, sort of).

My overlooking unsplit() is somewhat impressive in view of "svn diff -c 
18591"

-pd

> On 27 Sep 2024, at 17:08 , Martin Maechler  wrote:
> 
>>>>>> Chris Evans via R-help 
>>>>>>on Fri, 27 Sep 2024 12:20:47 +0200 writes:
> 
>> Oh glorious!  Thanks Duncan.
>> Fortune cookie nomination!
> 
> I don't  disagree with the nomination -- thank you, Duncan!
> 
> However, please note that I'm sure Rolf's was challenged /
> question was ment to work correctly for all  factors `f`  with
> levels "1", "2", "3".
> 
> Almost all solution were simply assuming that the toy example
> `f` was the real `f`, but that's not realistic.
> 
> Consequently, in my view, the only valid proposition and a very
> nice one, indeed, was  Deepayan's (well, he's "R core", ...) 
> 
>   unsplit(x, f)
> 
> Martin
> 
>> On 27/09/2024 11:13, Duncan Murdoch wrote:
>>> On 2024-09-26 11:55 p.m., Rolf Turner wrote:
>>>> 
>>>> I have (toy example):
>>>> 
>>>> x <- list(`1` = c(7, 13, 1, 4, 10),
>>>>`2` = c(2, 5,  14, 8, 11),
>>>>`3` = c(6, 9, 15, 12, 3))
>>>> and
>>>> 
>>>> f <- factor(rep(1:3,5))
>>>> 
>>>> I want to create a vector v of length 15 such that the entries of v,
>>>> corresponding to level l of f are the entries of x[[l]].  I.e. I want
>>>> v to equal
>>>> 
>>>>  c(7, 2, 6, 13, 5, 9, 1, 14, 15, 4, 8, 12, 10, 11, 3)
>>>> 
>>>> I can create v "easily enough", using say, a for-loop.  It seems to me,
>>>> though, that there should be sexier (single command) way of achieving
>>>> the desired result.  However I cannot devise one.
>>>> 
>>> 
>>> Don't you find a for loop's naked display of intention to be sexy?
>>> 
>>> Duncan Murdoch
>>> 
>> -- 
>> Chris Evans (he/him)
>> Visiting Professor, UDLA, Quito, Ecuador & Honorary Professor, 
>> University of Roehampton, London, UK.
>> CORE site: http://www.coresystemtrust.org.uk
>> Other work web site: https://www.psyctc.org/psyctc/
>> Personal site: https://www.psyctc.org/pelerinage2016/
> 
>> __
>> 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 https://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 https://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  Priv: pda...@gmail.com

__
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 https://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] non-conformable arrays

2024-09-11 Thread peter dalgaard
Hum... Two points: You are using |> a lot and tcrossprod() is a primitive, so 
ignores argnames. This makes me suspicious that things like 

... ) |>  tcrossprod(x = mm)

might not do what you think it does.

E.g., 

> a <- matrix(1,10,2)
> b <- matrix(1,3,2)
> tcrossprod(y=b, x=a)
 [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,]222222222 2
[2,]222222222 2
[3,]222222222 2
> tcrossprod(x=a, y=b)
  [,1] [,2] [,3]
 [1,]222
 [2,]222
 [3,]222
 [4,]222
 [5,]222
 [6,]222
 [7,]222
 [8,]222
 [9,]222
[10,]222

-pd

> On 11 Sep 2024, at 17:55 , Thierry Onkelinx  wrote:
> 
> Dear all,
> 
> I'm puzzled by this error. When running tcrossprod() within the function it
> returns the error message. The code also outputs the object a and b.
> Running the tcrossprod() outside of the function works as expected.
> 
>cat("a <-")
>dput(a)
>cat("b <-")
>dput(b)
>cat("tcrossprod(a, b)")
>tcrossprod(a, b)
> 
> a <-structure(c(1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0,
> 0, 0, 1), dim = c(10L, 2L), dimnames = list(c("9", "13", "21",
> "29", "30", "37", "52", "53", "56", "70"),
> c("tmp2028c70ae152b4c63bb7ab902158b408366217581",
> "tmp2028c70ae152b4c63bb7ab902158b408366217582")), assign = c(1L,
> 1L), contrasts = list(tmp2028c70ae152b4c63bb7ab902158b40836621758 =
> "contr.treatment"))
> b <-structure(c(-0.916362039446752, -0.849801808879291, -0.744535398206787,
> 0.875896407785924, 0.822587420283086, 0.894210774042389), dim = 3:2)
> tcrossprod(a, b)
> 
> For those how like a fully reproducible example:
> the offending line in the code:
> https://github.com/inbo/multimput/blob/e1cd0cdff7d2868e4101c411f7508301c7be7482/R/impute_glmermod.R#L65
> a (failing) unit test for the code:
> https://github.com/inbo/multimput/blob/e1cd0cdff7d2868e4101c411f7508301c7be7482/tests/testthat/test_ccc_hurdle_impute.R#L10
> 
> 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
> Havenlaan 88 bus 73, 1000 Brussel
> *Postadres:* Koning Albert II-laan 15 bus 186, 1210 Brussel
> *Poststukken die naar dit adres worden gestuurd, worden ingescand en
> digitaal aan de geadresseerde bezorgd. Zo kan de Vlaamse overheid haar
> dossiers volledig digitaal behandelen. Poststukken met de vermelding
> ‘vertrouwelijk’ worden niet ingescand, maar ongeopend aan de geadresseerde
> bezorgd.*
> 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>
> 
>   [[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 https://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  Priv: pda...@gmail.com

__
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 https://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Calculation of VCV matrix of estimated coefficient

2024-09-06 Thread peter dalgaard



> On 5 Sep 2024, at 16:36 , Gabor Grothendieck  wrote:
> 
> sigma(model)^2 will give the correct MSE.  Also note that your model
> matrix has intercept at
> the end whereas vcov will have it at the beginning so you will need to
> permute the rows
> and columns to get them to be the same/


Also, 

X <- cbind(1, as.matrix(mtcars[, c('disp', 'hp')]))

or even

X <- model.matrix(~ disp + hp, mtcars)

-pd


> 
> On Wed, Sep 4, 2024 at 3:34 PM Daniel Lobo  wrote:
>> 
>> Hi,
>> 
>> I am trying to replicate the R's result for VCV matrix of estimated
>> coefficients from linear model as below
>> 
>> data(mtcars)
>> model <- lm(mpg~disp+hp, data=mtcars)
>> model_summ <-summary(model)
>> MSE = mean(model_summ$residuals^2)
>> vcov(model)
>> 
>> Now I want to calculate the same thing manually,
>> 
>> library(dplyr)
>> X = as.matrix(mtcars[, c('disp', 'hp')] %>% mutate(Intercept = 1));
>> solve(t(X) %*% X) * MSE
>> 
>> Unfortunately they do not match.
>> 
>> Could you please help where I made mistake, if any.
>> 
>> Thanks
>> 
>> __
>> 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 https://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
> 
> 
> 
> -- 
> Statistics & Software Consulting
> GKX Group, GKX Associates Inc.
> tel: 1-877-GKX-GROUP
> email: ggrothendieck at gmail.com
> 
> ______
> 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 https://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  Priv: pda...@gmail.com

__
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 https://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] "--" < 0

2024-06-25 Thread peter dalgaard
Also notice that

> "+5" < 0
[1] TRUE

> as.numeric("+5") < 0
[1] FALSE

So the presumption is wrong. It is really about

> sort(c(0:3, "+", "-"))
[1] "-" "+" "0" "1" "2" "3"

-pd

> On 25 Jun 2024, at 10:02 , Martin Maechler  wrote:
> 
>>>>>> Adrian Dusa 
>>>>>>on Tue, 25 Jun 2024 10:56:07 +0300 writes:
> 
>> Dear R fellows,
> 
>>> From time to time, just when I thought I knew my R, I get
>>> bitten by some
>> small things that reminds one to constantly return to the
>> basics.
> 
>> I knew for instance that "-1" < 0 is TRUE, presumably
>> because R first coerces to numeric before comparing with
>> 0.
> 
>> But I did not expect that "--" < 0 is a TRUE statement.
>> (and the same holds for any string prepended by a minus
>> sign, e.g. "-a" < 0)
> 
>> I would be grateful for an explanation, I'm sure that
>> something very obvious escapes me but it sure does seem
>> counter intuitive to me.
> 
>> Best wishes, Adrian
> 
>>  [[alternative HTML version deleted]]
> 
> Nice, quiz, yes.
> 
> You must have forgotten that all Op's (+,-, <= , &, | ..)
> must coerce to common type.
> 
> ... and so does  c()  where coercion is defined a bit more.
> 
> -->  does  c("--", 0)   give you a clue, now ?
> 
> __
> 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  Priv: pda...@gmail.com

__
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] Help trying to understand R documentation on libraries paths

2024-06-17 Thread peter dalgaard
I am not going to search the sources for it (your problem, your work ;-) ), but 
the wording would be consistent with a call like

.libPaths(c(Sys.getenv("R_LIBS"), Sys.getenv("R_LIBS_USER")))

-pd

> On 17 Jun 2024, at 13:40 , Iago Giné Vázquez  wrote:
> 
> Thanks,
> 
> Regarding .libPaths, I am asking for the call to `.libPaths()`, so I 
> understand there is no `new` in the call, as in the documentation I cited.
> 
> Iago
> 
> De: peter dalgaard 
> Enviat el: dilluns, 17 de juny de 2024 13:26
> Per a: Iago Giné Vázquez 
> A/c: r-help@r-project.org 
> Tema: Re: [R] Help trying to understand R documentation on libraries paths
>  
> (Inline)
> 
> > On 17 Jun 2024, at 09:51 , Iago Giné Vázquez  wrote:
> > 
> > Hi,
> > 
> > 1 - On help(".libPaths", help_type = "text") one can read:
> > 
> > First, '.Library.site' is initialized from 'R_LIBS_SITE'.
> > 
> > However, I have
> > 
> >> Sys.getenv("R_LIBS_SITE")
> > [1] "c:/Users/i.gine/AppData/Local/Programs/R/R-4.4.1/site-library"
> >> .Library.site
> > character(0)
> > 
> > Is this consistent?
> 
> It is implied that R_LIBS_SITE should point to an existing directory. I see 
> the same thing on Mac:
> 
> > .Library.site
> character(0)
> > Sys.getenv("R_LIBS_SITE")
> [1] "/Library/Frameworks/R.framework/Resources/site-library"
> > list.files(Sys.getenv("R_LIBS_SITE"))
> character(0)
> 
> I.e., R_LIBS_SITE is where a site library _if any_ should live. If it is not 
> there, there is no poin in searching it. Unless you actually have a 
> site-library, I don't think there is a problem.
> 
> > 
> > 2 - Next, on the same help document, one can read:
> > 
> > Then, '.libPaths()' is called with the combination
> > of the directories given by 'R_LIBS' and 'R_LIBS_USER'.
> > 
> > 
> > This time, I get
> >> Sys.getenv("R_LIBS")
> > [1] ""
> >> Sys.getenv("R_LIBS_USER")
> > [1] "c:/Users/i.gine/AppData/Local/Programs/R/R-4.4.0/library"
> >> .libPaths()
> > [1] "C:/Users/i.gine/AppData/Local/Programs/R/R-4.4.0/library" 
> > "C:/Users/i.gine/AppData/Local/Programs/R/R-4.4.1/library"
> > 
> > 
> > Later is written:
> > 
> > Function '.libPaths' always uses the values of '.Library' and
> > '.Library.site' in the base namespace.
> > 
> > and indeed
> > 
> >> .Library
> > [1] "c:/Users/i.gine/AppData/Local/Programs/R/R-4.4.1/library"
> > 
> > 
> > Then, shouldn't be this specified above together with "directories given by 
> > 'R_LIBS' and 'R_LIBS_USER'"?
> > 
> 
> The logic of .libPath() is 
> 
> > .libPaths
> function (new, include.site = TRUE) 
> {
> if (!missing(new)) {
> new <- Sys.glob(path.expand(new))
> paths <- c(new, if (include.site) .Library.site, .Library)
> paths <- paths[dir.exists(paths)]
> .lib.loc <<- unique(normalizePath(paths, "/"))
> }
> else .lib.loc
> }
> 
> so if you "call it with" new=something, then (.Library.site, .Library) is 
> automagically appended, unless you expressly tell it not to. 
> 
> -pd
> 
> > 
> > Am I understanding it wrongly? Otherwise, what do you think on the current 
> > way this help page is explained?
> > 
> > Thank you for your help and time.
> > 
> > Best regards,
> > 
> > Iago
> > 
> >[[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.
> 
> -- 
> 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

__
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] Help trying to understand R documentation on libraries paths

2024-06-17 Thread peter dalgaard
(Inline)

> On 17 Jun 2024, at 09:51 , Iago Giné Vázquez  wrote:
> 
> Hi,
> 
> 1 - On help(".libPaths", help_type = "text") one can read:
> 
> First, '.Library.site' is initialized from 'R_LIBS_SITE'.
> 
> However, I have
> 
>> Sys.getenv("R_LIBS_SITE")
> [1] "c:/Users/i.gine/AppData/Local/Programs/R/R-4.4.1/site-library"
>> .Library.site
> character(0)
> 
> Is this consistent?

It is implied that R_LIBS_SITE should point to an existing directory. I see the 
same thing on Mac:

> .Library.site
character(0)
> Sys.getenv("R_LIBS_SITE")
[1] "/Library/Frameworks/R.framework/Resources/site-library"
> list.files(Sys.getenv("R_LIBS_SITE"))
character(0)

I.e., R_LIBS_SITE is where a site library _if any_ should live. If it is not 
there, there is no poin in searching it. Unless you actually have a 
site-library, I don't think there is a problem.

> 
> 2 - Next, on the same help document, one can read:
> 
> Then, '.libPaths()' is called with the combination
> of the directories given by 'R_LIBS' and 'R_LIBS_USER'.
> 
> 
> This time, I get
>> Sys.getenv("R_LIBS")
> [1] ""
>> Sys.getenv("R_LIBS_USER")
> [1] "c:/Users/i.gine/AppData/Local/Programs/R/R-4.4.0/library"
>> .libPaths()
> [1] "C:/Users/i.gine/AppData/Local/Programs/R/R-4.4.0/library" 
> "C:/Users/i.gine/AppData/Local/Programs/R/R-4.4.1/library"
> 
> 
> Later is written:
> 
> Function '.libPaths' always uses the values of '.Library' and
> '.Library.site' in the base namespace.
> 
> and indeed
> 
>> .Library
> [1] "c:/Users/i.gine/AppData/Local/Programs/R/R-4.4.1/library"
> 
> 
> Then, shouldn't be this specified above together with "directories given by 
> 'R_LIBS' and 'R_LIBS_USER'"?
> 

The logic of .libPath() is 

> .libPaths
function (new, include.site = TRUE) 
{
if (!missing(new)) {
new <- Sys.glob(path.expand(new))
paths <- c(new, if (include.site) .Library.site, .Library)
paths <- paths[dir.exists(paths)]
.lib.loc <<- unique(normalizePath(paths, "/"))
}
else .lib.loc
}

so if you "call it with" new=something, then (.Library.site, .Library) is 
automagically appended, unless you expressly tell it not to. 

-pd

> 
> Am I understanding it wrongly? Otherwise, what do you think on the current 
> way this help page is explained?
> 
> Thank you for your help and time.
> 
> Best regards,
> 
> Iago
> 
>   [[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.

-- 
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-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] Column names of model.matrix's output with contrast.arg

2024-06-14 Thread peter dalgaard
You're at the mercy of the various contr.XXX functions. They may or may not set 
the colnames on the matrices that they generate. 

The rationales for (not) setting them is not perfectly transparent, but you 
obviously cannot use level names on contr.poly, so it uses .L, .Q, etc. 

In MASS, contr.sdif is careful about labeling the columns with the levels that 
are being diff'ed. 

For contr.treatment, there is a straightforward connection to 0/1 dummy 
variables, so level names there are natural.

One could use levels in contr.sum and contr.helmert, but it might confuse users 
that comparisons are with the average of all levels or preceding levels. (It 
can be quite confusing when coding is +1 for male and -1 for female, so that 
the gender difference is twice the coefficient.)

-pd

> On 14 Jun 2024, at 08:12 , Christophe Dutang  wrote:
> 
> Dear list,
> 
> Changing the default contrasts used in glm() makes me aware how 
> model.matrix() set column names.
> 
> With default contrasts, model.matrix() use the level values to name the 
> columns. However with other contrasts, model.matrix() use the level indexes. 
> In the documentation, I don’t see anything in the documentation related to 
> this ? It does not seem natural to have such a behavior?
> 
> Any comment is welcome.
> 
> An example is below.
> 
> Kind regards, Christophe  
> 
> 
> #example from ?glm
> counts <- c(18,17,15,20,10,20,25,13,12)
> outcome <- paste0("O", gl(3,1,9))
> treatment <- paste0("T", gl(3,3))
> 
> X3 <- model.matrix(counts ~ outcome + treatment)
> X4 <- model.matrix(counts ~ outcome + treatment, contrasts = 
> list("outcome"="contr.sum"))
> X5 <- model.matrix(counts ~ outcome + treatment, contrasts = 
> list("outcome"="contr.helmert"))
> 
> #check with original factor
> cbind.data.frame(X3, outcome)
> cbind.data.frame(X4, outcome)
> cbind.data.frame(X5, outcome)
> 
> #same issue with glm
> glm.D93 <- glm(counts ~ outcome + treatment, family = poisson())
> glm.D94 <- glm(counts ~ outcome + treatment, family = poisson(), contrasts = 
> list("outcome"="contr.sum"))
> glm.D95 <- glm(counts ~ outcome + treatment, family = poisson(), contrasts = 
> list("outcome"="contr.helmert"))
> 
> coef(glm.D93)
> coef(glm.D94)
> coef(glm.D95)
> 
> #check linear predictor
> cbind(X3 %*% coef(glm.D93), predict(glm.D93))
> cbind(X4 %*% coef(glm.D94), predict(glm.D94))
> 
> -
> Christophe DUTANG
> LJK, Ensimag, Grenoble INP, UGA, France
> ILB research fellow
> Web: http://dutangc.free.fr
> 
> ______
> 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  Priv: pda...@gmail.com

__
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] [Rd] R 4.4.1 is released

2024-06-14 Thread peter dalgaard
The build system rolled up R-4.4.1.tar.gz (codename "Race for Your Life") this 
morning.

===
This release is dedicated to the memory of Friedrich (Fritz) Leisch, 1968-2024.
===

This is a minor update, with a few bug fixes.

The list below details the changes in this release. 

You can get the source code from

https://cran.r-project.org/src/base/R-4/R-4.4.1.tar.gz
https://cran.r-project.org/src/base/R-4/R-4.4.1.tar.xz

or wait for it to be mirrored at a CRAN site nearer to you.

Binaries for various platforms will appear in due course. 
(The Mac binaries will be delayed for a couple of days because the maintainer 
is traveling.)



For the R Core Team,

Peter Dalgaard


These are the checksums (md5 and SHA-256) for the freshly created files, in 
case you wish
to check that they are uncorrupted:

MD5 (AUTHORS) = 0ba932825aefae5566dc44822916b266
MD5 (COPYING) = eb723b61539feef013de476e68b5c50a
MD5 (COPYING.LIB) = a6f89e2100d9b6cdffcea4f398e37343
MD5 (FAQ) = b3c330c22effc753f0b6fdf3a9612ff5
MD5 (INSTALL) = 7893f754308ca31f1ccf62055090ad7b
MD5 (NEWS) = 3b5b817ed476957d84b35984fd1aaa40
MD5 (NEWS.0) = bfcd7c147251b5474d96848c6f57e5a8
MD5 (NEWS.1) = f8466e418dec6b958b4ce484a13f9a9d
MD5 (NEWS.2) = b38d94569700664205a76a7de836ba83
MD5 (NEWS.3) = 307e75ba323c08b8694f916e45886aa4
MD5 (R-latest.tar.gz) = cfe520ea9fbca4f3c3d8462aaee7af46
MD5 (R-latest.tar.xz) = 7e8bce91f0ed90931cf9b73d6ac64aeb
MD5 (README) = f468f281c919665e276a1b691decbbe6
MD5 (RESOURCES) = a79b9b338cab09bd665f6b62ac6f455b
MD5 (THANKS) = 45b6d2e88a6ecb5b24fa33a781351cd5
MD5 (VERSION-INFO.dcf) = d52fde03caf726a4339a6079911a80e7
MD5 (R-4/R-4.4.1.tar.gz) = cfe520ea9fbca4f3c3d8462aaee7af46
MD5 (R-4/R-4.4.1.tar.xz) = 7e8bce91f0ed90931cf9b73d6ac64aeb

4cc9dcdfa46a2e2cff45c27df8f3a9f851ec97b44b8647ab8a9fbf844f37937f  AUTHORS
e6d6a009505e345fe949e1310334fcb0747f28dae2856759de102ab66b722cb4  COPYING
6095e9ffa777dd22839f7801aa845b31c9ed07f3d6bf8a26dc5d2dec8ccc0ef3  COPYING.LIB
f7703fe28f81edc79b4201665d69b5b41fda4241e832a03acaf7c2cafdf5f939  FAQ
f87461be6cbaecc4dce44ac58e5bd52364b0491ccdadaf846cb9b452e9550f31  INSTALL
59232c66854ee8e09f215a71f5a532ab23422a653a90196b5c1af744ce0c6053  NEWS
4e21b62f515b749f80997063fceab626d7258c7d650e81a662ba8e0640f12f62  NEWS.0
602f3a40ef759c7b2a6c485a33dc674af34249644ac5fb53b21283d4e12e808d  NEWS.1
cde079b6beab7d700d3d4ecda494e2681ad3b7f8fab13b68be090f949393ec62  NEWS.2
05f3f9fc664b845bb3dcc6492503860df72c63b3f179ab241c095e25bb7628f9  NEWS.3
b4cb675deaaeb7299d3b265d218cde43f192951ce5b89b7bb1a5148a36b2d94d  
R-latest.tar.gz
fbd755314a5cc08c57aabff839ff791fb43a9052a2c6524ec3be96075fd34dde  
R-latest.tar.xz
2fdd3e90f23f32692d4b3a0c0452f2c219a10882033d1774f8cadf25886c3ddc  README
8b7d3856100220f4555d4d57140829f2e81c27eccec5b441f5dce616e9ec9061  RESOURCES
8319c5415de58ee10d4bc058d79c370fd8e6b2ad09e25d7a1e04b74ca5f380a6  THANKS
74f11ad0053b5a7b2a3a8eccebcd58dfce69d61980b937966687710ab0d77dae  
VERSION-INFO.dcf
b4cb675deaaeb7299d3b265d218cde43f192951ce5b89b7bb1a5148a36b2d94d  
R-4/R-4.4.1.tar.gz
fbd755314a5cc08c57aabff839ff791fb43a9052a2c6524ec3be96075fd34dde  
R-4/R-4.4.1.tar.xz


This is the relevant part of the NEWS file

CHANGES IN R 4.4.1:

  C-LEVEL FACILITIES:

* Functions R_atof and R_strtod declared in header R_ext/Utils.h
  are now documented in 'Writing R Extensions' and so formally part
  of the API.

* The non-API entry points Rf_setSVector, Rf_StringFalse,
  Rf_StringTrue and Rf_isBlankString have been added to those
  reported by R CMD check.

* The new function Rf_allocLang is now available. This provides an
  alternative to the idiom of calling Rf_allocList followed by
  SET_TYPEOF.

  UTILITIES:

* R CMD check now reports as warnings what gfortran calls 'Fortran
  2018 deleted features', all of which have long been marked as
  'obsolescent' and some of which were deleted in Fortran 2008 or
  earlier.  Fortran compilers are no longer required to support
  these.

  BUG FIXES:

* as.numeric(), scan(), type.convert() and other places which use
  the internal C function R_strtod now require a _non-empty_ digit
  sequence in a decimal or binary exponent.  This aligns with the
  C/POSIX standard for strtod and with ?NumericConstants.

* as.data.frame(m, make.names=NA) now works correctly for a matrix
  m with NA's in row names.

* The error message from [["hour"]] and similar now
  mentions *[[, "hour"]], as wished for in PR#17409 and proposed by
  Michael Chirico.

* qbinom() and potentially qpois(), qnbinom(), no longer sometimes
  fail accurate inversion (of pbinom(), etc), thanks to Christopher
  Chang's report and patch in PR#18711.

* The internal help server on Windows can again serve r

Re: [R] R code for overlapping variables -- count

2024-06-03 Thread peter dalgaard
If they are binary (0/1 dummies), can't you just "&" them as in 

table(Female & USA & MidIncome)

(or sum() if you don't care about the number of 0s)

-pd

> On 2 Jun 2024, at 00:31 , Shadee Ashtari  wrote:
> 
> Hi!
> 
> I am trying to find the code for how to get counts for intersectional
> variables. For example, I have three unique categorical variables --
> "Female," "USA," and "MidIncome" -- and I'm trying to see how many people I
> have at the intersection of the three.
> 
> Thank you so much,
> Shadee
> 
>   [[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.

-- 
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-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] [Rd] R 4.4.1 scheduled for June 14

2024-05-31 Thread peter dalgaard
Full schedule is available on developer.r-project.org (pending update from SVN).

-- 
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-de...@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

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


Re: [R] R, RStudio, and a server for my iPad.

2024-05-21 Thread peter dalgaard
...or look inside the administration interface for your router. Typically 
starts with opening a browser on 192.168.0.1 or 192.168.1.1 (with a password 
that you presumably have from your provider) and going to "Access Control" or 
thereabouts.

-pd

> On 12 Apr 2014, at 20:08 , Viechtbauer Wolfgang (STAT) 
>  wrote:
> 
> You will have to enter the external IP address and then use port forwarding.
> 
> Just google for that term (port forwarding) ... For example:
> 
> http://www.howtogeek.com/66214/how-to-forward-ports-on-your-router/
> http://en.wikipedia.org/wiki/Port_forwarding
> 
> Best,
> Wolfgang
> 
> From: r-help-boun...@r-project.org [r-help-boun...@r-project.org] On Behalf 
> Of John Sorkin [jsor...@grecc.umaryland.edu]
> Sent: Saturday, April 12, 2014 7:37 PM
> To: fransiepansiekever...@gmail.com
> Cc: r-help@r-project.org
> Subject: Re: [R] R, RStudio, and a server for my iPad.
> 
> Grand,
> Thank you. I have been able to use my iPad to connect to a server running 
> RStudio server as described in an earlier email and can use the virtual 
> keyboard, which works but is not convenient as one needs to go from keyboard 
> screen to another.
> My current problem is that while I can get everything to work when my iPad is 
> on my local network, I don't know how to access my server from outside my 
> LAN. I know my server's private IP address I know my cable modem's external 
> IP address, but I have no idea what IP address to enter in my iPad, when my 
> iPad is outside my LAN trying to access my server.
> John
> __
> 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.

-- 
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-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] De-serialization vulnerability?

2024-05-02 Thread peter dalgaard
As a general matter, security holes are usually not advertised by detailing 
them in the NEWS file. 

The disclosure of such things goes on a different schedule, typically _after_ 
binaries are out, at which point editing the NEWS file is too late. 

There are other things that do not go into NEWS: Documentation fixups, etc. 
What does go in is end-user visible functional changes and items that have an 
explicit PR# against them. 

- Peter D. 



> On 1 May 2024, at 18:57 , Howard, Tim G (DEC) via R-help 
>  wrote:
> 
> All, 
> There seems to be a hullaboo about a vulnerability in R when deserializing 
> untrusted data:
> 
> https://hiddenlayer.com/research/r-bitrary-code-execution
> 
> https://nvd.nist.gov/vuln/detail/CVE-2024-27322
> 
> https://www.kb.cert.org/vuls/id/238194
> 
> 
> Apparently a fix was made for R 4.4.0, but I see no mention of it in the 
> changes report:
> 
> https://cloud.r-project.org/bin/windows/base/NEWS.R-4.4.0.html
> 
> Is this real?  Were there changes in R 4.4.0 that aren't reported?
> 
> Of course, we should *always* update to the most recent version, but I was 
> confused why it wasn't mentioned in the release info. 
> 
> Thanks,
> Tim
> 
> __
> 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  Priv: pda...@gmail.com

__
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] [Rd] R 4.4.0 is released

2024-04-24 Thread Peter Dalgaard via R-announce
The build system rolled up R-4.4.0.tar.gz and R-4.4.0.tar.xz (codename "Puppy 
Cup") this morning.

This is a major update, containing many new features and bug fixes.

The list below details the changes in this release. 

You can get the source code from

https://cran.r-project.org/src/base/R-4/R-4.4.0.tar.gz
https://cran.r-project.org/src/base/R-4/R-4.4.0.tar.xz

or wait for it to be mirrored at a CRAN site nearer to you.

Binaries for various platforms will appear in due course.


For the R Core Team,

Peter Dalgaard


These are the checksums (md5 and SHA-256) for the freshly created files, in 
case you wish
to check that they are uncorrupted:

MD5 (AUTHORS) = 7af154b485d63c810210f8093c300dc6
MD5 (COPYING) = eb723b61539feef013de476e68b5c50a
MD5 (COPYING.LIB) = a6f89e2100d9b6cdffcea4f398e37343
MD5 (FAQ) = 8c980fe8c8bd9fe872fd9cd9774e5c9e
MD5 (INSTALL) = 7893f754308ca31f1ccf62055090ad7b
MD5 (NEWS) = 1eeb7eec5f4d1c1121a433938b1515a5
MD5 (NEWS.0) = bfcd7c147251b5474d96848c6f57e5a8
MD5 (NEWS.1) = f8466e418dec6b958b4ce484a13f9a9d
MD5 (NEWS.2) = b38d94569700664205a76a7de836ba83
MD5 (NEWS.3) = 307e75ba323c08b8694f916e45886aa4
MD5 (R-latest.tar.gz) = 400b43da0c2e67e62ec9f90d509a9e10
MD5 (R-latest.tar.xz) = 647ef3e012e9cf36a187db64a6082217
MD5 (README) = f468f281c919665e276a1b691decbbe6
MD5 (RESOURCES) = a79b9b338cab09bd665f6b62ac6f455b
MD5 (THANKS) = 45b6d2e88a6ecb5b24fa33a781351cd5
MD5 (VERSION-INFO.dcf) = 0d8b5abfa71e0a6b6d934ce28dfc81b8
MD5 (R-4/R-4.4.0.tar.gz) = 400b43da0c2e67e62ec9f90d509a9e10
MD5 (R-4/R-4.4.0.tar.xz) = 647ef3e012e9cf36a187db64a6082217


f00177d1ba0a6fdf85a87ef2bb20a39edbc7108dec2852042c2b5a00783b2df5  AUTHORS
e6d6a009505e345fe949e1310334fcb0747f28dae2856759de102ab66b722cb4  COPYING
6095e9ffa777dd22839f7801aa845b31c9ed07f3d6bf8a26dc5d2dec8ccc0ef3  COPYING.LIB
64eecb635b7c2d511d58ace067825dfc5174bf2225b0935d880ca869b037c7e1  FAQ
f87461be6cbaecc4dce44ac58e5bd52364b0491ccdadaf846cb9b452e9550f31  INSTALL
d17ac7c22d5411b47597fa84cd887e75c6976b38ad0cdfd2fd37e4333a7f19b4  NEWS
4e21b62f515b749f80997063fceab626d7258c7d650e81a662ba8e0640f12f62  NEWS.0
602f3a40ef759c7b2a6c485a33dc674af34249644ac5fb53b21283d4e12e808d  NEWS.1
cde079b6beab7d700d3d4ecda494e2681ad3b7f8fab13b68be090f949393ec62  NEWS.2
05f3f9fc664b845bb3dcc6492503860df72c63b3f179ab241c095e25bb7628f9  NEWS.3
ace4125f9b976d2c53bcc5fca30c75e30d4edc401584859cbadb080e72b5f030  
R-latest.tar.gz
5c6c4c2df763fcdd985c5696e909e13c80d75d5f80d42c1adb72fabef4b23d57  
R-latest.tar.xz
2fdd3e90f23f32692d4b3a0c0452f2c219a10882033d1774f8cadf25886c3ddc  README
8b7d3856100220f4555d4d57140829f2e81c27eccec5b441f5dce616e9ec9061  RESOURCES
8319c5415de58ee10d4bc058d79c370fd8e6b2ad09e25d7a1e04b74ca5f380a6  THANKS
9ec1217b980300e2f422548703811f12cc0cdd40d152050cf78e4ffb63c85f76  
VERSION-INFO.dcf
ace4125f9b976d2c53bcc5fca30c75e30d4edc401584859cbadb080e72b5f030  
R-4/R-4.4.0.tar.gz
5c6c4c2df763fcdd985c5696e909e13c80d75d5f80d42c1adb72fabef4b23d57  
R-4/R-4.4.0.tar.xz

This is the relevant part of the NEWS file

CHANGES IN R 4.4.0:

  SIGNIFICANT USER-VISIBLE CHANGES:

* Startup banners, R --version, sessionInfo() and R CMD check no
  longer report (64-bit) as part of the platform as this is almost
  universal - the increasingly rare 32-bit platforms will still
  report (32-bit).

  On Windows, ditto for window titles.

* is.atomic(NULL) now returns FALSE, as NULL is not an atomic
  vector.  Strict back-compatibility would replace is.atomic(foo)
  by (is.null(foo) || is.atomic(foo)) but should happen only
  sparingly.

  NEW FEATURES:

* The confint() methods for "glm" and "nls" objects have been
  copied to the stats package.  Previously, they were stubs which
  called versions in package MASS. The MASS namespace is no longer
  loaded if you invoke (say) confint(glmfit).  Further, the "glm"
  method for profile() and the plot() and pairs() methods for class
  "profile" have been copied from MASS to stats.  (profile.nls()
  and plot.profile.nls() were already in stats.)

* The confint() and profile methods for "glm" objects have gained a
  possibility to do profiling based on the Rao Score statistic in
  addition to the default Likelihood Ratio. This is controlled by a
  new test = argument.

* The pairs() method for "profile" objects has been extended with a
  which = argument to allow plotting only a subset of the
  parameters.

* The "glm" method for anova() computes test statistics and
  p-values by default, using a chi-squared test or an F test
  depending on whether the dispersion is fixed or free.  Test
  statistics can be suppressed by giving argument test a false
  logical value.

* In setRepositories() the repositories can be set using their
  names via name = instead of index ind =.

* methods() and .S3methods() gain a all.names option for the (rare)
  

Re: [R] x[0]: Can '0' be made an allowed index in R?

2024-04-23 Thread Peter Dalgaard via R-help
Doesn't sound like you got the point. x[-1] normally removes the first element. 
With 0-based indices, this cannot work.

- pd 

> On 22 Apr 2024, at 17:31 , Ebert,Timothy Aaron  wrote:
> 
> You could have negative indices. There are two ways to do this.
> 1) provide a large offset.
> Offset <- 30
> for (i in -29 to 120) { print(df[i+Offset])}
> 
> 
> 2) use absolute values if all indices are negative.
> for (i in -200 to -1) {print(df[abs(i)])}
> 
> Tim
> 
> 
> 
> -Original Message-
> From: R-help  On Behalf Of Peter Dalgaard via 
> R-help
> Sent: Monday, April 22, 2024 10:36 AM
> To: Rolf Turner 
> Cc: R help project ; Hans W 
> Subject: Re: [R] x[0]: Can '0' be made an allowed index in R?
> 
> [External Email]
> 
> Heh. Did anyone bring up negative indices yet?
> 
> -pd
> 
>> On 22 Apr 2024, at 10:46 , Rolf Turner  wrote:
>> 
>> 
>> See fortunes::fortune(36).
>> 
>> cheers,
>> 
>> Rolf Turner
>> 
>> --
>> Honorary Research Fellow
>> Department of Statistics
>> University of Auckland
>> Stats. Dep't. (secretaries) phone:
>>+64-9-373-7599 ext. 89622
>> Home phone: +64-9-480-4619
>> 
>> __
>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> https://stat/
>> .ethz.ch%2Fmailman%2Flistinfo%2Fr-help&data=05%7C02%7Ctebert%40ufl.edu
>> %7C79ca6aadcaee4aa3241308dc62d986f6%7C0d4da0f84a314d76ace60a62331e1b84
>> %7C0%7C0%7C638493933686698527%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAw
>> MDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=
>> wmv9OYcMES0nElT9OAKTdjBk%2BB55bQ7BjxOuaVVkPg4%3D&reserved=0
>> PLEASE do read the posting guide
>> http://www.r/
>> -project.org%2Fposting-guide.html&data=05%7C02%7Ctebert%40ufl.edu%7C79
>> ca6aadcaee4aa3241308dc62d986f6%7C0d4da0f84a314d76ace60a62331e1b84%7C0%
>> 7C0%7C638493933686711061%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiL
>> CJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=AP78X
>> nfKrX6B0YVM0N76ty9v%2Fw%2BchHIytw33X7M9umE%3D&reserved=0
>> 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  Priv: pda...@gmail.com
> 
> __
> 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  Priv: pda...@gmail.com

__
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] x[0]: Can '0' be made an allowed index in R?

2024-04-22 Thread Peter Dalgaard via R-help
Heh. Did anyone bring up negative indices yet?

-pd

> On 22 Apr 2024, at 10:46 , Rolf Turner  wrote:
> 
> 
> See fortunes::fortune(36).
> 
> cheers,
> 
> Rolf Turner
> 
> -- 
> Honorary Research Fellow
> Department of Statistics
> University of Auckland
> Stats. Dep't. (secretaries) phone:
> +64-9-373-7599 ext. 89622
> Home phone: +64-9-480-4619
> 
> __
> 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  Priv: pda...@gmail.com

__
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] missing() fails to detect missing

2024-04-18 Thread Peter Dalgaard via R-help
I'm not really sure how verboten it is to have methods that omit "...". The 
code seems to be instrumented to handle that case. 

The catch is that it does so by inserting a call to .local where .local is the 
method function, e.g. if you insert a browser() call at the start of the 
method, you'll see

> foo("a")
Called from: .local(x, y, ...)
Browse[1]> sys.status()
$sys.calls
$sys.calls[[1]]
foo("a")

$sys.calls[[2]]
foo("a")

$sys.calls[[3]]
.local(x, y, ...)

$sys.calls[[4]]
browser()

and the 3rd call is absent for foo(0). But y is not missing in the .local call, 
because, hey, it has a default in the parent. 

This also happens in plain function calls, e.g.

> f <- function(a=0)(function(a)missing(a))(a)
> f()
[1] FALSE

Also notice that it is not really "..." that is the trigger of this effect, but 
the fact that the method has different arguments from the generic in any way: 
You get the same situation with

> setMethod("foo", signature="numeric", function(x, y=0, z=1, ...){
+ if (missing(y))
+return("must give y for numeric")
+  y
+ })
> foo(0)
[1] 0

 -pd 



> On 18 Apr 2024, at 06:32 , Jeff Newmiller via R-help  
> wrote:
> 
> Fascinating. Or, well, not.
> 
> Failing to use a method signature that is compatible with the generic is a 
> no-no. So your bug seems to me to be outside the bounds of how R is supposed 
> to be used. So don't do that.
> 
> On April 17, 2024 4:25:38 PM PDT, "Boylan, Ross via R-help" 
>  wrote:
>> When a generic (S4) has an argument with a default followed by ..., 
>> missing() doesn't seem to work if the method omits the ...
>> Sample---
>> foo <- function(x, y=0, ...){
>> "you are very generic"
>> }
>> 
>> # no ... in function arguments
>> setMethod("foo", signature="character", function(x, y=0){
>> if (missing(y))
>>   return("must give y for character")
>> y
>> })
>> 
>> setMethod("foo", signature="numeric", function(x, y=0, ...){
>> if (missing(y))
>>   return("must give y for numeric")
>> y
>> })
>> 
>> print(foo("a"))  #[1] 0
>> print(foo(0))#[1] "must give y for numeric"
>> --
>> It's the result for foo("a") I'm puzzled by, since missing(y) does not 
>> evaluate to TRUE.
>> 
>> Background
>> ==
>> The methods documentation has 2 points on which the above definitions may 
>> fail.
>> 
>> 1. The generic has regular arguments and ... arguments.  But dotsMethods 
>> docs say
>>> either the signature of the generic function is "..." only, or it
>>> does not contain "..."
>> Since the arguments in ... are not part of the signatures I think I'm OK, 
>> but another reading is that
>> one just shouldn't mix ... and other arguments.
>> 
>> 2. setMethod docs say
>>> The definition must be a function with the same formal arguments as the 
>>> generic; however, setMethod() will handle methods that add arguments, if 
>>> ... is a formal argument to the generic.
>> Since the initial definition has arguments x, y, ... and the first method 
>> definition has only x, y, the arguments don't match.  So maybe that's the 
>> problem.
>> 
>> I don't know if the fact that y has a default value matters.
>> 
>> The real code has a function f that ordinarily requires an additional piece 
>> of information, y, to compute a result.  But for one class, the result 
>> doesn't depend on y and so that argument may be omitted.
>> 
>> Context
>> ==
>> R 4.3.3 on MS-Windows under RStudio 2023.12.1 build 402.
>> 
>> Thanks for any insights.
>> Ross
>> 
>> __
>> 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.

-- 
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-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] Question regarding reservoir volume and water level

2024-04-09 Thread peter dalgaard
 Re: [R] Question regarding reservoir volume and water level
>> 
>> Aside from the fact that the original question might well be a class
>> exercise (or homework), the question is unanswerable given the data given
>> by
>> the original poster. One needs to know the dimensions of the reservoir,
>> above and below the current waterline. Are the sides, above and below the
>> waterline smooth? Is the region currently above the waterline that can
>> store
>> water a mirror image of the region below the waterline? Is the region above
>> the reservoir include a flood plane? Will the additional water go into the
>> flood plane?
>> 
>> The lack of required detail in the question posed by the original poster
>> suggests that there are strong assumptions, assumptions that typically
>> would
>> be made in a class-room example or exercise.
>> 
>> John
>> 
>> John David Sorkin M.D., Ph.D.
>> Professor of Medicine, University of Maryland School of Medicine;
>> Associate Director for Biostatistics and Informatics, Baltimore VA Medical
>> Center Geriatrics Research, Education, and Clinical Center;
>> PI Biostatistics and Informatics Core, University of Maryland School of
>> Medicine Claude D. Pepper Older Americans Independence Center;
>> Senior Statistician University of Maryland Center for Vascular Research;
>> 
>> Division of Gerontology and Paliative Care,
>> 10 North Greene Street
>> GRECC (BT/18/GR)
>> Baltimore, MD 21201-1524
>> Cell phone 443-418-5382
>> 
>> 
>> 
>> 
>> 
>> From: R-help  on behalf of Rui Barradas
>> 
>> Sent: Sunday, April 7, 2024 10:53 AM
>> To: javad bayat; R-help
>> Subject: Re: [R] Question regarding reservoir volume and water level
>> 
>> Às 13:27 de 07/04/2024, javad bayat escreveu:
>>> Dear all;
>>> I have a question about the water level of a reservoir, when the volume
>>> changed or doubled.
>>> There is a DEM file with the highest elevation 1267 m. The lowest
>> elevation
>>> is 1230 m. The current volume of the reservoir is 7,000,000 m3 at 1240 m.
>>> Now I want to know what would be the water level if the volume rises to
>>> 1250 m? or what would be the water level if the volume doubled
>> (14,000,000
>>> m3)?
>>> 
>>> Is there any way to write codes to do this in R?
>>> I would be more than happy if anyone could help me.
>>> Sincerely
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>> Hello,
>> 
>> This is a simple rule of three.
>> If you know the level l the argument doesn't need to be named but if you
>> know the volume v then it must be named.
>> 
>> 
>> water_level <- function(l, v, level = 1240, volume = 7e6) {
>>   if(missing(v)) {
>> volume * l / level
>>   } else level * v / volume
>> }
>> 
>> lev <- 1250
>> vol <- 14e6
>> 
>> water_level(l = lev)
>> #> [1] 7056452
>> water_level(v = vol)
>> #> [1] 2480
>> 
>> 
>> Hope this helps,
>> 
>> Rui Barradas
>> 
>> 
>> --
>> Este e-mail foi analisado pelo software antivírus AVG para verificar a
>> presença de vírus.
>> http://www.avg.com/
>> 
>> __
>> 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.
>> 
>> 
> 
> -- 
> Best Regards
> Javad Bayat
> M.Sc. Environment Engineering
> Alternative Mail: bayat...@yahoo.com
> 
>   [[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.

-- 
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-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] CEoptim problems

2024-04-09 Thread peter dalgaard
Hi, Adelchi,

Depends on what you want help with... 

The proximate cause would seem to be that the code ought to have "is.null(A) || 
any(is.NA(A))", which I presume you could fairly easily fix for yourself in the 
package sources or even locally in an R session. Vector-valued logicals in flow 
control constructions have gone through an elborate deprecation process before 
getting turned into errors.

If the problem is how to activate a dormant maintainer and fix the issue for 
everyone, I don't really have a clue,  but you might consider cantacting the 
CRAN team.

Best,
Peter D.

> On 9 Apr 2024, at 12:04 , Adelchi Azzalini  wrote:
> 
> In the attempt to explore the usage of package CEoptim, I have run the code 
> listed at the end of this message. This code is nothing but the one 
> associated to example 5.7 in the main reference of the package, available at 
> https://www.jstatsoft.org/article/view/v076i08
> and is included in the associated file  v76i08.R
> 
> Unfortunately, the call to CEoptim stops with error message 
> 
> Error in is.null(A) || is.na(A) : 
>  'length = 18' in coercion to 'logical(1)’
> 
> On 2024–04-03, I have written about this problem to 
> Maintainer: Benoit Liquet 
> but so far no reply has reached me. 
> 
> Could anyone help?
> 
> Best regards,
> 
> Adelchi Azzalini
> http://azzalini.stat.unipd.it
> 
> 
> 
> library(CEoptim)
> ## 5.7 AR(1) Model with Regime Switching
> set.seed(123)
> 
> sumsqrs <- function(theta, rm1, x) {
>  N <- length(x)  #without x[0]
>  r <- 1 + sort(rm1)  # internal end points of regimes
>  if (r[1] == r[2]) {
># test for dupes -> invalid regime
>return(Inf)
>  }
> thetas <- rep(theta, times = c(r, N) - c(1, r + 1) + 1)
>  xhat <- c(0, head(x, -1)) * thetas
>  ## Compute sum of squared errors
>  sum((x - xhat)^2)
> }
> 
> ## Read the data from CEoptim package
> data("yt", package = "CEoptim")
> xt <- yt - c(0, yt[-300])
> A <- rbind(diag(3), -diag(3))
> b <- rep(1, 6)
> 
> res <- CEoptim(sumsqrs, f.arg = list(xt), continuous = list(mean = c(0, 0, 
> 0), sd = rep(1,3), conMat = A, conVec = b), discrete = list(categories = 
> c(298L, 298L), smoothProb = 0.5),N = 1, rho = 0.001)
> 
> Error in is.null(A) || is.na(A) : 
>  'length = 18' in coercion to 'logical(1)'
> 
> R> sessionInfo()
> R version 4.3.3 (2024-02-29)
> Platform: aarch64-apple-darwin20 (64-bit)
> Running under: macOS Ventura 13.0
> 
> Matrix products: default
> BLAS:   
> /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRblas.0.dylib
>  
> LAPACK: 
> /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRlapack.dylib;
>   LAPACK version 3.11.0
> 
> locale:
> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
> 
> time zone: Europe/Rome
> tzcode source: internal
> 
> attached base packages:
> [1] stats utils datasets  grDevices graphics  methods   base 
> 
> other attached packages:
> [1] CEoptim_1.3  sna_2.7-2network_1.18.2   
> statnet.common_4.9.0
> [5] msm_1.7.1MASS_7.3-60.0.1 
> 
> loaded via a namespace (and not attached):
> [1] vctrs_0.6.2cli_3.6.1  rlang_1.1.1generics_0.1.3   
>  
> [5] jsonlite_1.8.4 glue_1.6.2 colorspace_2.1-0   scales_1.2.1 
>  
> [9] fansi_1.0.4dlstats_0.1.7  grid_4.3.3 expm_0.999-9 
>  
> [13] munsell_0.5.0  tibble_3.2.1   mvtnorm_1.1-3  lifecycle_1.0.3 
>   
> [17] compiler_4.3.3 dplyr_1.1.2coda_0.19-4.1  
> RColorBrewer_1.1-3
> [21] pkgconfig_2.0.3lattice_0.22-5 R6_2.5.1   
> tidyselect_1.2.0  
> [25] utf8_1.2.3 splines_4.3.3  pillar_1.9.0   magrittr_2.0.3  
>   
> [29] Matrix_1.6-5   tools_4.3.3    gtable_0.3.3   survival_3.5-8  
>   
> [33] ggplot2_3.4.2 
> R> 
> 
> __
> 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  Priv: pda...@gmail.com

__
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] Building Packages.

2024-03-21 Thread peter dalgaard
Um, what's with the triple colon? At least on my install, double seems to 
suffice:

> identical(utils:::install.packages, utils::install.packages)
[1] TRUE
> install.packages
function (...) 
.rs.callAs(name, hook, original, ...)


-pd

> On 21 Mar 2024, at 09:58 , Duncan Murdoch  wrote:
> 
> The good news for Jorgen (who may not be reading this thread any more) is 
> that one can still be sure of getting the original install.packages() by using
> 
>utils:::install.packages( ... )
> 
> with *three* colons, to get the internal (namespace) version of the function.
> 
> Duncan Murdoch
> 
> 
> On 21/03/2024 4:31 a.m., Martin Maechler wrote:
>>>>>>> "Duncan Murdoch on Wed, 20 Mar 2024 13:20:12 -0400 writes:
>> > On 20/03/2024 1:07 p.m., Duncan Murdoch wrote:
>> >> On 20/03/2024 12:37 p.m., Ben Bolker wrote:
>> >>> Ivan, can you give more detail on this? I've heard this
>> >>> issue mentioned, but when I open RStudio and run
>> >>> find("install.packages") it returns
>> >>> "utils::install.packages", and running dump() from
>> >>> within RStudio console and from an external "R
>> >>> --vanilla" gives identical results.
>> >>>
>> >>> I thought at one point this might only refer to the GUI
>> >>> package-installation interface, but you seem to be
>> >>> saying it's the install.packages() function as well.
>> >>>
>> >>> Running an up-to-date RStudio on Linux, FWIW -- maybe
>> >>> weirdness only happens on other OSs?
>> >>
>> >> On MacOS, I see this:
>> >>
>> >> > install.packages function (...)  .rs.callAs(name, hook,
>> >> original, ...)  
>> >>
>> >> I get the same results as you from find().  I'm not sure
>> >> what RStudio is doing to give a different value for the
>> >> function than what find() sees.
>> > Turns out that RStudio replaces the install.packages
>> > object in the utils package.
>> > Duncan Murdoch
>> Yes, and this has been the case for several years now, and I
>> have mentioned this several times, too  (though some of it
>> possibly not in a public R-* mailing list).
>> And yes, that they modify the package environment
>>   as.environment("package:utils")
>> but leave the
>>   namespace  asNamespace("utils")
>> unchanged, makes it harder to see what's
>> going on (but also has less severe consequences; if they kept to
>> the otherwise universal *rule* that the namespace and package must have the 
>> same objects
>> apart from those only in the namespace,
>> people would not even have access to R's true install.packages()
>> but only see the RStudio fake^Hsubstitute..
>> We are still not happy with their decision. Also
>> help(install.packages) goes to R's documentation of R's
>> install.packages, so there's even more misleading of useRs.
>> Martin
>> 
> 
> __
> 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  Priv: pda...@gmail.com

__
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] [Rd] R 4.4.0 scheduled for April 24

2024-03-19 Thread Peter Dalgaard via R-announce
Full schedule is available on developer.r-project.org (pending update from SVN).

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


Re: [R] Problem when trying to install packages

2024-03-18 Thread peter dalgaard
 package ‘timechange’ had non-zero exit status
>>> * installing *source* package 'maps' ...
>>> ** package 'maps' successfully unpacked and MD5 sums checked
>>> ** using staged installation
>>> 
>>>**
>>>WARNING: this package has a configure script
>>>  It probably needs manual configuration
>>>**
>>> 
>>> 
>>> ** libs
>>>   running 'src/Makefile.win' ...
>>> Warning in system(paste("make --no-print-directory", paste("-f",
>>> shQuote(makefiles),  :
>>>   'make' not found
>>> ERROR: compilation failed for package 'maps'
>>> * removing 'C:/R_Libs/maps'
>>> Warning in install.packages :
>>>   installation of package ‘maps’ had non-zero exit status
>>> ERROR: dependency 'lattice' is not available for package 'nlme'
>>> * removing 'C:/R_Libs/nlme'
>>> Warning in install.packages :
>>>   installation of package ‘nlme’ had non-zero exit status
>>> ERROR: dependency 'lattice' is not available for package 'Matrix'
>>> * removing 'C:/R_Libs/Matrix'
>>> Warning in install.packages :
>>>   installation of package ‘Matrix’ had non-zero exit status
>>> * installing *source* package 'cluster' ...
>>> ** package 'cluster' successfully unpacked and MD5 sums checked
>>> ** using staged installation
>>> ** libs
>>> Warning in system(cmd) : 'make' not found
>>> ERROR: compilation failed for package 'cluster'
>>> * removing 'C:/R_Libs/cluster'
>>> Warning in install.packages :
>>>   installation of package ‘cluster’ had non-zero exit status
>>> ERROR: dependency 'lattice' is not available for package 'hexbin'
>>> * removing 'C:/R_Libs/hexbin'
>>> Warning in install.packages :
>>>   installation of package ‘hexbin’ had non-zero exit status
>>> * installing *source* package 'lifecycle' ...
>>> ** package 'lifecycle' successfully unpacked and MD5 sums checked
>>> ** using staged installation
>>> ** R
>>> ** inst
>>> ** byte-compile and prepare package for lazy loading
>>> Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck =
>> vI[[i]]) :
>>>   namespace 'rlang' 0.3.4 is being loaded, but >= 1.1.0 is required
>>> Calls:  ... withCallingHandlers -> loadNamespace ->
>>> namespaceImport -> loadNamespace
>>> Execution halted
>>> ERROR: lazy loading failed for package 'lifecycle'
>>> * removing 'C:/R_Libs/lifecycle'
>>> Warning in install.packages :
>>>   installation of package ‘lifecycle’ had non-zero exit status
>>> ERROR: dependencies 'deldir', 'RcppEigen' are not available for package
>> 'interp'
>>> * removing 'C:/R_Libs/interp'
>>> Warning in install.packages :
>>>   installation of package ‘interp’ had non-zero exit status
>>> ERROR: dependency 'timechange' is not available for package 'lubridate'
>>> * removing 'C:/R_Libs/lubridate'
>>> Warning in install.packages :
>>>   installation of package ‘lubridate’ had non-zero exit status
>>> ERROR: dependency 'maps' is not available for package 'mapproj'
>>> * removing 'C:/R_Libs/mapproj'
>>> Warning in install.packages :
>>>   installation of package ‘mapproj’ had non-zero exit status
>>> ERROR: dependencies 'nlme', 'Matrix' are not available for package 'mgcv'
>>> * removing 'C:/R_Libs/mgcv'
>>> Warning in install.packages :
>>>   installation of package ‘mgcv’ had non-zero exit status
>>> ERROR: dependency 'lifecycle' is not available for package 'vctrs'
>>> * removing 'C:/R_Libs/vctrs'
>>> Warning in install.packages :
>>>   installation of package ‘vctrs’ had non-zero exit status
>>> ERROR: dependencies 'lattice', 'png', 'jpeg', 'interp', 'MASS' are not
>>> available for package 'latticeExtra'
>>> * removing 'C:/R_Libs/latticeExtra'
>>> Warning in install.packages :
>>>   installation of package ‘latticeExtra’ had non-zero exit status
>>> ERROR: dependencies 'lifecycle', 'vctrs' are not available for package
>> 'pillar'
>>> * removing 'C:/R_Libs/pillar'
>>> Warning in install.packages :
>>>   installation of package ‘pillar’ had non-zero exit status
>>> ERROR: dependencies 'lifecycle', 'vctrs' are not available for package
>>> 'tidyselect'
>>> * removing 'C:/R_Libs/tidyselect'
>>> Warning in install.packages :
>>>   installation of package ‘tidyselect’ had non-zero exit status
>>> ERROR: dependencies 'lifecycle', 'vctrs' are not available for package
>> 'purrr'
>>> * removing 'C:/R_Libs/purrr'
>>> Warning in install.packages :
>>>   installation of package ‘purrr’ had non-zero exit status
>>> ERROR: dependencies 'lifecycle', 'pillar', 'vctrs' are not available
>>> for package 'tibble'
>>> * removing 'C:/R_Libs/tibble'
>>> Warning in install.packages :
>>>   installation of package ‘tibble’ had non-zero exit status
>>> ERROR: dependencies 'lifecycle', 'pillar', 'vctrs' are not available
>>> for package 'dplyr'
>>> * removing 'C:/R_Libs/dplyr'
>>> Warning in install.packages :
>>>   installation of package ‘dplyr’ had non-zero exit status
>>> ERROR: dependencies 'cluster', 'hexbin', 'lattice', 'latticeExtra',
>>> 'lubridate', 'mapproj', 'MASS', 'mgcv' are not available for package
>>> 'openair'
>>> * removing 'C:/R_Libs/openair'
>>> Warning in install.packages :
>>>   installation of package ‘openair’ had non-zero exit status
>>> 
>>> 
>>> 
>> Hello,
>> 
>> If you are on Windows, do you have rtools [1] installed?
>> Also, please address your question to R-Help [2], [3], not to me directly.
>> 
>> 
>> [1] https://cran.r-project.org/bin/windows/Rtools/
>> [2] r-help@r-project.org
>> [3] https://stat.ethz.ch/mailman/listinfo/r-help
>> 
>> Hope this helps,
>> 
>> Rui Barradas
>> 
>> 
>> --
>> Este e-mail foi analisado pelo software antivírus AVG para verificar a
>> presença de vírus.
>> www.avg.com
>> 
> 
> 
> -- 
> Best Regards
> Javad Bayat
> M.Sc. Environment Engineering
> Alternative Mail: bayat...@yahoo.com
> 
>   [[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.

-- 
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-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 4.3.3 is released

2024-02-29 Thread Peter Dalgaard via R-announce
The build system rolled up R-4.3.3.tar.gz and .xz (codename "Angel Food Cake") 
this morning.

This is a minor update, intended as the wrap-up release for the 4.3.x series. 

This also marks the 6th anniversary of R-1.0.0. (2000-02-29)

The list below details the changes in this release. 

You can get the source code from

https://cran.r-project.org/src/base/R-4/R-4.3.3.tar.gz
https://cran.r-project.org/src/base/R-4/R-4.3.3.tar.xz

or wait for it to be mirrored at a CRAN site nearer to you.

Binaries for various platforms will appear in due course.


For the R Core Team,

Peter Dalgaard


These are the checksums (md5 and SHA-256) for the freshly created files, in 
case you wish
to check that they are uncorrupted:

MD5 (AUTHORS) = 320967884b547734d6279dedbc739dd4
MD5 (COPYING) = eb723b61539feef013de476e68b5c50a
MD5 (COPYING.LIB) = a6f89e2100d9b6cdffcea4f398e37343
MD5 (FAQ) = 97a3ddc25aab502a70bfb1a79ab6f862
MD5 (INSTALL) = 7893f754308ca31f1ccf62055090ad7b
MD5 (NEWS) = 0aa4babeb5349c3abc6fb02700e8cf53
MD5 (NEWS.0) = bfcd7c147251b5474d96848c6f57e5a8
MD5 (NEWS.1) = 4108ab429e768e29b1c3b418c224246e
MD5 (NEWS.2) = b38d94569700664205a76a7de836ba83
MD5 (NEWS.3) = e55ed2c8a547b827b46e08eb7137ba23
MD5 (R-latest.tar.gz) = 4de100b35e3614c19df5e95e483cc3c3
MD5 (R-latest.tar.xz) = 5602f5996107c346dba12a16e866d2e2
MD5 (README) = f468f281c919665e276a1b691decbbe6
MD5 (RESOURCES) = a79b9b338cab09bd665f6b62ac6f455b
MD5 (THANKS) = 45b6d2e88a6ecb5b24fa33a781351cd5
MD5 (VERSION-INFO.dcf) = becc8fce6e97db1703f9ca6d80e36c9d
MD5 (R-4/R-4.3.3.tar.gz) = 4de100b35e3614c19df5e95e483cc3c3
MD5 (R-4/R-4.3.3.tar.xz) = 5602f5996107c346dba12a16e866d2e2

60a0d150e6fc1f424be76ad7b645d236b56e747692a4679f81ce6536c550e949  AUTHORS
e6d6a009505e345fe949e1310334fcb0747f28dae2856759de102ab66b722cb4  COPYING
6095e9ffa777dd22839f7801aa845b31c9ed07f3d6bf8a26dc5d2dec8ccc0ef3  COPYING.LIB
3a47bca1e2a7db27c0ca12be388c238e2608ff2f768e627650a71a0ffc826038  FAQ
f87461be6cbaecc4dce44ac58e5bd52364b0491ccdadaf846cb9b452e9550f31  INSTALL
f28b88bf20aa2a0078214b89353985680c53092d55f83e59b8295e61ad1150e0  NEWS
4e21b62f515b749f80997063fceab626d7258c7d650e81a662ba8e0640f12f62  NEWS.0
5de7657c5e58e481403c0dd1a74a5c090b3ef481ce75a91dfe05d4b03f63163f  NEWS.1
cde079b6beab7d700d3d4ecda494e2681ad3b7f8fab13b68be090f949393ec62  NEWS.2
1910a2405300b9bc7c76beeb0753a5249cf799afe175ce28f8d782fab723e012  NEWS.3
80851231393b85bf3877ee9e39b282e750ed864c5ec60cbd68e6e139f0520330  
R-latest.tar.gz
9b4c5f4cabab23f38e72fee36d98772c640a97305d06ce6e1a6a73e82b850954  
R-latest.tar.xz
2fdd3e90f23f32692d4b3a0c0452f2c219a10882033d1774f8cadf25886c3ddc  README
8b7d3856100220f4555d4d57140829f2e81c27eccec5b441f5dce616e9ec9061  RESOURCES
8319c5415de58ee10d4bc058d79c370fd8e6b2ad09e25d7a1e04b74ca5f380a6  THANKS
b8c2534c643ffcd942e8df370a4970c913be5dfc24e687bb12d609e974308aef  
VERSION-INFO.dcf
80851231393b85bf3877ee9e39b282e750ed864c5ec60cbd68e6e139f0520330  
R-4/R-4.3.3.tar.gz
9b4c5f4cabab23f38e72fee36d98772c640a97305d06ce6e1a6a73e82b850954  
R-4/R-4.3.3.tar.xz

This is the relevant part of the NEWS file

CHANGES IN R 4.3.3:

  NEW FEATURES:

* iconv() now fixes up variant encoding names such as "utf8"
  case-insensitively.

  DEPRECATED AND DEFUNCT:

* The legacy encoding = "MacRoman" is deprecated in pdf() and
  postscript(): support was incomplete in earlier versions of R.

  BUG FIXES:

* Arguments are now properly forwarded to methods on S4 generics
  with ... in the middle of their formal arguments. This was broken
  for the case when a method introduced an argument but did not
  include ... in its own formals. Thanks to Herv'e Pag`es for the
  report PR#18538.

* Some invalid file arguments to pictex(), postscript() and xfig()
  opened a file called NA rather than throw an error.  These
  included postscript(NULL) (which some people expected to work
  like pdf(NULL)).

* Passing filename = NA to svg(), cairo_pdf(), cairo_ps() or the
  Cairo-based bitmap devices opened a file called NA: it now throws
  an error.

* quartz(file = NA) opened a file called NA, including when used as
  a Quartz-based bitmap device.  It now gives an error.

* rank() now works, fixing PR#18617, thanks to Ilia
  Kats.

* seq.int() did not adequately check its length.out argument.

* match(, .) is correct again for differing time zones,
  ditto for "POSIXlt", fixing PR#18618 reported by Bastian Klein.

* drop.terms(*, dropx = <0-length>) now works, fixing PR#18563 as
  proposed by Mikael Jagan.

* drop.terms(*) keeps + offset(.) terms when it should, PR#18565,
  and drop.terms() no longer makes up a response, PR#18566, fixing
  both bugs thanks to Mikael Jagan.

* getS3method("t", "test") no longer finds the t.test() function,
  fixing PR#18627.

* pdf() and postscript() support for the documented Adobe encoding

Re: [R] converting MATLAB -> R | element-wise operation

2024-02-28 Thread peter dalgaard
Agree that sweep is the tool here.  (If you think it is clunky, check how more 
general array-sweep operations can be done in Matlab.)

However, it isn't really true that sweep isn't  moving things around. Notice 
the call to aperm() at the end of the code for sweep(): 

perm <- c(MARGIN, seq_along(dims)[-MARGIN])
FUN(x, aperm(array(STATS, dims[perm]), order(perm)), ...)

What this essentially does for "our" case is

> rbind(1:3,4:6)/t(matrix(c(2,3,4), 3,2))
 [,1]  [,2] [,3]
[1,]  0.5 0.667 0.75
[2,]  2.0 1.667 1.50

I.e. take the matrix, create the divisor by replicating STATS to form a matrix 
of same size. This is easier if the MARGIN indices come first, because the 
recycling works. So you get the 2x3 matrix by filling a 3x2 and then 
transposing it (aperm() does this more generally). Finally, just call FUN on 
the two arrays.

-pd



> On 27 Feb 2024, at 22:51 , Jeff Newmiller via R-help  
> wrote:
> 
> Why anything but sweep?
> 
> The fundamental data type in Matlab is a matrix... they don't have vectors, 
> they have Nx1 matrices and 1xM matrices.
> 
> Vectors don't have any concept of "row" vs. "column". Straight division is 
> always elementwise with recycling as needed, and matrices are really vectors 
> in row-major order:
> 
> 1 2 3
> 4 5 6
> 
> is really
> 
> 1 4 2 5 3 6
> 
> and when you do straight division NN / lambda then lambda is repeated:
> 
> 1 4 2 5 3 6
> 2 3 4 2 3 4
> 
> to get
> 
> 0.5 1.3 0.5 2.5 1.0 1.5
> 
> but if you transpose first
> 
> 1 4
> 2 5
> 3 6
> 
> then that corresponds to an underlying vector:
> 
> 1 2 3 4 5 6
> 
> which lines up with lambda in t(NN)/lambda as:
> 
> 1 2 3 4 5 6
> 2 3 4 2 3 4
> 
> to obtain:
> 
> 0.50 0.67 0.75 2.0 1.67 1.50
> 
> and inherits the dimensions of t(NN):
> 
> 0.50 2.00
> 0.67 1.67
> 0.75 1.50
> 
> which can be transposed back as in t( t( NN ) / lambda ):
> 
> 0.50 0.67 0.75
> 2.00 1.67 1.50
> 
> but that requires a lot of moving elements around while sweep does not.
> 
> Operators are not necessarily "better" than named functions... they just look 
> different.
> 
> 
> On February 27, 2024 11:54:26 AM PST, Evan Cooch  wrote:
>> So, trying to convert a very long, somewhat technical bit of lin alg 
>> MATLAB code to R. Most of it working, but raninto a stumbling block that 
>> is probaably simple enough for someone to explain.
>> 
>> Basically, trying to 'line up' MATLAB results from an element-wise 
>> division of a matrix by a vector with R output.
>> 
>> Here is a simplified version of the MATLAB code I'm translating:
>> 
>> NN = [1, 2, 3; 4, 5, 6];  % Example matrix
>> lambda = [2, 3, 4];  % Example vector
>> result_matlab = NN ./ lambda;
>> 
>> which yields
>> 
>>  0.5   0.7   0.75000
>>  2.0   1.7   1.5
>> 
>> 
>> So, the only way I have stumbled onto in R to generate the same results 
>> is to use 'sweep'. The following 'works', but I'm hoping someone can 
>> explain why I need something as convoluted as this seems (to me, at least).
>> 
>> NN <- matrix(c(1, 2, 3, 4, 5, 6), nrow = 2, byrow = TRUE)  # Example matrix
>> lambda <- c(2, 3, 4)  # Example vector
>> sweep(NN, 2, lambda, "/")
>> 
>> 
>>  [,1]  [,2] [,3]
>> [1,]  0.5 0.667 0.75
>> [2,]  2.0 1.667 1.50
>> 
>> First tried the more 'obvious' NN/lambda, but that yields 'the wrong 
>> answer' (based solely on what I'm trying to accomplish):
>> 
>> 
>>[,1] [,2] [,3]
>> [1,] 0.50  0.5  1.0
>> [2,] 1.33  2.5  1.5
>> 
>> So, why 'sweep'?
>> 
>>  [[alternative HTML version deleted]]
>> 
>> __
>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
> 
> -- 
> Sent from my phone. Please excuse my brevity.
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

-- 
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-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] Packages sometimes don't update, but no error or warning is thrown

2024-02-19 Thread peter dalgaard
>>>> I would expect any kind of message that the package will
>>>> not be updated, since no newer binary is available or a
>>>> prompt, if I want to compile from source.
>> 
>>> RStudio is doing its own thing for some task, including
>>> 'install.packages()' (and for some reasons, at least on
>>> the platforms on which I use RStudio, RStudio calls
>>> 'install.packages()' and not 'update.packages()' when an
>>> update is requested via the GUI). See:
>> 
>> RStudio> install.packages
>>> function (...) .rs.callAs(name, hook, original, ...)
>>> 
>> 
>>> compared to:
>> 
>> R> install.packages
>>> function (pkgs, lib, repos = getOption("repos"),
>>> contriburl = contrib.url(repos, type), method, available =
>>> NULL, destdir = NULL, dependencies = NA, type =
>>> getOption("pkgType"), configure.args =
>>> getOption("configure.args"), configure.vars =
>>> getOption("configure.vars"), clean = FALSE, Ncpus =
>>> getOption("Ncpus", 1L), verbose = getOption("verbose"),
>>> libs_only = FALSE, INSTALL_opts, quiet = FALSE,
>>> keep_outputs = FALSE, ...) { [...]
>> 
>> 
>>> So if you use Install/Update in the Packages tab of
>>> RStudio and do not experience the behaviour you are
>>> expecting, it is something that you need to discuss with
>>> Posit, not with R. :)
>> 
>>>> However, the only message I get is: ``` trying URL
>>>> ''
>> 
>>> The package name has the version number encoded in it, so
>>> theoretical you should be able to tell at this point
>>> whether the package that is downloaded is the version that
>>> is already installed, hence no update will happen.
>> 
>>> Best wishes,
>> 
>>> Berwin
>> 
>> 
>> Yes, thank's a lot, Berwin.
>> 
>> Indeed I've raised the fact that RStudio
>> hides R's own install.packages() from the user and uses its
>> own, undocumented one ... this has been the case for quite a few years.
>> I found out during teaching --- one of the few times, I use
>> RStudio to use R... in another case where RStudio's
>> install.packages() behaved differently than R's.
>> 
>> I'm pretty sure this is reason for quite a bit of confusion...
> 
> Did they ignore your bug report?
> 
> Duncan Murdoch
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help[https://stat.ethz.ch/mailman/listinfo/r-help][https://stat.ethz.ch/mailman/listinfo/r-help[https://stat.ethz.ch/mailman/listinfo/r-help]]
> PLEASE do read the posting guide 
> http://www.R-project.org/posting-guide.html[http://www.R-project.org/posting-guide.html][http://www.R-project.org/posting-guide.html[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  Priv: pda...@gmail.com

__
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] [Rd] R 4.3.3 scheduled for February 29

2024-02-16 Thread Peter Dalgaard via R-help
Full schedule available on developer.r-project.org in a short while.

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


Re: [R] Packages sometimes don't update, but no error or warning is thrown

2024-02-14 Thread peter dalgaard
What Martin says...

Also, it might help to know that the original, base-R functions are still 
there, as

utils::install.packages()
utils::update.packages()

(+ most likely, a restart of RStudio to make it adapt to the packages that you 
installed behind its back.)

- Peter D.

> On 14 Feb 2024, at 11:50 , Martin Maechler  wrote:
> 
>>>>>> Berwin A Turlach 
>>>>>>on Wed, 14 Feb 2024 11:47:41 +0800 writes:
>>>>>> Berwin A Turlach 
>>>>>>on Wed, 14 Feb 2024 11:47:41 +0800 writes:
> 
>> G'day Philipp,
> 
>> On Tue, 13 Feb 2024 09:59:17 +0100 gernophil--- via R-help
>>  wrote:
> 
>>> this question is related to this
>>> (https://community.rstudio.com/t/packages-are-not-updating/166214/3),
>>> [...]
> 
>>> To sum it up: If I am updating packages (be it via
>>> Bioconductor or CRAN) some packages simply don’t update,
>>> [...]
> 
>>> I would expect any kind of message that the package will
>>> not be updated, since no newer binary is available or a
>>> prompt, if I want to compile from source.
> 
>> RStudio is doing its own thing for some task, including
>> 'install.packages()' (and for some reasons, at least on
>> the platforms on which I use RStudio, RStudio calls
>> 'install.packages()' and not 'update.packages()' when an
>> update is requested via the GUI). See:
> 
>RStudio> install.packages
>> function (...)  .rs.callAs(name, hook, original, ...)
>> 
> 
>> compared to:
> 
>R> install.packages
>> function (pkgs, lib, repos = getOption("repos"),
>> contriburl = contrib.url(repos, type), method, available =
>> NULL, destdir = NULL, dependencies = NA, type =
>> getOption("pkgType"), configure.args =
>> getOption("configure.args"), configure.vars =
>> getOption("configure.vars"), clean = FALSE, Ncpus =
>> getOption("Ncpus", 1L), verbose = getOption("verbose"),
>> libs_only = FALSE, INSTALL_opts, quiet = FALSE,
>> keep_outputs = FALSE, ...)  { [...]
> 
> 
>> So if you use Install/Update in the Packages tab of
>> RStudio and do not experience the behaviour you are
>> expecting, it is something that you need to discuss with
>> Posit, not with R. :)
> 
>>> However, the only message I get is: ``` trying URL
>>> ''
> 
>> The package name has the version number encoded in it, so
>> theoretical you should be able to tell at this point
>> whether the package that is downloaded is the version that
>> is already installed, hence no update will happen.
> 
>> Best wishes,
> 
>>  Berwin
> 
> 
> Yes, thank's a lot, Berwin.
> 
> Indeed I've raised the fact that RStudio
> hides R's own install.packages() from the user  and uses its
> own, undocumented one ... this has been the case for quite a few years.
> I found out during teaching --- one of the few times, I use
> RStudio to use R... in another case where RStudio's
> install.packages() behaved differently than R's.
> 
> I'm pretty sure this is reason for quite a bit of confusion...
> 
> Martin
> 
> __
> 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  Priv: pda...@gmail.com

__
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] back tick names with predict function

2023-12-01 Thread peter dalgaard
Also, and possibly more constructively, when you get an error like
 
> CI.c = predict(mod2, data.frame( `plant-density` = x), interval = 'c')  # fail
Error in eval(predvars, data, env) : object 'plant-density' not found

you should check your assumptions. Does "newdata" actually contain a columnn 
called "plant-density":

> head(data.frame( `plant-density` = x))
  plant.density
1  65.0
2  65.11912
3  65.23824
4  65.35736
5  65.47648
6  65.59560
> 

I.e., it doesn't. So check help for data.frame and looking for something with 
names.

> On 1 Dec 2023, at 01:47 , Bert Gunter  wrote:
> 
> "Thank you Rui.  I didn't know about the check.names = FALSE argument.
>> Another good reminder to always read help, but I'm not sure I understood
>> what help to read in this case"
> 
> ?data.frame , of course, which says:
> 
> "check.names
> 
> logical. If TRUE then the names of the variables in the data frame are
> checked to ensure that they are syntactically valid variable names and
> are not duplicated. If necessary they are adjusted (by make.names) so
> that they are. "
> 
> -- Bert
> 
> __
> 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  Priv: pda...@gmail.com

__
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] anyone having trouble accesing CRAN?

2023-11-20 Thread peter dalgaard
Notice that getCRANmirrors() without the local.only=TRUE gets its list from 
...tada cran.r-project.org. 

Arguably, that might be in for a change. Meanwhile, you might just use 
cloud.r-project.org right away.  

-pd

> On 15 Nov 2023, at 20:23 , Ivan Krylov  wrote:
> 
> On Wed, 15 Nov 2023 14:13:00 -0500
> "Christopher W. Ryan via R-help"  wrote:
> 
>> Anyone seeing similar?
> 
> Same for me.
> 
> While it worked, CRAN website had the following message:
> 
>>> The CRAN Admin Team will perform system upgrades during the period
>>> Wednesday November 15 until Thursday November 16, 2023. There will
>>> be intermittent outages in service during this time. 
> 
> Use chooseCRANmirror(local.only = TRUE) (or subset() the return value
> of getCRANmirrors(local.only = TRUE)) to access a mirror that works.
> 
> -- 
> Best regards,
> Ivan
> 
> __
> 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  Priv: pda...@gmail.com

__
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] Bug in print for data frames?

2023-11-03 Thread peter dalgaard
It's still kind of weird; embedded 2-column data frames print differently than 
1-column ones:

> d <- data.frame(a=1, b=I(data.frame(d=1,e=2)))
> d
  a b.d b.e
1 1   1   2
> str(d)
'data.frame':   1 obs. of  2 variables:
 $ a: num 1
 $ b:Classes 'AsIs' and 'data.frame':   1 obs. of  2 variables:
  ..$ d: num 1
  ..$ e: num 2
> names(d)
[1] "a" "b"
> d <- data.frame(a=1, b=I(data.frame(d=1)))
> d
  a d
1 1 1
> str(d)
'data.frame':   1 obs. of  2 variables:
 $ a: num 1
 $ b:Classes 'AsIs' and 'data.frame':   1 obs. of  1 variable:
  ..$ d: num 1
> names(d)
[1] "a" "b"

It is happening inside format.data.frame() or as.data.frame.list() but I can't 
figure out the logic at this point.

-pd


> On 26 Oct 2023, at 10:55 , Duncan Murdoch  wrote:
> 
> On 25/10/2023 2:18 a.m., Christian Asseburg wrote:
>> Hi! I came across this unexpected behaviour in R. First I thought it was a 
>> bug in the assignment operator <- but now I think it's maybe a bug in the 
>> way data frames are being printed. What do you think?
>> Using R 4.3.1:
>>> x <- data.frame(A = 1, B = 2, C = 3)
>>> y <- data.frame(A = 1)
>>> x
>>   A B C
>> 1 1 2 3
>>> x$B <- y$A # works as expected
>>> x
>>   A B C
>> 1 1 1 3
>>> x$C <- y[1] # makes C disappear
>>> x
>>   A B A
>> 1 1 1 1
>>> str(x)
>> 'data.frame':   1 obs. of  3 variables:
>>  $ A: num 1
>>  $ B: num 1
>>  $ C:'data.frame':  1 obs. of  1 variable:
>>   ..$ A: num 1
>> Why does the print(x) not show "C" as the name of the third element? I did 
>> mess up the data frame (and this was a mistake on my part), but finding the 
>> bug was harder because print(x) didn't show the C any longer.
> 
> y[1] is a dataframe with one column, i.e. it is identical to y.  To get the 
> result you expected, you should have used y[[1]], to extract column 1.
> 
> Since dataframes are lists, you can assign them as columns of other 
> dataframes, and you'll create a single column in the result whose rows are 
> the columns of the dataframe you're assigning.  This means that
> 
> x$C <- y[1]
> 
> replaces the C column of x with a dataframe.  It retains the name C (you can 
> see this if you print names(x) ), but since the column contains a dataframe, 
> it chooses to use the column name of y when printing.
> 
> If you try
> 
> x$D <- x
> 
> you'll see it generate new names when printing, but the names within x remain 
> as A, B, C, D.
> 
> This is a situation where tibbles do a better job than dataframes:  if you 
> created x and y as tibbles instead of dataframes and executed your code, 
> you'd see this:
> 
>  library(tibble)
>  x <- tibble(A = 1, B = 2, C = 3)
>  y <- tibble(A = 1)
>  x$C <- y[1]
>  x
>  #> # A tibble: 1 × 3
>  #>   A B   C$A
>  #> 
>  #> 1 1 2 1
> 
> Duncan Murdoch
> 
> __
> 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  Priv: pda...@gmail.com

__
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] weights vs. offset (negative binomial regression)

2023-11-02 Thread peter dalgaard
   > Colleagues,
>> >
>> >
>> >
>> > I have a dataset that includes five variables.
>> >
>> > - Catch: the catch number counted in some species (ind.)
>> >
>> > - Effort: fishing effort (the number of fishing vessels)
>> >
>> > - xx1, xx2, xx3: some environmental factors
>> >
>> > As an overdispersion test on the “Catch” variable, I modeled with
>>negative
>> > binomial distribution using a GLM. The “Effort” variable showed a
>>gradually
>> > decreasing trend during the study period. I was able to get the
>>results I
>> > wanted when considered “Effort” function as a weights function in the
>> > negative binomial regression as follows:
>> >
>> >
>> >
>> > library(qcc)
>> >
>> >
>>
>> Catch=c(25,2,7,6,75,5,1,4,66,15,9,25,40,8,7,4,36,11,1,14,141,9,74,38,126,3)
>> >
>> >
>>
>> Effort=c(258,258,258,258,258,258,258,254,252,252,252,252,252,252,252,252,252,252,252,248,246,246,246,246,246,246)
>> >
>> >
>>
>> xx1=c(0.8,0.5,1.2,0.5,1.1,1.1,1.0,0.6,0.9,0.5,1.2,0.6,1.2,0.7,1.0,0.6,1.6,0.7,0.8,0.6,1.7,0.9,1.1,0.5,1.4,0.5)
>> >
>> >
>>
>> xx2=c(1.7,1.6,2.7,2.6,1.5,1.5,2.8,2.5,1.7,1.9,2.2,2.4,1.6,1.4,3.0,2.4,1.4,1.5,2.2,2.3,1.7,1.7,1.9,1.9,1.4,1.4)
>> >
>> >
>>
>> xx3=c(188,40,2,10,210,102,117,14,141,28,48,15,220,115,10,14,320,20,3,10,400,150,145,160,460,66)
>> >
>> > #
>> >
>> > edata <- data.frame(Catch, Effort, xx1, xx2, xx3)
>> >
>> > #
>> >
>> > qcc.overdispersion.test(edata$Catch, type="poisson")
>> >
>> > #
>> >
>> > summary(glm.nb(Catch~xx1+xx2+xx3, weights=Effort, data=edata))
>> >
>> > summary(glm.nb(Catch~xx1+xx2+xx3+offset(log(Effort)), data=edata))
>> >
>> >
>> >
>> > I am not sure the application of the weights function to the negative
>> > binomial regression is correct. Also I wonder if there is a
>>better way
>> > doing this. Can anyone help?
>> >
>> >   [[alternative HTML version deleted]]
>> >
>> > __
>> > 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
>><https://stat.ethz.ch/mailman/listinfo/r-help>
>> > PLEASE do read the posting guide
>>http://www.R-project.org/posting-guide.html
>><http://www.R-project.org/posting-guide.html>
>> > and provide commented, minimal, self-contained, reproducible code.
>>__
>>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
>><https://stat.ethz.ch/mailman/listinfo/r-help>
>>PLEASE do read the posting guide
>>http://www.R-project.org/posting-guide.html
>><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  Priv: pda...@gmail.com

__
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] [Rd] R 4.3.2 is released

2023-10-31 Thread Peter Dalgaard via R-help
The build system rolled up R-4.3.2.tar.gz (codename "Eye Holes") this morning.

This is a minor update, with a few bug fixes.

The list below details the changes in this release. 

You can get the source code from

https://cran.r-project.org/src/base/R-4/R-4.3.2.tar.gz

or wait for it to be mirrored at a CRAN site nearer to you.

Binaries for various platforms will appear in due course.


For the R Core Team,

Peter Dalgaard


These are the checksums (md5 and SHA-256) for the freshly created files, in 
case you wish
to check that they are uncorrupted:

MD5 (AUTHORS) = 320967884b547734d6279dedbc739dd4
MD5 (COPYING) = eb723b61539feef013de476e68b5c50a
MD5 (COPYING.LIB) = a6f89e2100d9b6cdffcea4f398e37343
MD5 (FAQ) = 97a3ddc25aab502a70bfb1a79ab6f862
MD5 (INSTALL) = 7893f754308ca31f1ccf62055090ad7b
MD5 (NEWS) = b9ad3b7a9f54856444ec9849a69b18e3
MD5 (NEWS.0) = bfcd7c147251b5474d96848c6f57e5a8
MD5 (NEWS.1) = 4108ab429e768e29b1c3b418c224246e
MD5 (NEWS.2) = b38d94569700664205a76a7de836ba83
MD5 (NEWS.3) = e55ed2c8a547b827b46e08eb7137ba23
MD5 (R-latest.tar.gz) = 3217f2606bbde5a76fe4deaa4b4d3321
MD5 (README) = f468f281c919665e276a1b691decbbe6
MD5 (RESOURCES) = a79b9b338cab09bd665f6b62ac6f455b
MD5 (THANKS) = 45b6d2e88a6ecb5b24fa33a781351cd5
MD5 (VERSION-INFO.dcf) = 8d6576e0a33475e8b6dcb61f8e49a2b4
MD5 (R-4/R-4.3.2.tar.gz) = 3217f2606bbde5a76fe4deaa4b4d3321

60a0d150e6fc1f424be76ad7b645d236b56e747692a4679f81ce6536c550e949  AUTHORS
e6d6a009505e345fe949e1310334fcb0747f28dae2856759de102ab66b722cb4  COPYING
6095e9ffa777dd22839f7801aa845b31c9ed07f3d6bf8a26dc5d2dec8ccc0ef3  COPYING.LIB
3a47bca1e2a7db27c0ca12be388c238e2608ff2f768e627650a71a0ffc826038  FAQ
f87461be6cbaecc4dce44ac58e5bd52364b0491ccdadaf846cb9b452e9550f31  INSTALL
ec6844344589b717144d51ca3d5d1dbe5bc453d69287c06430f9bb2263abe01f  NEWS
4e21b62f515b749f80997063fceab626d7258c7d650e81a662ba8e0640f12f62  NEWS.0
5de7657c5e58e481403c0dd1a74a5c090b3ef481ce75a91dfe05d4b03f63163f  NEWS.1
cde079b6beab7d700d3d4ecda494e2681ad3b7f8fab13b68be090f949393ec62  NEWS.2
1910a2405300b9bc7c76beeb0753a5249cf799afe175ce28f8d782fab723e012  NEWS.3
b3f5760ac2eee8026a3f0eefcb25b47723d978038eee8e844762094c860c452a  
R-latest.tar.gz
2fdd3e90f23f32692d4b3a0c0452f2c219a10882033d1774f8cadf25886c3ddc  README
8b7d3856100220f4555d4d57140829f2e81c27eccec5b441f5dce616e9ec9061  RESOURCES
8319c5415de58ee10d4bc058d79c370fd8e6b2ad09e25d7a1e04b74ca5f380a6  THANKS
f3acaa77b0034a44c9c9b02767a2d383a7c2c2e2a3e7fec929fa20c5102304c5  
VERSION-INFO.dcf
b3f5760ac2eee8026a3f0eefcb25b47723d978038eee8e844762094c860c452a  
R-4/R-4.3.2.tar.gz

This is the relevant part of the NEWS file

CHANGES IN R 4.3.2:

  NEW FEATURES:

* The default initialization of the "repos" option from the
  repositories file at startup can be skipped by setting
  environment variable R_REPOSITORIES to NULL such that
  getOption("repos") is empty if not set elsewhere.

* qr.X() is now an implicit S4 generic in methods.

* iconv(to = "ASCII//TRANSLIT") is emulated using substitution on
  platforms which do not support it (notably Alpine Linux).  This
  should give a human-readable conversion in ASCII on all platforms
  (rather than NA_character_).

* trans3d() gains options continuous and verbose addressing the
  problem of possible "wrap around" when projecting too long
  curves, as reported by Achim Zeileis in PR#18537.

* tools::showNonASCII() has been rewritten to work better on macOS
  14 (which has a changed implementation of iconv()).

* tiff(type = "quartz") (the default on macOS) now warns if
  compression is specified: it continues to be ignored.

  INSTALLATION on a UNIX-ALIKE:

* There is some support for building with Intel's LLVM-based
  compilers on x86_64 Linux, such as (C) icx, (C++) ipcx and
  (Fortran) ifx from oneAPI 2023.x.y.

* There is support for using LLVM's flang-new as the Fortran
  compiler from LLVM 16.0.x (preferably 17.0.0 or later).

  UTILITIES:

* R CMD check reports the use of the Fortran 90 random number
  generator RANDOM_NUMBER() and the subroutines to initialize it.

  'Writing R Extensions' has example code to use R's RNGs from
  Fortran.

  BUG FIXES:

* substr(x, n, L) <- cc now works (more) correctly for multibyte
  UTF-8 strings x when L > nchar(x), thanks to a report and patch
  by 'Architect 95'.

* contrib.url(character()) now returns 0-length character() as
  documented, which also avoids spurious warnings from
  available.packages() et al. in the edge case of an empty vector
  of repository URLs.

* readChar(., 4e8) no longer fails, thanks to Kodi Arfer's report
  (PR#18557).

* lapply(, as.data.frame) no longer warns falsely for some
  base vector components.

* Communication between parent and child processes in the multicore
  part of parall

Re: [R] How to Calculate the Mean by Multiple Groups in R

2023-10-24 Thread peter dalgaard
Also,

> aggregate(cbind(OD, ODnorm) ~ Time + Target + Conc, data = df, FUN = "mean")
  Time Target Conc   ODODnorm
11   BACT1 765. 108.3
21   BACT2 745.  88.3
31   BACT3 675.  18.0

(You might wish for "cbind(OD,ODnorm) ~ . - Well", but aggregate.formula is not 
smart enough for that.)

-pd

> On 24 Oct 2023, at 14:40 , Sarah Goslee  wrote:
> 
> Hi,
> 
> I think you're misunderstanding which set of variables go on either
> side of the formula.
> 
> Is this what you're looking for?
> 
>> aggregate(OD ~ Time + Target + Conc, data = df, FUN = "mean")
>  Time Target Conc   OD
> 11   BACT1 765.
> 21   BACT2 745.
> 31   BACT3 675.
>> aggregate(ODnorm ~ Time + Target + Conc, data = df, FUN = "mean")
>  Time Target ConcODnorm
> 11   BACT1 108.3
> 21   BACT2  88.3
> 31   BACT3  18.0
> 
> Or using a different form, that might be more straightforward to you:
> 
>> aggregate(df[, c("OD", "ODnorm")], by = df[, c("Time", "Target", "Conc")], 
>> data = df, FUN = "mean")
>  Time Target Conc   ODODnorm
> 11   BACT1 765. 108.3
> 21   BACT2 745.  88.3
> 31   BACT3 675.  18.0
> 
> Sarah
> 
> On Tue, Oct 24, 2023 at 8:31 AM Luigi Marongiu  
> wrote:
>> 
>> Hello,
>> I have a data frame with different groups (Time, Target, Conc) and
>> each entry has a triplicate value of the measurements OD and ODnorm.
>> How can I merge the triplicates into a single mean value?
>> I tried the following:
>> ```
>> df = data.frame(Time=rep(1, 9), Well=paste("A", 1:9, sep=""),
>>OD=c(666, 815, 815, 702, 739, 795, 657, 705, 663),
>>Target=rep("BACT", 9),
>>Conc=c(1,1,1,2,2,2,3,3,3),
>>ODnorm=c(9, 158, 158,  45,  82, 138,   0,  48,   6),
>>stringsAsFactors = FALSE)
>> aggregate(.~ODnorm, df, mean)
>> 
>>> aggregate(.~ODnorm, df, mean)
>>  ODnorm Time Well OD Target Conc
>> 1  0   NA   NA NA NA   NA
>> 2  6   NA   NA NA NA   NA
>> 3  9   NA   NA NA NA   NA
>> 4 45   NA   NA NA NA   NA
>> 5 48   NA   NA NA NA   NA
>> 6 82   NA   NA NA NA   NA
>> 7138   NA   NA NA NA   NA
>> 8158   NA   NA NA NA   NA
>> 
>> aggregate(cbind(Time, Target, Conc) ~ ODnorm, df, mean)
>>  ODnorm Time Target Conc
>> 1  0   NA NA   NA
>> 2  6   NA NA   NA
>> 3  9   NA NA   NA
>> 4 45   NA NA   NA
>> 5 48   NA NA   NA
>> 6 82   NA NA   NA
>> 7138   NA NA   NA
>> 8158   NA NA   NA
>> ```
>> 
>> Thank you.
>> 
>> __
>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
> 
> 
> 
> -- 
> Sarah Goslee (she/her)
> http://www.numberwright.com
> 
> __
> 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  Priv: pda...@gmail.com

__
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] Create new data frame with conditional sums

2023-10-24 Thread peter dalgaard
This seems to work. A couple of fine points, including handling duplicated Pct 
values right, which is easier if you do the reversed cumsum.

> dd2 <- dummydata[order(dummydata$Pct),]
> dd2$Cum <- rev(cumsum(rev(dd2$Totpop)))
> use <- !duplicated(dd2$Pct)
> approx(dd2$Pct[use], dd2$Cum[use], ctof, method="constant", f=1, rule=2)
$x
 [1] 0.00 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.10 0.11 0.12 0.13 0.14
[16] 0.15

$y
 [1] 43800 43800 39300 39300 31000 26750 22750 17800 12700 12700  8000  8000
[13]  8000  3900  3900  3900


> On 14 Oct 2023, at 17:10 , Bert Gunter  wrote:
> 
> Well, here's one way to do it:
> (dat is your example data frame)
> 
> Cutoff <- seq(0, .15, .01)
> Pop <- with(dat, sapply(Cutoff, \(p)sum(Totpop[Pct >= p])))
> 
> I think there must be a more efficient way to do it with cumsum(), though.
> 
> Cheers,
> Bert
> 
> On Sat, Oct 14, 2023 at 12:53 AM Jason Stout, M.D.  
> wrote:
>> 
>> This seems like it should be simple but I can't get it to work properly.  
>> I'm starting with a data frame like this:
>> 
>> Tract  Pct  Totpop
>> 1  0.054000
>> 2  0.033500
>> 3  0.014500
>> 4  0.124100
>> 5  0.213900
>> 6  0.044250
>> 7  0.075100
>> 8  0.094700
>> 9  0.064950
>> 10   0.034800
>> 
>> And I want to end up with a data frame with two columns, a "Cutoff" column 
>> that is a simple sequence of equally spaced cutoffs (let's say in this case 
>> from 0-0.15 by 0.01) and a "Pop" column which equals the sum of "Totpop" in 
>> the prior data frame in which "Pct" is greater than or equal to "cutoff."  
>> So in this toy example, this is what I want for a result:
>> 
>>   Cutoff   Pop
>> 10.00 43800
>> 20.01 43800
>> 30.02 39300
>> 40.03 39300
>> 50.04 31000
>> 60.05 26750
>> 70.06 22750
>> 80.07 17800
>> 90.08 12700
>> 10   0.09 12700
>> 11   0.10  8000
>> 12   0.11  8000
>> 13   0.12  8000
>> 14   0.13  3900
>> 15   0.14  3900
>> 16   0.15  3900
>> 
>> I can do this with a for loop but it seems there should be an easier, 
>> vectorized way that would be more efficient.  Here is a reproducible example:
>> 
>> dummydata<-data.frame(Tract=seq(1,10,by=1),Pct=c(0.05,0.03,0.01,0.12,0.21,0.04,0.07,0.09,0.06,0.03),Totpop=c(4000,3500,4500,4100,
>>  
>>3900,4250,5100,4700,
>>  
>>4950,4800))
>> dfrm<-data.frame(matrix(ncol=2,nrow=0,dimnames=list(NULL,c("Cutoff","Pop"
>> for (i in seq(0,0.15,by=0.01)) {
>> temp<-sum(dummydata[dummydata$Pct>=i,"Totpop"])
>> dfrm[nrow(dfrm)+1,]<-c(i,temp)
>> }
>> 
>> Jason Stout, MD, MHS
>> Division of Infectious Diseases
>> Dept of Medicine
>> Duke University
>> Box 102359-DUMC
>> Durham, NC 27710
>> FAX 919-681-7494
>> 
>> 
>>[[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.

-- 
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-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] [Rd] R 4.3.2 scheduled for October 31

2023-10-13 Thread Peter Dalgaard via R-help
Full schedule available on developer.r-project.org in a short while.

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


Re: [R] Odd result

2023-09-29 Thread peter dalgaard
Yes. Also notice that something fishy seems to be going on in columns 2 and 3 
(assuming that the date/time is 1 column). 
They appear to be read as character data, even though the content is numeric?

-pd

> On 24 Sep 2023, at 11:58 , Michael Dewey  wrote:
> 
> Dear David
> 
> To get the first 46 rows just do KurtzData[1:43,]
> 
> However really you want to find out why it happened. It looks as though the 
> .csv file you read has lots of blank lines at the end. I would open it in an 
> editor to check that.
> 
> Michael
> 
> On 23/09/2023 23:55, Parkhurst, David wrote:
>> With help from several people, I used file.choose() to get my file name, and 
>> read.csv() to read in the file as KurtzData.  Then when I print KurtzData, 
>> the last several lines look like this:
>> 39   5/31/22  16.0  3411.75525 0.0201 0.0214   7.00
>> 40   6/28/22  2:00 PM  0.0  2150.67950 0.0156 0.0294 NA
>> 41   7/25/22 11:00 AM  11.9   1943.5NA NA 0.0500   7.80
>> 42   8/31/22  0220.5NA NA 0.0700  30.50
>> 43   9/28/22  0.067 10.9NA NA 0.0700  10.20
>> 44  10/26/22  0.086  237NA NA 0.1550  45.00
>> 45   1/12/23  1:00 PM 36.2624196NA NA 0.7500 283.50
>> 46   2/14/23  1:00 PM 20.71   55NA NA 0.0500   2.40
>> 47  NA NA NA NA
>> 48  NA NA NA NA
>> 49  NA NA NA NA
>> Then the NA�s go down to one numbered 973.  Where did those extras likely 
>> come from, and how do I get rid of them?  I assume I need to get rid of all 
>> the lines after #46,  to do calculations and graphics, no?
>> David
>>  [[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.
> 
> -- 
> Michael
> 
> __
> 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  Priv: pda...@gmail.com

__
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] prop.trend.test question

2023-09-28 Thread peter dalgaard
In a word: Yes.

We discussed this about 2w ago. Basically, the lm() fits a local Linear 
Probability Model and the coef to "score" gives you the direction of the effect.

In the same thread it was discussed (well, readable between the lines, maybe) 
that if you change the lm() to a Gaussian glm() and use summary(..., 
dispersion=1), you can extract the z-test version of the trend test. (I think 
that the reason for using the chisquare version was to match the example in 
Altman: Practical Statistics for Medical Research.)

Arguably the code should be updated to use the z and at the same time include 
alternative=c("two.sided", "less", "greater") like other 1df tests have. Just a 
matter of these darn little round tuits that you seem never to be able to 
get... Also slightly tricky whether/how to make it backwards compatible.

- pd

> On 25 Sep 2023, at 04:10 , tgs77m--- via R-help  wrote:
> 
> Colleagues,
> 
> The code for prop.trend.test is given by:
> 
> function (x, n, score = seq_along(x)) 
> {
>method <- "Chi-squared Test for Trend in Proportions"
>dname <- paste(deparse1(substitute(x)), "out of",
> deparse1(substitute(n)), 
>",\n using scores:", paste(score, collapse = " "))
>x <- as.vector(x)
>n <- as.vector(n)
>p <- sum(x)/sum(n)
>w <- n/p/(1 - p)
>a <- anova(lm(freq ~ score, data = list(freq = x/n, score =
> as.vector(score)), 
>weights = w))
>chisq <- c(`X-squared` = a["score", "Sum Sq"])
>structure(list(statistic = chisq, parameter = c(df = 1), 
>p.value = pchisq(as.numeric(chisq), 1, lower.tail = FALSE), 
>method = method, data.name = dname), class = "htest")
> }
> 
> It seems to me that the direction of the trend is found using the weighted
> regression lm(freq ~ score, data = list(freq = x/n, score =
> as.vector(score)), 
>weights = w))
> 
> Am I on the right track here?
> 
> Thomas Subia
> 
> __
> 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  Priv: pda...@gmail.com

__
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] Print hypothesis warning- Car package

2023-09-18 Thread peter dalgaard
 be omitted
>> The code to reproduce:
>> ```
>> dat1 <-structure(list(Treatment = structure(c(1L, 1L, 1L, 1L, 3L, 1L,
>>1L, 1L, 1L, 2L, 2L, 2L,
>> 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L,
>>3L, 3L, 4L, 4L, 4L, 4L,
>> 4L, 4L, 4L, 4L), levels = c("Control",
>> "Dabrafenib", "Trametinib", "Combination"), class = "factor"),
>>Expression = structure(c(2L, 2L, 2L, 2L, 2L, 1L,
>> 1L, 1L,
>> 1L, 2L, 2L, 2L, 2L, 1L,
>> 1L, 1L, 1L, 2L, 2L, 2L, 1L, 1L, 1L,
>> 1L, 2L, 2L, 2L, 2L, 1L,
>> 1L, 1L, 1L), levels = c("CD271-",
>> "CD271+"), class = "factor"),
>>Viability = c(128.329809725159, 24.2360176821065,
>> 76.3597924274457, 11.0128771862387, 21.4683836248318,
>>  140.784162982894, 87.4303286565443,
>> 118.181818181818, 53.603690178743,
>>  51.2973284643475, 5.47760907168941,
>> 27.1574091870075, 50.8360561214684,
>>  56.5250816836441, 28.6949836632712,
>> 93.2731116663463, 71.900826446281,
>>  32.2314049586777, 24.2360176821065,
>> 27.4649240822602, 24.0822602344801,
>>  26.542379396502, 30.693830482414,
>> 27.772438977513, 13.4729963482606,
>>  8.24524312896406, 18.5469921199308,
>> 13.9342686911397, 13.3192389006342,
>>  19.9308091485681, 17.6244474341726,
>> 16.2406304055353)),
>>   row.names = c(NA,
>> -32L),
>>   class = c("tbl_df", "tbl", "data.frame"))
>> mod = aov(Viability ~ Treatment*Expression, data = dat1)
>> summary(mod)
>> library(car)
>> Anova(mod, type =2)
>> ```
>>> sessionInfo() R version 4.3.1 (2023-06-16 ucrt) Platform:
>> x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 11 x64 (build
>> 25951) Matrix products: default locale: [1] LC_COLLATE=English_United
>> States.utf8 LC_CTYPE=English_United States.utf8
>> LC_MONETARY=English_United States.utf8 [4] LC_NUMERIC=C
>> LC_TIME=English_United States.utf8 time zone: America/Chicago tzcode
>> source: internal attached base packages: [1] stats graphics grDevices
>> utils datasets methods base other attached packages: [1] car_3.1-2
>> carData_3.0-5 tidyr_1.3.0 readr_2.1.4 readxl_1.4.3 ggplot2_3.4.3
>> dplyr_1.1.3 loaded via a namespace (and not attached): [1] crayon_1.5.2
>> vctrs_0.6.3 cli_3.6.1 rlang_1.1.1 purrr_1.0.2 generics_0.1.3
>> labeling_0.4.3 [8] bit_4.0.5 glue_1.6.2 colorspace_2.1-0 hms_1.1.3
>> scales_1.2.1 fansi_1.0.4 grid_4.3.1 [15] cellranger_1.1.0 abind_1.4-5
>> munsell_0.5.0 tibble_3.2.1 tzdb_0.4.0 lifecycle_1.0.3 compiler_4.3.1
>> [22] pkgconfig_2.0.3 rstudioapi_0.15.0 farver_2.1.1 R6_2.5.1
>> tidyselect_1.2.0 utf8_1.2.3 parallel_4.3.1 [29] vroom_1.6.3 pillar_1.9.0
>> magrittr_2.0.3 bit64_4.0.5 tools_4.3.1 withr_2.5.0 gtable_0.3.4
>> [[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.

-- 
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-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] graph in R with grouping letters from the turkey test with agricolae package

2023-09-13 Thread peter dalgaard
Yes. Old John T. must be turning on his skewer...er, in his grave, I mean.

(I gather he was actually more amicable than that, though.)

- pd

> On 13 Sep 2023, at 16:20 , Ben Bolker  wrote:
> 
>  As a side note, I'm curious how often "Tukey test" is misspelled as "Turkey 
> test".
> 
> 
> Googling '"turkey test" mean comparison' gives 36.1K results (vs 14.3M for 
> '"tukey test" mean comparison" ...
> 
> 
> 
> On 2023-09-13 10:02 a.m., Richard O'Keefe wrote:
>>> d <- read.table("data.txt", TRUE)
>>> cor(d[, 3:6])
>>  VAR1 VAR2 VAR3 VAR4
>> VAR11111
>> VAR21111
>> VAR31111
>> VAR41111
>> VAR1 to VAR4 are, up to linear scaling,
>> exactly the same variable.  Why is that?
>> On Wed, 13 Sept 2023 at 07:38, Loop Vinyl  wrote:
>>> I would like to produce the attached graph (graph1) with the R package
>>> agricolae, could someone give me an example with the attached data (data)?
>>> 
>>> I expect an adapted graph (graph2) with the data (data)
>>> 
>>> Best regards
>>> __
>>> 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.
> 
> -- 
> Dr. Benjamin Bolker
> Professor, Mathematics & Statistics and Biology, McMaster University
> Director, School of Computational Science and Engineering
> (Acting) Graduate chair, Mathematics & Statistics
> > E-mail is sent at my convenience; I don't expect replies outside of working 
> > hours.
> 
> __
> 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  Priv: pda...@gmail.com

__
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] prop.trend.test

2023-09-12 Thread peter dalgaard
Argh, yes, drats, thanks. 

There will be a matter of an estimated residual error.

So

> coef(summary(ht$lmfit))["score","t value"]*sigma(ht$lmfit)
[1] -2.867913

matches the signes square root of the Chi-square.

Or, likely better (avoid 0 df cases), switch to a Gaussian glm fit and use the 
z stat

> coef(summary(ht$glmfit, dispersion = 1))
   Estimate Std. Error   z value  Pr(>|z|)
(Intercept)  1.02187141 0.03199737 31.936102 8.425506e-224
score   -0.03341563 0.01165155 -2.867913  4.131897e-03

The Estimate (-0.0334) should still make sense as the LPM estimate of the 
regression slope.

- Peter D.


> On 8 Sep 2023, at 12:53 , Rui Barradas  wrote:
> 
> Às 10:06 de 08/09/2023, peter dalgaard escreveu:
>> Yes, this was written a bit bone-headed (as I am allowed to say...)
>> If you look at the code, you will see inside:
>> a <- anova(lm(freq ~ score, data = list(freq = x/n, score = 
>> as.vector(score)),
>> weights = w))
>> and the lm() inside should give you the direction via the sign of the 
>> regression coefficient on "score".
>>  So, at least for now, you could just doctor a copy of the code for your own 
>> purposes, as in
>>  fit <- lm(freq ~ score, data = list(freq = x/n, score = as.vector(score)),
>> weights = w)
>>  a <- anova(fit)
>>  and arrange to return coef(fit)["score"] at the end. Something like 
>> structure(... estimate=c(lpm.slope=coef(fit)["score"]) )
>> (I expect that you might also extract the t-statistic from 
>> coef(summary(fit)) and find that it is the signed square root of the 
>> Chi-square, but I won't have time to test that just now.)
>> -pd
>>> On 8 Sep 2023, at 07:22 , Thomas Subia via R-help  
>>> wrote:
>>> 
>>> Colleagues,
>>> 
>>> Thanks all for the responses.
>>> 
>>> I am monitoring the daily total number of defects per sample unit.
>>> I need to know whether this daily defect proportion is trending upward (a 
>>> bad thing for a manufacturing process).
>>> 
>>> My first thought was to use either a u or a u' control chart for this.
>>> As far as I know, u or u' charts are poor to detect drifts.
>>> 
>>> This is why I chose to use prop.trend.test to detect trends in proportions.
>>> 
>>> While prop.trend.test can confirm the existence of a trend, as far as I 
>>> know, it is left to the user
>>> to determine what direction that trend is.
>>> 
>>> One way to illustrate trending is of course to plot the data and use 
>>> geom_smooth and method lm
>>> For the non-statisticians in my group, I've found that using this method 
>>> along with the p-value of prop.trend.test, makes it easier for the users to 
>>> determine the existence of trending and its direction.
>>> 
>>> If there are any other ways to do this, please let me know.
>>> 
>>> Thomas Subia
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> On Thursday, September 7, 2023 at 10:31:27 AM PDT, Rui Barradas 
>>>  wrote:
>>> 
>>> 
>>> 
>>> 
>>> 
>>> Às 14:23 de 07/09/2023, Thomas Subia via R-help escreveu:
>>>> 
>>>> Colleagues
>>>> 
>>>>Consider
>>>> smokers  <- c( 83, 90, 129, 70 )
>>>> patients <- c( 86, 93, 136, 82 )
>>>> 
>>>>prop.trend.test(smokers, patients)
>>>> 
>>>>Output:
>>>> 
>>>>Chi-squared Test for Trend inProportions
>>>> 
>>>>data:  smokers out of patients ,
>>>> 
>>>> using scores: 1 2 3 4
>>>> 
>>>> X-squared = 8.2249, df = 1, p-value = 0.004132
>>>> 
>>>># trend test for proportions indicates proportions aretrending.
>>>> 
>>>>How does one identify the direction of trending?
>>>># prop.test indicates that the proportions are unequal but doeslittle 
>>>> to indicate trend direction.
>>>> All the best,
>>>> Thomas Subia
>>>> 
>>>> 
>>>> [[alternative HTML version deleted]]
>>>> 
>>>> __
>>>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>>> PL

Re: [R] prop.trend.test

2023-09-08 Thread peter dalgaard
Yes, this was written a bit bone-headed (as I am allowed to say...)

If you look at the code, you will see inside:

a <- anova(lm(freq ~ score, data = list(freq = x/n, score = 
as.vector(score)), 
weights = w))

and the lm() inside should give you the direction via the sign of the 
regression coefficient on "score".
 
So, at least for now, you could just doctor a copy of the code for your own 
purposes, as in

 fit <- lm(freq ~ score, data = list(freq = x/n, score = as.vector(score)), 
weights = w)
 a <- anova(fit)
 
and arrange to return coef(fit)["score"] at the end. Something like 
structure(... estimate=c(lpm.slope=coef(fit)["score"]) )

(I expect that you might also extract the t-statistic from coef(summary(fit)) 
and find that it is the signed square root of the Chi-square, but I won't have 
time to test that just now.)

-pd

> On 8 Sep 2023, at 07:22 , Thomas Subia via R-help  
> wrote:
> 
> Colleagues,
> 
> Thanks all for the responses. 
> 
> I am monitoring the daily total number of defects per sample unit. 
> I need to know whether this daily defect proportion is trending upward (a bad 
> thing for a manufacturing process).
> 
> My first thought was to use either a u or a u' control chart for this.
> As far as I know, u or u' charts are poor to detect drifts. 
> 
> This is why I chose to use prop.trend.test to detect trends in proportions.
> 
> While prop.trend.test can confirm the existence of a trend, as far as I know, 
> it is left to the user
> to determine what direction that trend is. 
> 
> One way to illustrate trending is of course to plot the data and use 
> geom_smooth and method lm
> For the non-statisticians in my group, I've found that using this method 
> along with the p-value of prop.trend.test, makes it easier for the users to 
> determine the existence of trending and its direction.
> 
> If there are any other ways to do this, please let me know.
> 
> Thomas Subia
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> On Thursday, September 7, 2023 at 10:31:27 AM PDT, Rui Barradas 
>  wrote: 
> 
> 
> 
> 
> 
> Às 14:23 de 07/09/2023, Thomas Subia via R-help escreveu:
>> 
>> Colleagues
>> 
>>Consider
>> smokers  <- c( 83, 90, 129, 70 )
>> patients <- c( 86, 93, 136, 82 )
>> 
>>prop.trend.test(smokers, patients)
>> 
>>Output:
>> 
>>Chi-squared Test for Trend inProportions
>> 
>>data:  smokers out of patients ,
>> 
>> using scores: 1 2 3 4
>> 
>> X-squared = 8.2249, df = 1, p-value = 0.004132
>> 
>># trend test for proportions indicates proportions aretrending.
>> 
>>How does one identify the direction of trending?
>># prop.test indicates that the proportions are unequal but doeslittle to 
>> indicate trend direction.
>> All the best,
>> Thomas Subia
>> 
>> 
>> [[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.
> Hello,
> 
> By visual inspection it seems that there is a decreasing trend.
> Note that the sample estimates of prop.test and smokers/patients are equal.
> 
> 
> smokers  <- c( 83, 90, 129, 70 )
> patients <- c( 86, 93, 136, 82 )
> 
> prop.test(smokers, patients)$estimate
> #>prop 1prop 2prop 3prop 4
> #> 0.9651163 0.9677419 0.9485294 0.8536585
> 
> smokers/patients
> 
> #> [1] 0.9651163 0.9677419 0.9485294 0.8536585
> 
> plot(smokers/patients, type = "b")
> 
> 
> 
> Hope this helps,
> 
> Rui Barradas
> 
> __
> 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  Priv: pda...@gmail.com

__
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 install.packages(repos = X) does not override the 'repos' R option?

2023-06-19 Thread peter dalgaard
Yes. Specifically, RStudio overrides utils::install.packages() with their own 

> install.packages
function (...) 
.rs.callAs(name, hook, original, ...)


which is paved with good intentions, but does deflect blame towards R Core 
things go wrong.

-pd


> On 15 Jun 2023, at 19:42 , Duncan Murdoch  wrote:
> 
> (Sorry, forgot "Reply all" last time.)
> 
> That's an RStudio bug.  It doesn't happen if you use install.packages()
> from R.
> 
> Duncan Murdoch
> 
> On 14/06/2023 9:22 a.m., Dean Attali wrote:
>> There is a default R option for which repos to install from -
>> `getOption("repos")`.
>> When installing a package using install.packages(), you can provide a
>> `repos` parameter. The default value of that parameter is
>> `getOption("repos")`. I assumed that this parameter would override the R
>> option. In other words, I assumed that if the parameter is provided, then
>> the R option would not even be looked at. But after testing this, it seems
>> this is not the case.
>> For example, running the following two lines in an R session:
>> options(repos=c(CRAN="https://BADNAME.com";))
>> install.packages("vctrs", repos = "https://cloud.R-project.org";)
>> I would have expected the first line to be rendered meaningless, but in
>> fact after running the second line I see errors about the BADNAME
>> repository. This feels like a bug to me, but I'm sure there's a reason
>> behind this. Does anyone know why this is the case?
>>  [[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.

-- 
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-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] [Rd] R 4.3.1 is released

2023-06-16 Thread Peter Dalgaard via R-help
The build system rolled up R-4.3.1.tar.gz (codename "Beagle Scouts") this 
morning.

This is a minor update, with a few bug fixes.

The list below details the changes in this release. 

You can get the source code from

https://cran.r-project.org/src/base/R-4/R-4.3.1.tar.gz

or wait for it to be mirrored at a CRAN site nearer to you.

Binaries for various platforms will appear in due course.


For the R Core Team,

Peter Dalgaard


These are the checksums (md5 and SHA-256) for the freshly created files, in 
case you wish
to check that they are uncorrupted:

MD5 (AUTHORS) = 320967884b547734d6279dedbc739dd4
MD5 (COPYING) = eb723b61539feef013de476e68b5c50a
MD5 (COPYING.LIB) = a6f89e2100d9b6cdffcea4f398e37343
MD5 (FAQ) = 97a3ddc25aab502a70bfb1a79ab6f862
MD5 (INSTALL) = 7893f754308ca31f1ccf62055090ad7b
MD5 (NEWS) = 7ea998dffa2b8d4f5a6aee84c45a383a
MD5 (NEWS.0) = bfcd7c147251b5474d96848c6f57e5a8
MD5 (NEWS.1) = 4108ab429e768e29b1c3b418c224246e
MD5 (NEWS.2) = b38d94569700664205a76a7de836ba83
MD5 (NEWS.3) = e55ed2c8a547b827b46e08eb7137ba23
MD5 (R-latest.tar.gz) = b83cee497046d4aef649eb79e6df83e8
MD5 (README) = f468f281c919665e276a1b691decbbe6
MD5 (RESOURCES) = a79b9b338cab09bd665f6b62ac6f455b
MD5 (THANKS) = 45b6d2e88a6ecb5b24fa33a781351cd5
MD5 (VERSION-INFO.dcf) = 3d4c6bf5bf44d34766f90ed67d05c34a
MD5 (R-4/R-4.3.1.tar.gz) = b83cee497046d4aef649eb79e6df83e8

60a0d150e6fc1f424be76ad7b645d236b56e747692a4679f81ce6536c550e949  AUTHORS
e6d6a009505e345fe949e1310334fcb0747f28dae2856759de102ab66b722cb4  COPYING
6095e9ffa777dd22839f7801aa845b31c9ed07f3d6bf8a26dc5d2dec8ccc0ef3  COPYING.LIB
3a47bca1e2a7db27c0ca12be388c238e2608ff2f768e627650a71a0ffc826038  FAQ
f87461be6cbaecc4dce44ac58e5bd52364b0491ccdadaf846cb9b452e9550f31  INSTALL
a8167cfe28e748b67476d4a21a968cfa24d0935da89cd4514c483f45f3f2a83b  NEWS
4e21b62f515b749f80997063fceab626d7258c7d650e81a662ba8e0640f12f62  NEWS.0
5de7657c5e58e481403c0dd1a74a5c090b3ef481ce75a91dfe05d4b03f63163f  NEWS.1
cde079b6beab7d700d3d4ecda494e2681ad3b7f8fab13b68be090f949393ec62  NEWS.2
1910a2405300b9bc7c76beeb0753a5249cf799afe175ce28f8d782fab723e012  NEWS.3
8dd0bf24f1023c6f618c3b317383d291b4a494f40d73b983ac22ffea99e4ba99  
R-latest.tar.gz
2fdd3e90f23f32692d4b3a0c0452f2c219a10882033d1774f8cadf25886c3ddc  README
8b7d3856100220f4555d4d57140829f2e81c27eccec5b441f5dce616e9ec9061  RESOURCES
8319c5415de58ee10d4bc058d79c370fd8e6b2ad09e25d7a1e04b74ca5f380a6  THANKS
032260f31c56c011a9724930e356eac4d7ddfcaa63c559f95986063ede3bf91a  
VERSION-INFO.dcf
8dd0bf24f1023c6f618c3b317383d291b4a494f40d73b983ac22ffea99e4ba99  
R-4/R-4.3.1.tar.gz

This is the relevant part of the NEWS file

CHANGES IN R 4.3.1:

  C-LEVEL FACILITIES:

* The C-level API version of R's integrate(), Rdqags() in Applic.h,
  now returns the correct number of integrand evaluations neval,
  fixing PR#18515 reported and diagnosed by Stephen Wade.

* The C prototypes for LAPACK calls dspgv and dtptrs in
  R_exts/Lapack.h had one too many and one too few character length
  arguments - but this has not caused any known issues. To get the
  corrected prototypes, include

  #include  // for PR18534fixed
  #ifdef PR18534fixed
  # define usePR18534fix 1
  #endif
  #include 
  
  in your C/C++ code (PR#18534).

  INSTALLATION:

* Many of the checks of esoteric Internet operations and those
  using unreliable external sites have been moved to a new target
  that is not run by default and primarily intended for the core
  developers.  To run them use

  cd tests; make test-Internet-dev
  
  BUG FIXES:

* .S3methods(), typically called from methods(), again marks
  methods from package base as visible.

  Also, the visibility of non-base methods is again determined by
  the method's presence in search().

* tools::Rdiff() is now more robust against invalid strings, fixing
  installation tests on Windows without Rtools installed
  (PR#18530).

* Fix (new) bug in hcl.colors(2, *), by Achim Zeileis (PR#18523).

* head(., ) and tail(..) now produce more useful "Error in
  " error messages, fixing PR#18362.

* Package code syntax on Windows is checked in UTF-8 when UTF-8 is
  the native encoding.

* na.contiguous(x) now also returns the first run, when it is at
  the beginning and there is a later one of the same length;
  reported to R-devel, including a fix, by Georgi Boshnakov.
  Further, by default, it modifies only an existing attr(*,"tsp")
  but otherwise no longer sets one.

* chol(, pivot = ) now gives a correct error or
  warning message (depending on pivot), thanks to Mikael Jagan's
  (PR#18541).

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Office: A 4.23

[R] [Rd] R 4.3.1 scheduled for June 16

2023-05-25 Thread Peter Dalgaard via R-help
Full schedule available on developer.r-project.org in a short while.

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


[R] [Rd] R 4.3.0 is released

2023-04-21 Thread Peter Dalgaard via R-help


The build system rolled up R-4.3.0.tar.gz (codename "Already Tomorrow") this 
morning.

This is a major update, containing many new features and bug fixes.

The list below details the changes in this release. 

You can get the source code from

https://cran.r-project.org/src/base/R-4/R-4.3.0.tar.gz

or wait for it to be mirrored at a CRAN site nearer to you.

Binaries for various platforms will appear in due course.


For the R Core Team,

Peter Dalgaard


These are the checksums (md5 and SHA-256) for the freshly created files, in 
case you wish
to check that they are uncorrupted:

MD5 (AUTHORS) = 320967884b547734d6279dedbc739dd4
MD5 (COPYING) = eb723b61539feef013de476e68b5c50a
MD5 (COPYING.LIB) = a6f89e2100d9b6cdffcea4f398e37343
MD5 (FAQ) = 3f5d6539d3c4878cbbb74dcbee74447f
MD5 (INSTALL) = 7893f754308ca31f1ccf62055090ad7b
MD5 (NEWS) = a63858aea2a450900edf8c965cac1efa
MD5 (NEWS.0) = bfcd7c147251b5474d96848c6f57e5a8
MD5 (NEWS.1) = 4108ab429e768e29b1c3b418c224246e
MD5 (NEWS.2) = b38d94569700664205a76a7de836ba83
MD5 (NEWS.3) = e55ed2c8a547b827b46e08eb7137ba23
MD5 (R-latest.tar.gz) = f8f409fa66b82dbc79ddc5706f19638f
MD5 (README) = f468f281c919665e276a1b691decbbe6
MD5 (RESOURCES) = a79b9b338cab09bd665f6b62ac6f455b
MD5 (THANKS) = 45b6d2e88a6ecb5b24fa33a781351cd5
MD5 (VERSION-INFO.dcf) = cf5eba51ce402edaaa26eacdd4af55b5
MD5 (R-4/R-4.3.0.tar.gz) = f8f409fa66b82dbc79ddc5706f19638f

60a0d150e6fc1f424be76ad7b645d236b56e747692a4679f81ce6536c550e949  AUTHORS
e6d6a009505e345fe949e1310334fcb0747f28dae2856759de102ab66b722cb4  COPYING
6095e9ffa777dd22839f7801aa845b31c9ed07f3d6bf8a26dc5d2dec8ccc0ef3  COPYING.LIB
8c396b0db6b1b072e66ea78deab8c89f71150744420ad9f74de6505aacee9a80  FAQ
f87461be6cbaecc4dce44ac58e5bd52364b0491ccdadaf846cb9b452e9550f31  INSTALL
be75619066603438a01d75f6f9ed741bc4fe15981eac900dd6dd0b1a4861dbb2  NEWS
4e21b62f515b749f80997063fceab626d7258c7d650e81a662ba8e0640f12f62  NEWS.0
5de7657c5e58e481403c0dd1a74a5c090b3ef481ce75a91dfe05d4b03f63163f  NEWS.1
cde079b6beab7d700d3d4ecda494e2681ad3b7f8fab13b68be090f949393ec62  NEWS.2
1910a2405300b9bc7c76beeb0753a5249cf799afe175ce28f8d782fab723e012  NEWS.3
45dcc48b6cf27d361020f77fde1a39209e997b81402b3663ca1c010056a6a609  
R-latest.tar.gz
2fdd3e90f23f32692d4b3a0c0452f2c219a10882033d1774f8cadf25886c3ddc  README
8b7d3856100220f4555d4d57140829f2e81c27eccec5b441f5dce616e9ec9061  RESOURCES
8319c5415de58ee10d4bc058d79c370fd8e6b2ad09e25d7a1e04b74ca5f380a6  THANKS
3281640b70d461113ecb20020f3ed760bd30411c51657354bc3b322fa457fc49  
VERSION-INFO.dcf
45dcc48b6cf27d361020f77fde1a39209e997b81402b3663ca1c010056a6a609  
R-4/R-4.3.0.tar.gz


This is the relevant part of the NEWS file

CHANGES IN R 4.3.0:

  SIGNIFICANT USER-VISIBLE CHANGES:

* Calling && or || with LHS or (if evaluated) RHS of length greater
  than one is now always an error, with a report of the form

  'length = 4' in coercion to 'logical(1)'
  
  Environment variable _R_CHECK_LENGTH_1_LOGIC2_ no longer has any
  effect.

  NEW FEATURES:

* The included BLAS sources have been updated to those shipped with
  LAPACK version 3.10.1.  (This caused some platform-dependent
  changes to package check output.)  And then to the sources from
  LAPACK version 3.11.0 (with changes only to double complex
  subroutines).

* The included LAPACK sources have been updated to include the four
  Fortran 90 routines rather than their Fortran 77 predecessors.
  This may give some different signs in SVDs or
  eigendecompositions..  (This completes the transition to LAPACK
  3.10.x begun in R 4.2.0.)

* The LAPACK sources have been updated to version 3.11.0.  (No new
  subroutines have been added, so this almost entirely bug fixes:
  Those fixes do affect some computations with NaNs, including R's
  NA.)

* The parser now signals _classed_ errors, notably in case of the
  pipe operator |>.  The error object and message now give line and
  column numbers, mostly as proposed and provided by Duncan Murdoch
  in PR#18328.

* toeplitz() is now generalized for asymmetric cases, with a
  toeplitz2() variant.

* xy.coords() and xyz.coords() and consequently, e.g., plot(x,y,
  log = "y") now signal a _classed_ warning about negative values
  of y (where log(.) is NA).  Such a warning can be specifically
  suppressed or caught otherwise.

* Regular expression functions now check more thoroughly whether
  their inputs are valid strings (in their encoding, e.g. in
  UTF-8).

* The performance of grep(), sub(), gsub() and strsplit() has been
  improved, particularly with perl = TRUE and fixed = TRUE.  Use of
  useBytes = TRUE for performance reasons should no longer be
  needed and is discouraged: it may lead to incorrect results.

* apropos() gains an argument dot_internals which is used by the
  completion (help(rcompgen)) 

[R] [Rd] R 4.3.0 scheduled for April 21

2023-03-21 Thread peter dalgaard
Full schedule is available on developer.r-project.org (pending update from SVN).

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


[R] [Rd] R 4.2.3 is released

2023-03-15 Thread peter dalgaard
The build system rolled up R-4.2.3.tar.gz (codename "Shortstop Beagle") this 
morning.

The list below details the changes in this release. 

You can get the source code from

https://cran.r-project.org/src/base/R-4/R-4.2.3.tar.gz

or wait for it to be mirrored at a CRAN site nearer to you.

Binaries for various platforms will appear in due course.


For the R Core Team,

Peter Dalgaard


These are the checksums (md5 and SHA-256) for the freshly created files, in 
case you wish
to check that they are uncorrupted:

MD5 (AUTHORS) = 320967884b547734d6279dedbc739dd4
MD5 (COPYING) = eb723b61539feef013de476e68b5c50a
MD5 (COPYING.LIB) = a6f89e2100d9b6cdffcea4f398e37343
MD5 (FAQ) = 3f5d6539d3c4878cbbb74dcbee74447f
MD5 (INSTALL) = 7893f754308ca31f1ccf62055090ad7b
MD5 (NEWS) = 4a300bf9bd24e704614f036452355d23
MD5 (NEWS.0) = bfcd7c147251b5474d96848c6f57e5a8
MD5 (NEWS.1) = 4108ab429e768e29b1c3b418c224246e
MD5 (NEWS.2) = b38d94569700664205a76a7de836ba83
MD5 (NEWS.3) = e55ed2c8a547b827b46e08eb7137ba23
MD5 (R-latest.tar.gz) = ebfc90b1552581f2b7c9a50f934e6bb0
MD5 (README) = f468f281c919665e276a1b691decbbe6
MD5 (RESOURCES) = a79b9b338cab09bd665f6b62ac6f455b
MD5 (THANKS) = 45b6d2e88a6ecb5b24fa33a781351cd5
MD5 (VERSION-INFO.dcf) = d08f0c8f65c2a021be36324081440dd9
MD5 (R-4/R-4.2.3.tar.gz) = ebfc90b1552581f2b7c9a50f934e6bb0

60a0d150e6fc1f424be76ad7b645d236b56e747692a4679f81ce6536c550e949  AUTHORS
e6d6a009505e345fe949e1310334fcb0747f28dae2856759de102ab66b722cb4  COPYING
6095e9ffa777dd22839f7801aa845b31c9ed07f3d6bf8a26dc5d2dec8ccc0ef3  COPYING.LIB
8c396b0db6b1b072e66ea78deab8c89f71150744420ad9f74de6505aacee9a80  FAQ
f87461be6cbaecc4dce44ac58e5bd52364b0491ccdadaf846cb9b452e9550f31  INSTALL
be3cd8a6d7220726d2cbdf1b929e6b75c09101214b1b006e29ce97dab4450553  NEWS
4e21b62f515b749f80997063fceab626d7258c7d650e81a662ba8e0640f12f62  NEWS.0
5de7657c5e58e481403c0dd1a74a5c090b3ef481ce75a91dfe05d4b03f63163f  NEWS.1
cde079b6beab7d700d3d4ecda494e2681ad3b7f8fab13b68be090f949393ec62  NEWS.2
1910a2405300b9bc7c76beeb0753a5249cf799afe175ce28f8d782fab723e012  NEWS.3
55e4a9a6d43be314e2c03d0266a6fa5444afdce50b303bfc3b82b3979516e074  
R-latest.tar.gz
2fdd3e90f23f32692d4b3a0c0452f2c219a10882033d1774f8cadf25886c3ddc  README
8b7d3856100220f4555d4d57140829f2e81c27eccec5b441f5dce616e9ec9061  RESOURCES
8319c5415de58ee10d4bc058d79c370fd8e6b2ad09e25d7a1e04b74ca5f380a6  THANKS
4701c6802bf3f31e6f8ad66d47909eef0985f8af97b0a28fd391c68a7d3ffc18  
VERSION-INFO.dcf
55e4a9a6d43be314e2c03d0266a6fa5444afdce50b303bfc3b82b3979516e074  
R-4/R-4.2.3.tar.gz

This is the relevant part of the NEWS file

CHANGES IN R 4.2.3:

  C-LEVEL FACILITIES:

* The definition of DL_FUNC in R_ext/Rdynload.h has been changed to
  be fully C-compliant.  This means that functions loaded _via_ for
  example R_GetCCallable need to be cast to an appropriate type if
  they have any arguments.

* .Machine has a new element sizeof.time_t to identify old systems
  with a 32-bit type and hence a limited range of date-times (and
  limited support for dates millions of years from present).

  PACKAGE INSTALLATION:

* (Windows) The default C++ standard had accidentally been left at
  C++11 when it was changed to C++14 on Unix.

  BUG FIXES:

* As "POSIXlt" objects may be "partially filled" and their list
  components meant to be recycled, length() now is the length of
  the longest component.

* as.POSIXlt.Date() could underflow for dates in the far past (more
  than half a million years BCE).

* as.Date.POSIXlt(x) would return "1970-01-01" instead of NA in R
  4.2.2, e.g., for

  x <- as.POSIXlt(c("2019-01-30","2001-1-1"))
  x$mon <- c(0L, NA); as.Date(x)
  
* R CMD check failed to apply enabled _R_CHECK_SUGGESTS_ONLY_ to
  examples and vignettes (regression in R 4.2.0).

* R CMD check did not re-build vignettes in separate processes by
  default (regression in R 4.2.0).

* Running examples from HTML documentation now restores previous
  knitr settings and options (PR#18420).

* Quartz: fonts are now located using Core Graphics API instead of
  deprecated ATS which is no longer supported in the macOS 13 SDK
  (PR#18426).  This also addresses an issue where the currently
  used font in the Quartz device context was not correctly
  retained.

* (Windows) Math symbols in text drawing functions are again
  rendered correctly (PR#18440).  This fixes a regression in R
  4.2.1 caused by a fix in PR#18382 which uncovered an issue in
  GraphApp due to which the symbol charset was not used with TT
  Symbol font face.

* (Windows) Installing a package with a src/Makefile.{win,ucrt}
  file includes ~/.R/Makevars.win64 in the search for user
  makevars, as documented in "R Installation and Administration"
  and done for packages with a src/Makevars.{win,ucrt} file.

[R] [Rd] R 4.2.3 scheduled for March 15

2023-03-01 Thread Peter Dalgaard via R-help
Full schedule available on developer.r-project.org in a short while.

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


Re: [R] Problem of intercept?

2023-02-22 Thread peter dalgaard
Not sure what you are trying to do here.

The immediate issue is that you are getting 'y' on the RHS, because that is the 
1st column in Dataset. So "for (i in 2:3)" might be closer to intention. 

However, a 0/1 regresson with no intercept implies that the mean for the "0" 
group is zero, and with two regressors that the mean is zero for the (0,0) 
group. Looking at the data, this is quite clearly not the case.

I suppose you may have intended to fit the models _with_ the intercept and then 
_ignore_ the intercept for plotting purposes, i.e. lm(y~x11+x12, 
Dataset)$coef[-1], etc.?

(Also, I suspect that you don't actually have y=7 and y=867 in the dataset.)

-pd
 
> On 21 Feb 2023, at 22:33 , varin sacha via R-help  
> wrote:
> 
> Dear R-experts,
> 
> Here below my R code working with quite a few warnings. 
> x11 and x12 are dichotomous variable (0=no and 1=yes). I substract 1 to 
> ignore intercept.
> I would like not to ignore intercept. How to modify my R code because if I 
> just remove -1 it does not work?
> 
> 
> y= c(32,45,65,34,23,43,65,76,87,98,7,867,56,45,65,76,88,34,55,66)
> x11=c(0,1,1,0,0,1,1,1,0,0,1,0,0,1,0,0,1,1,0,1)
> x12=c(0,1,0,1,0,1,1,0,1,1,0,0,1,1,1,0,0,1,0,0)
>  
> Dataset=data.frame(y,x11,x12)
>  
> a=lm(y~x11+x12-1,Dataset)$coef
> b=NULL
> for(i in c(1:2)) {
>   f=formula(paste('y~',names(Dataset)[i],-1))
>   b=c(b,lm(f,Dataset)$coef)
> }
> coef=data.frame(rbind(a,b))
> coef$Model=c('Multi','Single')
> library(reshape2)
> coef.long<-melt(coef,id.vars="Model")
>  
> library(ggplot2)
> ggplot(coef.long,aes(x=variable,y=value,fill=Model))+
>   geom_bar(stat="identity",position="dodge")+
>   scale_fill_discrete(name="Model",
>   labels=c("Multiple", "Simple"))+
>   labs(title =paste('La différences des coefficients
>   entre la régression multiple et simple'),
>   x="Models",y="Coefficient")+
>   coord_flip()
>  
>  
>  
> 
> __
> 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  Priv: pda...@gmail.com

__
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] MLE Estimation of Gamma Distribution Parameters for data with 'zeros'

2023-01-19 Thread peter dalgaard
Not necessarily homework, Bert. There's a generic issue with MLE and rounded 
data, in that gamma densities may be 0 at the boundary but small numbers are 
represented as 0, making the log-likelihood -Inf. 

The cleanest way out is to switch to a discretized distribution in the 
likelihood, so that instead of log(dgamma(0,...)) you use log(pgamma(.005,..) - 
pgamma(0,...)) == pgamma(.005,..., log=TRUE). (For data rounded to nearest .01, 
that is). Cruder techniques would be to just add, like, .0025 to all the zeros. 

-pd

> On 10 Jan 2023, at 18:42 , Bert Gunter  wrote:
> 
> Is this homework? This list has a no-homework policy.
> 
> 
> -- Bert
> 
> On Tue, Jan 10, 2023 at 8:13 AM Nyasha  wrote:
>> 
>> Please how can one go about this one? I don't know how to go about it.
>> 
>>[[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.

-- 
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-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] library(tseries) - spellng error in output

2022-12-15 Thread peter dalgaard
And normalTest is not in tseries, but in fBasics.

- pd

> On 15 Dec 2022, at 04:11 , Jeff Newmiller  wrote:
> 
> Contact the package maintainer. See maintainer().
> 
> On December 14, 2022 7:04:28 PM PST, roslinazairimah zakaria 
>  wrote:
>> Hi R-users,
>> 
>> Just to inform that there is one spelling error in the output for 
>> *Jarque-Bera
>> test in R.*
>> 
>> *library(tseries)*
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> *> #Jarque-Bera normality test> normalTest(dt_i, method='jb')Title: Jarque
>> - Bera Normalality TestTest Results:  STATISTIC:X-squared: 16.8853  P
>> VALUE:Asymptotic p Value: 0.0002155 *
>> 
> 
> -- 
> 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.

-- 
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-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] [Rd] R 4.2.2 is released

2022-10-31 Thread Peter Dalgaard via R-help
The build system rolled up R-4.2.2.tar.gz (codename "Innocent and Trusting") 
this morning.

The list below details the changes in this release. 

You can get the source code from

https://cran.r-project.org/src/base/R-4/R-4.2.2.tar.gz

or wait for it to be mirrored at a CRAN site nearer to you.

Binaries for various platforms will appear in due course.


For the R Core Team,

Peter Dalgaard


These are the checksums (md5 and SHA-256) for the freshly created files, in 
case you wish
to check that they are uncorrupted:

MD5 (AUTHORS) = 320967884b547734d6279dedbc739dd4
MD5 (COPYING) = eb723b61539feef013de476e68b5c50a
MD5 (COPYING.LIB) = a6f89e2100d9b6cdffcea4f398e37343
MD5 (FAQ) = 1ff069b3d34234bb6df71298380da3a8
MD5 (INSTALL) = 7893f754308ca31f1ccf62055090ad7b
MD5 (NEWS) = df3c0a29151cfbc40e6a07a5ad398de1
MD5 (NEWS.0) = bfcd7c147251b5474d96848c6f57e5a8
MD5 (NEWS.1) = eb78c4d053ec9c32b815cf0c2ebea801
MD5 (NEWS.2) = b38d94569700664205a76a7de836ba83
MD5 (NEWS.3) = e55ed2c8a547b827b46e08eb7137ba23
MD5 (R-latest.tar.gz) = b154500667b5ebb480f1086dd817f017
MD5 (README) = f468f281c919665e276a1b691decbbe6
MD5 (RESOURCES) = a79b9b338cab09bd665f6b62ac6f455b
MD5 (THANKS) = 45b6d2e88a6ecb5b24fa33a781351cd5
MD5 (VERSION-INFO.dcf) = 7c5057ff5958b2312a88556487fae295
MD5 (R-4/R-4.2.2.tar.gz) = b154500667b5ebb480f1086dd817f017

60a0d150e6fc1f424be76ad7b645d236b56e747692a4679f81ce6536c550e949  AUTHORS
e6d6a009505e345fe949e1310334fcb0747f28dae2856759de102ab66b722cb4  COPYING
6095e9ffa777dd22839f7801aa845b31c9ed07f3d6bf8a26dc5d2dec8ccc0ef3  COPYING.LIB
d8cfbd44efe3311bc2d4a71a0850c50aebc18a21affac951898a3b6b45dfe777  FAQ
f87461be6cbaecc4dce44ac58e5bd52364b0491ccdadaf846cb9b452e9550f31  INSTALL
f9700348b098129906da3489ce7299f86ded993aac2a8861349b1935652f8f6d  NEWS
4e21b62f515b749f80997063fceab626d7258c7d650e81a662ba8e0640f12f62  NEWS.0
12b30c724117b1b2b11484673906a6dcd48a361f69fc420b36194f9218692d01  NEWS.1
cde079b6beab7d700d3d4ecda494e2681ad3b7f8fab13b68be090f949393ec62  NEWS.2
1910a2405300b9bc7c76beeb0753a5249cf799afe175ce28f8d782fab723e012  NEWS.3
0ff62b42ec51afa5713caee7c4fde7a0c45940ba39bef8c5c9487fef0c953df5  
R-latest.tar.gz
2fdd3e90f23f32692d4b3a0c0452f2c219a10882033d1774f8cadf25886c3ddc  README
8b7d3856100220f4555d4d57140829f2e81c27eccec5b441f5dce616e9ec9061  RESOURCES
8319c5415de58ee10d4bc058d79c370fd8e6b2ad09e25d7a1e04b74ca5f380a6  THANKS
4bf8efc154e3f48800a9ddd1dd5bf333d3cf4f7e943876372699dab76e693318  
VERSION-INFO.dcf
0ff62b42ec51afa5713caee7c4fde7a0c45940ba39bef8c5c9487fef0c953df5  
R-4/R-4.2.2.tar.gz

This is the relevant part of the NEWS file

CHANGES IN R 4.2.2:

  NEW FEATURES:

* tools::Rdiff(useDiff = TRUE) checks for the presence of an
  external diff command and switches to useDiff = FALSE if none is
  found.  This allows R CMD Rdiff to always work.

* On Windows, environment variable R_LIBCURL_SSL_REVOKE_BEST_EFFORT
  can be used to switch to only 'best-effort' SSL certificate
  revocation checks with the default "libcurl" download method.
  This reduces security, but may be needed for downloads to work
  with MITM proxies (PR#18379).

* (macOS) The run-time check for libraries from XQuartz for X11 and
  Tcl/Tk no longer uses otool from the Apple Developer Tools
  (PR#18400).

* The LaTeX style for producing the PDF manuals, Rd.sty, now loads
  the standard amsmath, amsfonts and amssymb packages for greater
  coverage of math commands in the Rd \eqn and \deqn macros.  The
  \mathscr LaTeX command is also provided (via the mathrsfs
  package, if available, or the amsfonts bundle otherwise),
  fulfilling the wish of PR#18398.

* (Windows) The default format of readClipboard() and
  writeClipboard() has been changed to 13 (CF_UNICODETEXT).

  INSTALLATION on a UNIX-ALIKE:

* The PDF manuals (if built) can be compacted by the new target
  make compact-pdf (at the top level or in directory doc/manual).

* There is now configure support for LLVM clang 15 on Linux, which
  defaults to position-independent (PIE) executables whereas
  gfortran does not.

* Many small changes to ease compilation (and suppress warnings)
  with LLVM clang 15.

  BUG FIXES:

* Rscript -e would fail if stdin were closed (Reported by Henrik
  Bengtsson.)

* qt(*, log.p=TRUE) in outer tails no longer produces NaN in its
  final steps, thus fixing PR#18360.

* tools::Rd2latex() now escapes hashes and ampersands when writing
  URLs, fixing LaTeX errors with such URLs in \tabular.

* When isGeneric(f, fdef=*) is used with mismatching names, the
  warning is better understandable; reported (with fix) in PR#18370
  by Gabe Becker.

* poly(x, n) now works again (and is now documented) when x is a
  "Date" or "POSIXct" object, or of another class while fulfilling
  mode(x) == "numeric".  This also enables poly(x, *, raw=TRUE) for
 

Re: [R] How to convert category (or range/group) into continuous ?

2022-01-17 Thread peter dalgaard
Depends on what was meant. If you just want the interval midpoints for 
plotting, you can do something like

endp <- c(0,.01, .025, .05, ... 2.5) # some manual assembly required here
mid <- (head(endp, -1) + tail(endp, -1))/2
groupmid <- mid[group]
plot(groupmid, VALUE)

-pd

> On 17 Jan 2022, at 16:34 , Bert Gunter  wrote:
> 
> IMO, this is a bad idea. You are asking how to fabricate information that
> isn't there. You lost the information when you created the categories. Why
> can you not just go back to your original data?
> 
> 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 Sun, Jan 16, 2022 at 11:06 PM Marna Wagley 
> wrote:
> 
>> Hi R users,
>> I first categorized the continuous data into groups (ranges or category)
>> but now I would like to change the category into a continuous data and
>> plot it. For example I have attached the data in which you can see two
>> columns named "group" and "value". The group column contains a range
>> (group, for example ), I am wondering how I can change the category data
>> (for example: "0,0.01]" )into continuous data with a 0.1 interval.
>> Thank you for your suggestions.
>> 
>> daT<-structure(list(group = c("(0,0.01]", "(0.01,0.025]", "(0.025,0.05]",
>> "(0.05,0.075]", "(0.075,0.1]", "(0.1,0.2]", "(0.2,0.3]", "(0.3,0.4]",
>> "(0.4,0.5]", "(0.5,0.6]", "(0.6,0.7]", "(0.7,0.8]", "(0.8,0.9]",
>> "(0.9,1]", "(1,1.1]", "(1.1,1.5]", "(1.5,2]", "(2,2.5]"), VALUE = c(1,
>> 1, 1, 1, 1, 1, 0.9, 0.91667, 0.9, 0.85778,
>> 0.82667, 0.66, 0.439090909, 0.328636364, 0.273409091, 0.245795455,
>> 0.218181818, 0.084848485)), class = "data.frame", row.names = c(NA,
>> -18L))
>> thanks,
>> MW
>> 
>>[[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.

-- 
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-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] Date read correctly from CSV, then reformatted incorrectly by R

2021-11-23 Thread peter dalgaard
It reads other formats _if you specify them_. After all, no computer (or human) 
can tell whether 11/03/1959 is November 3 or March 11 without further hinting. 
So it tries the two ISO-like formats and leaves other cases for the user.

-pd

> On 20 Nov 2021, at 21:22 , Philip Monk  wrote:
> 
> Thanks, Andrew.  I didn't realise as.Date *only* read two formats, I
> think I was tripped up by using %y instead of %Y, 

-- 
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-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] [Rd] R 4.1.2 is released

2021-11-01 Thread Peter Dalgaard
The build system rolled up R-4.1.2.tar.gz (codename "Bird Hippie") this morning.

The list below details the changes in this release. 

You can get the source code from

https://cran.r-project.org/src/base/R-4/R-4.1.2.tar.gz

or wait for it to be mirrored at a CRAN site nearer to you.

Binaries for various platforms will appear in due course.


For the R Core Team,

Peter Dalgaard

These are the checksums (md5 and SHA-256) for the freshly created files, in 
case you wish
to check that they are uncorrupted:

MD5 (AUTHORS) = 320967884b547734d6279dedbc739dd4
MD5 (COPYING) = eb723b61539feef013de476e68b5c50a
MD5 (COPYING.LIB) = a6f89e2100d9b6cdffcea4f398e37343
MD5 (FAQ) = ade6a3d38fe5e6a456929cae2b94d568
MD5 (INSTALL) = 7893f754308ca31f1ccf62055090ad7b
MD5 (NEWS) = 924e68decbf327f538a09afb1838506b
MD5 (NEWS.0) = bfcd7c147251b5474d96848c6f57e5a8
MD5 (NEWS.1) = eb78c4d053ec9c32b815cf0c2ebea801
MD5 (NEWS.2) = a767f7809324c73c49eaff47d14bce81
MD5 (NEWS.3) = e55ed2c8a547b827b46e08eb7137ba23
MD5 (R-latest.tar.gz) = 6e28db9d02c6d3dae51a149b8e261ab1
MD5 (README) = f468f281c919665e276a1b691decbbe6
MD5 (RESOURCES) = a79b9b338cab09bd665f6b62ac6f455b
MD5 (THANKS) = 251d20510bfc3cc93b82c5a99f7efcc6
MD5 (VERSION-INFO.dcf) = a72a49578a254b9163f0f10322a3eecc
MD5 (R-4/R-4.1.2.tar.gz) = 6e28db9d02c6d3dae51a149b8e261ab1

60a0d150e6fc1f424be76ad7b645d236b56e747692a4679f81ce6536c550e949  AUTHORS
e6d6a009505e345fe949e1310334fcb0747f28dae2856759de102ab66b722cb4  COPYING
6095e9ffa777dd22839f7801aa845b31c9ed07f3d6bf8a26dc5d2dec8ccc0ef3  COPYING.LIB
e84c67931e9b925abb9142d4a6b4ef03b7605948bbf384d7e3d2401823c7f1fe  FAQ
f87461be6cbaecc4dce44ac58e5bd52364b0491ccdadaf846cb9b452e9550f31  INSTALL
73d5bfb8711bb7833ce8fe7a1359566d48001d13cd32affbd800d759f0b3232a  NEWS
4e21b62f515b749f80997063fceab626d7258c7d650e81a662ba8e0640f12f62  NEWS.0
12b30c724117b1b2b11484673906a6dcd48a361f69fc420b36194f9218692d01  NEWS.1
ba74618bc3f4c0e336dca13d472402a1863d12ba6f7f91a1782bc469ee986f6d  NEWS.2
1910a2405300b9bc7c76beeb0753a5249cf799afe175ce28f8d782fab723e012  NEWS.3
2036225e9f7207d4ce097e54972aecdaa8b40d7d9911cd26491fac5a0fab38af  
R-latest.tar.gz
2fdd3e90f23f32692d4b3a0c0452f2c219a10882033d1774f8cadf25886c3ddc  README
8b7d3856100220f4555d4d57140829f2e81c27eccec5b441f5dce616e9ec9061  RESOURCES
c9c7cb32308b4e560a22c858819ade9de524a602abd4e92d1c328c89f8037d73  THANKS
1e74ef089b526538bbb658dc189bc3d34d931839e9933415fb2f267fd57b0b69  
VERSION-INFO.dcf
2036225e9f7207d4ce097e54972aecdaa8b40d7d9911cd26491fac5a0fab38af  
R-4/R-4.1.2.tar.gz

This is the relevant part of the NEWS file

CHANGES IN R 4.1.2:

  C-LEVEL FACILITIES:

* The workaround in headers R.h and Rmath.h (using namespace std;)
  for the Oracle Developer Studio compiler is no longer needed now
  C++11 is required so has been removed.  A couple more usages of
  log() (which should have been std::log()) with an int argument
  are reported on Solaris.

* The undocumented limit of 4095 bytes on messages from the
  S-compatibility macros PROBLEM and MESSAGE is now documented and
  longer messages will be silently truncated rather than
  potentially causing segfaults.

* If the R_NO_SEGV_HANDLER environment variable is non-empty, the
  signal handler for SEGV/ILL/BUS signals (which offers recovery
  user interface) is not set. This allows more reliable debugging
  of crashes that involve the console.

  DEPRECATED AND DEFUNCT:

* The legacy S-compatibility macros PROBLEM, MESSAGE, ERROR, WARN,
  WARNING, RECOVER, ... are deprecated and will be hidden in R
  4.2.0. R's native interface of Rf_error and Rf_warning has long
  been preferred.

  BUG FIXES:

* .mapply(F, dots, .) no longer segfaults when dots is not a list
  and uses match.fun(F) as always documented; reported by Andrew
  Simmons in PR#18164.

* hist(, ...) and hist(, ...)  no longer pass
  arguments for rect() (such as col and density) to axis().
  (Thanks to Sebastian Meyer's PR#18171.)

* \Sexpr{ch} now preserves Encoding(ch). (Thanks to report and
  patch by Jeroen Ooms in PR#18152.)

* Setting the RNG to "Marsaglia-Multicarry" e.g., by RNGkind(), now
  warns in more places, thanks to Andr'e Gillibert's report and
  patch in PR#18168.

* gray(numeric(), alpha=1/2) no longer segfaults, fixing PR#18183,
  reported by Till Krenz.

* Fixed dnbinom(x, size=, .., log=TRUE) regression,
  reported by Martin Morgan.

* as.Date.POSIXlt(x) now keeps names(x), thanks to Davis Vaughan's
  report and patch in PR#18188.

* model.response() now strips an "AsIs" class typically, thanks to
  Duncan Murdoch's report and other discussants in PR#18190.

* try() is considerably faster in case of an error and long call,
  as e.g., from some do.call().  Thanks to Alexander Kaever's
  suggestion posted to R-devel.

* qqline(y = ) such as y=I(.

Re: [R] [Rd] R 4.1.2 scheduled for November 1

2021-10-03 Thread peter dalgaard
Schedule should appear on developer.r-project.org when it gets updated from SVN.

> On 3 Oct 2021, at 18:40 , peter dalgaard  wrote:
> 
> (Just a quick heads-up for developers.)
> 
> Full schedule to be made available soon.
> 

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


[R] [Rd] R 4.1.2 scheduled for November 1

2021-10-03 Thread peter dalgaard
(Just a quick heads-up for developers.)
 
Full schedule to be made available soon.

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


Re: [R] How to globally convert NaN to NA in dataframe?

2021-09-03 Thread peter dalgaard
r the global modification at once of all
>>>>> instances?
>>>>> I have seen from
>>>>> https://stackoverflow.com/questions/18142117/how-to-replace-nan-
>>> value
>>>>> -with-zero-in-a-huge-data-frame/18143097#18143097
>>>>> that once could use:
>>>>> ```
>>>>> 
>>>>> is.nan.data.frame <- function(x)
>>>>> do.call(cbind, lapply(x, is.nan))
>>>>> 
>>>>> data123[is.nan(data123)] <- 0
>>>>> ```
>>>>> replacing o with NA, but I got
>>>>> ```
>>>>> str(df)
>>>>>> logi NA
>>>>> ```
>>>>> when modifying my dataframe df.
>>>>> What would be the correct syntax?
>>>>> Thank you
>>>>> 
>>>>> 
>>>>> 
>>>>> --
>>>>> Best regards,
>>>>> Luigi
>>>>> 
>>>>> __
>>>>> 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.
>>> 
>>> 
>>> 
>>> --
>>> Best regards,
>>> Luigi
>>> 
>>> __
>>> 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.
> 
> 
> 
> -- 
> Best regards,
> Luigi
> 
> __
> 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  Priv: pda...@gmail.com

__
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] [Rd] R 4.1.1 is released

2021-08-10 Thread Peter Dalgaard
The build system rolled up R-4.1.1.tar.gz (codename "Kick Things") this morning.

The list below details the changes in this release. 

You can get the source code from

https://cran.r-project.org/src/base/R-4/R-4.1.1.tar.gz

or wait for it to be mirrored at a CRAN site nearer to you.

Binaries for various platforms will appear in due course.


For the R Core Team,

Peter Dalgaard

These are the checksums (md5 and SHA-256) for the freshly created files, in 
case you wish
to check that they are uncorrupted:

MD5 (AUTHORS) = da5e7c699a83608d0f1e39c458d9fc56
MD5 (COPYING) = eb723b61539feef013de476e68b5c50a
MD5 (COPYING.LIB) = a6f89e2100d9b6cdffcea4f398e37343
MD5 (FAQ) = 6094024214a482c0d01d2ab2adca4b3f
MD5 (INSTALL) = 7893f754308ca31f1ccf62055090ad7b
MD5 (NEWS) = fbc4810ff26ebcec514ebaa1c1909ad7
MD5 (NEWS.0) = bfcd7c147251b5474d96848c6f57e5a8
MD5 (NEWS.1) = eb78c4d053ec9c32b815cf0c2ebea801
MD5 (NEWS.2) = a767f7809324c73c49eaff47d14bce81
MD5 (NEWS.3) = e55ed2c8a547b827b46e08eb7137ba23
MD5 (R-latest.tar.gz) = c278cfeb85b1564540ab214e45fe68d9
MD5 (README) = f468f281c919665e276a1b691decbbe6
MD5 (RESOURCES) = a79b9b338cab09bd665f6b62ac6f455b
MD5 (THANKS) = 251d20510bfc3cc93b82c5a99f7efcc6
MD5 (VERSION-INFO.dcf) = 34443dff7fcea700c8ec4740e5804374
MD5 (R-4/R-4.1.1.tar.gz) = c278cfeb85b1564540ab214e45fe68d9

9704a7d96c350a48417ef215888a29f1993ee5dec1b73cb95755e8625b860200  AUTHORS
e6d6a009505e345fe949e1310334fcb0747f28dae2856759de102ab66b722cb4  COPYING
6095e9ffa777dd22839f7801aa845b31c9ed07f3d6bf8a26dc5d2dec8ccc0ef3  COPYING.LIB
2894e7a88634a08c05bfafb8a694a26b635e4042160aab46fa6a0f4eb68ea91e  FAQ
f87461be6cbaecc4dce44ac58e5bd52364b0491ccdadaf846cb9b452e9550f31  INSTALL
e8bdaf546cf65fdc5bf2a81fa5334572886ff2f1317ec6cdc9e61d6de3532dd4  NEWS
4e21b62f515b749f80997063fceab626d7258c7d650e81a662ba8e0640f12f62  NEWS.0
12b30c724117b1b2b11484673906a6dcd48a361f69fc420b36194f9218692d01  NEWS.1
ba74618bc3f4c0e336dca13d472402a1863d12ba6f7f91a1782bc469ee986f6d  NEWS.2
1910a2405300b9bc7c76beeb0753a5249cf799afe175ce28f8d782fab723e012  NEWS.3
515e03265752257d0b7036f380f82e42b46ed8473f54f25c7b67ed25bbbdd364  
R-latest.tar.gz
2fdd3e90f23f32692d4b3a0c0452f2c219a10882033d1774f8cadf25886c3ddc  README
8b7d3856100220f4555d4d57140829f2e81c27eccec5b441f5dce616e9ec9061  RESOURCES
c9c7cb32308b4e560a22c858819ade9de524a602abd4e92d1c328c89f8037d73  THANKS
02686ea05e64304a755bf776cdeeadafd2c5017a13f9203f1db9278287c81aa6  
VERSION-INFO.dcf
515e03265752257d0b7036f380f82e42b46ed8473f54f25c7b67ed25bbbdd364  
R-4/R-4.1.1.tar.gz

This is the relevant part of the NEWS file

CHANGES IN R 4.1.1:

  NEW FEATURES:

* require(pkg, quietly = TRUE) is quieter and in particular does
  not warn if the package is not found.

  DEPRECATED AND DEFUNCT:

* Use of ftp:// URIs should be regarded as deprecated, with
  on-going support confined to method = "libcurl" and not routinely
  tested.  (Nowadays no major browser supports them.)

* The non-default method = "internal" is deprecated for http:// and
  ftp:// URIs for both download.file and url.

* On Windows, method = "wininet" is deprecated for http://,
  https:// and ftp:// URIs for both download.file and url.  (A
  warning is only given for ftp://.)

  For ftp:// URIs the default method is now "libcurl" if available
  (which it is on CRAN builds).

  method = "wininet" remains the default for http:// and https://
  URIs but if libcurl is available, using method = "libcurl" is
  preferred.

  INSTALLATION:

* make check now works also without a LaTeX installation.  (Thanks
  to Sebastian Meyer's PR#18103.)

  BUG FIXES:

* make check-devel works again in an R build configured with
  --without-recommended-packages.

* qnbinom(p, size, mu) for large size/mu is correct now in a range
  of cases (PR#18095); similarly for the (size, prob)
  parametrization of the negative binomial.  Also qpois() and
  qbinom() are better and or faster for extreme cases.  The
  underlying C code has been modularized and is common to all four
  cases of discrete distributions.

* gap.axis is now part of the axis() arguments which are passed
  from bxp(), and hence boxplot().  (Thanks to Martin Smith's
  report and suggestions in PR#18109.)

* .First and .Last can again be set from the site profile.

* seq.int(from, to, *) and seq.default(..) now work better in large
  range cases where from-to is infinite where the two boundaries
  are finite.

* all.equal(x,y) now returns TRUE correctly also when several
  entries of abs(x) and abs(y) are close to .Machine$double.xmax,
  the largest finite numeric.

* model.frame() now clears the object bit when removing the class
  attribute of a value via na.action (PR#18100).

* charClass() now works with multi-character strings on Windows
  (PR#18104, fixed by Bill 

[R] [Rd] R 4.1.1 scheduled for August 10

2021-07-10 Thread Peter Dalgaard via R-help
Full schedule is available on developer.r-project.org.

(This comes somewhat late this year, partly because we needed to squeeze in 
4.0.5 before 4.1.0 could be released.)

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


Re: [R] checksums for R src file

2021-06-24 Thread peter dalgaard
Yes, these are in the release announcements. They are deliberately not kept 
with the actual files due to security considerations. The easiest source is

https://stat.ethz.ch/pipermail/r-announce/2021/date.html

(because that mailing list doesn't contain much other than release 
announcements).

- Peter D.

> On 24 Jun 2021, at 17:47 , kap4lin  wrote:
> 
> When I download the file,
> https://cran.r-project.org/src/base/R-4/R-4.1.0.tar.gz (or anything
> similar) is there a checksum for the file I can compare it to?
> 
> Thanks
> PK
> 
>   [[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.

-- 
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-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] [Rd] R 4.1.0 is released

2021-05-20 Thread Peter Dalgaard


The build system rolled up R-4.1.0.tar.gz (codename "Camp Pontanezen") this 
morning.

This is a major update, notably containing the new native pipe operator "|>" 
and 
shorthand inline functions "\(x) x+1".

The list below details the changes in this release. 

You can get the source code from

https://cran.r-project.org/src/base/R-4/R-4.1.0.tar.gz

or wait for it to be mirrored at a CRAN site nearer to you.

Binaries for various platforms will appear in due course.


For the R Core Team,

Peter Dalgaard


These are the checksums (md5 and SHA-256) for the freshly created files, in 
case you wish
to check that they are uncorrupted:

MD5 (AUTHORS) = b9c44f9f78cab3184ad9898bebc854b4
MD5 (COPYING) = eb723b61539feef013de476e68b5c50a
MD5 (COPYING.LIB) = a6f89e2100d9b6cdffcea4f398e37343
MD5 (FAQ) = 639fbbba9998cae70ef058be42b80a52
MD5 (INSTALL) = 7893f754308ca31f1ccf62055090ad7b
MD5 (NEWS) = b02805558a8315f1a93c7f7d7cd879c1
MD5 (NEWS.0) = bfcd7c147251b5474d96848c6f57e5a8
MD5 (NEWS.1) = eb78c4d053ec9c32b815cf0c2ebea801
MD5 (NEWS.2) = a767f7809324c73c49eaff47d14bce81
MD5 (NEWS.3) = e55ed2c8a547b827b46e08eb7137ba23
MD5 (R-latest.tar.gz) = bd80f97d0e46a71408f5bc25652a0203
MD5 (README) = f468f281c919665e276a1b691decbbe6
MD5 (RESOURCES) = 529223fd3ffef95731d0a87353108435
MD5 (THANKS) = 251d20510bfc3cc93b82c5a99f7efcc6
MD5 (VERSION-INFO.dcf) = 1f3cf39735afb48fea434bca2b7bf483
MD5 (R-4/R-4.1.0.tar.gz) = bd80f97d0e46a71408f5bc25652a0203

2cde824a7b18958e5f06b391c801c8288be0f84fa8934b7ddefef23c67e60c09  AUTHORS
e6d6a009505e345fe949e1310334fcb0747f28dae2856759de102ab66b722cb4  COPYING
6095e9ffa777dd22839f7801aa845b31c9ed07f3d6bf8a26dc5d2dec8ccc0ef3  COPYING.LIB
0dce85f38b9d6351a1b63f057dfbc7f572966245add12946482e57e60d41547c  FAQ
f87461be6cbaecc4dce44ac58e5bd52364b0491ccdadaf846cb9b452e9550f31  INSTALL
20e7185fb5af0f2ac825b27c16afd57ff206726117c6ac5cf7c6f230337af093  NEWS
4e21b62f515b749f80997063fceab626d7258c7d650e81a662ba8e0640f12f62  NEWS.0
12b30c724117b1b2b11484673906a6dcd48a361f69fc420b36194f9218692d01  NEWS.1
ba74618bc3f4c0e336dca13d472402a1863d12ba6f7f91a1782bc469ee986f6d  NEWS.2
1910a2405300b9bc7c76beeb0753a5249cf799afe175ce28f8d782fab723e012  NEWS.3
e8e68959d7282ca147360fc9644ada9bd161bab781bab14d33b8999a95182781  
R-latest.tar.gz
2fdd3e90f23f32692d4b3a0c0452f2c219a10882033d1774f8cadf25886c3ddc  README
408737572ecc6e1135fdb2cf7a9dbb1a6cb27967c757f1771b8c39d1fd2f1ab9  RESOURCES
c9c7cb32308b4e560a22c858819ade9de524a602abd4e92d1c328c89f8037d73  THANKS
2f834a058dcfcdfb7eedf45aa0d897ea1a7c43a9460ffd22f73b60919cb1bf57  
VERSION-INFO.dcf
e8e68959d7282ca147360fc9644ada9bd161bab781bab14d33b8999a95182781  
R-4/R-4.1.0.tar.gz

This is the relevant part of the NEWS file

CHANGES IN R 4.1.0:

  FUTURE DIRECTIONS:

* It is planned that the 4.1.x series will be the last to support
  32-bit Windows, with production of binary packages for that
  series continuing until early 2023.

  SIGNIFICANT USER-VISIBLE CHANGES:

* Data set esoph in package datasets now provides the correct
  numbers of controls; previously it had the numbers of cases added
  to these.  (Reported by Alexander Fowler in PR#17964.)

  NEW FEATURES:

* www.omegahat.net is no longer one of the repositories known by
  default to setRepositories().  (Nowadays it only provides source
  packages and is often unavailable.)

* Function package_dependencies() (in package tools) can now use
  different dependency types for direct and recursive dependencies.

* The checking of the size of tarball in R CMD check --as-cran
   may be tweaked via the new environment variable
  _R_CHECK_CRAN_INCOMING_TARBALL_THRESHOLD_, as suggested in
  PR#1 by Jan Gorecki.

* Using c() to combine a factor with other factors now gives a
  factor, an ordered factor when combining ordered factors with
  identical levels.

* apply() gains a simplify argument to allow disabling of
  simplification of results.

* The format() method for class "ftable" gets a new option justify.
  (Suggested by Thomas Soeiro.)

* New ...names() utility.  (Proposed by Neal Fultz in PR#17705.)

* type.convert() now warns when its as.is argument is not
  specified, as the help file always said it _should_.  In that
  case, the default is changed to TRUE in line with its change in
  read.table() (related to stringsAsFactor) in R 4.0.0.

* When printing list arrays, classed objects are now shown _via_
  their format() value if this is a short enough character string,
  or by giving the first elements of their class vector and their
  length.

* capabilities() gets new entry "Rprof" which is TRUE when R has
  been configured with the equivalent of --enable-R-profiling (as
  it is by default).  (Related to Michael Orlitzky's report
  PR#17836.)

* str(xS4) now also shows extraneous attributes of an S4 object
  

[R] [Rd] R 4.1.0 scheduled for May 18

2021-04-16 Thread Peter Dalgaard via R-help
Full schedule is available on developer.r-project.org.

-- 
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-de...@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

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


[R] [Rd] R 4.0.5 is released

2021-03-31 Thread Peter Dalgaard
The build system rolled up R-4.0.5.tar.gz (codename "Shake and Throw") this 
morning.

This is a very minor update, mostly to fix the annoyance with East Asian 
character sets.

The list below details the changes in this release. 

You can get the source code from

https://cran.r-project.org/src/base/R-4/R-4.0.5.tar.gz

or wait for it to be mirrored at a CRAN site nearer to you.

Binaries for various platforms will appear in due course.


For the R Core Team,

Peter Dalgaard

These are the checksums (md5 and SHA-256) for the freshly created files, in 
case you wish
to check that they are uncorrupted:

MD5 (AUTHORS) = b9c44f9f78cab3184ad9898bebc854b4
MD5 (COPYING) = eb723b61539feef013de476e68b5c50a
MD5 (COPYING.LIB) = a6f89e2100d9b6cdffcea4f398e37343
MD5 (FAQ) = 639fbbba9998cae70ef058be42b80a52
MD5 (INSTALL) = 7893f754308ca31f1ccf62055090ad7b
MD5 (NEWS) = 553381d79675220a90cf9b264997e458
MD5 (NEWS.0) = bfcd7c147251b5474d96848c6f57e5a8
MD5 (NEWS.1) = eb78c4d053ec9c32b815cf0c2ebea801
MD5 (NEWS.2) = 496062c138e2def06cebccddfb814ac6
MD5 (NEWS.3) = 012e7f4a80cc8ec947bf3f0ff6117ec8
MD5 (R-latest.tar.gz) = eb8fb47cc91ff287005c1633ef8599e6
MD5 (README) = f468f281c919665e276a1b691decbbe6
MD5 (RESOURCES) = 529223fd3ffef95731d0a87353108435
MD5 (THANKS) = 251d20510bfc3cc93b82c5a99f7efcc6
MD5 (VERSION-INFO.dcf) = 62b1389bc9fed2bf5857c0c99ef490f2
MD5 (R-4/R-4.0.5.tar.gz) = eb8fb47cc91ff287005c1633ef8599e6


2cde824a7b18958e5f06b391c801c8288be0f84fa8934b7ddefef23c67e60c09  AUTHORS
e6d6a009505e345fe949e1310334fcb0747f28dae2856759de102ab66b722cb4  COPYING
6095e9ffa777dd22839f7801aa845b31c9ed07f3d6bf8a26dc5d2dec8ccc0ef3  COPYING.LIB
0dce85f38b9d6351a1b63f057dfbc7f572966245add12946482e57e60d41547c  FAQ
f87461be6cbaecc4dce44ac58e5bd52364b0491ccdadaf846cb9b452e9550f31  INSTALL
bbee124ddbd6682ecbaa5193d5ffc35aa090fcf29b30a9ad6f1498074a720388  NEWS
4e21b62f515b749f80997063fceab626d7258c7d650e81a662ba8e0640f12f62  NEWS.0
12b30c724117b1b2b11484673906a6dcd48a361f69fc420b36194f9218692d01  NEWS.1
e80de410c77f05ff2012fa70051b89119845f734a7fa5c55857e61e4ed7d5f6e  NEWS.2
7201d139947afa52b5e09d26dc01445edf444506264355b2185122bc1ed3dce0  NEWS.3
0a3ee079aa772e131fe5435311ab627fcbccb5a50cabc54292e6f62046f1ffef  
R-latest.tar.gz
2fdd3e90f23f32692d4b3a0c0452f2c219a10882033d1774f8cadf25886c3ddc  README
408737572ecc6e1135fdb2cf7a9dbb1a6cb27967c757f1771b8c39d1fd2f1ab9  RESOURCES
c9c7cb32308b4e560a22c858819ade9de524a602abd4e92d1c328c89f8037d73  THANKS
6f7663cb7813af1228978d9ef356fb6e6dad131fab9bbed507b657b48e2df6bd  
VERSION-INFO.dcf
0a3ee079aa772e131fe5435311ab627fcbccb5a50cabc54292e6f62046f1ffef  
R-4/R-4.0.5.tar.gz

This is the relevant part of the NEWS file

CHANGES IN R 4.0.5:

  BUG FIXES:

* The change to the internal table in R 4.0.4 for iswprint has been
  reverted: it contained some errors in printability of 'East
  Asian' characters.

* For packages using LazyData, R CMD build ignored the
  --resave-data option and the BuildResaveData field of the
  DESCRIPTION file (in R versions 4.0.0 to 4.0.4).

-- 
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-de...@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

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


[R] [Rd] R 4.0.5 scheduled for March 31

2021-03-22 Thread Peter Dalgaard via R-help
Full schedule is available on https://developer.r-project.org (or 
https://svn.r-project.org/R-dev-web/trunk/index.html for the impatient).

(This is a fast-track release, to resolve an issue with Asian character sets 
and another issue with R CMD build, before R 4.1.0)

-- 
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-de...@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

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


[R] [Rd] R 4.0.4 is released

2021-02-15 Thread Peter Dalgaard
The build system rolled up R-4.0.4.tar.gz (codename "Lost Library Book") this 
morning.

The list below details the changes in this release.

You can get the source code from

https://cran.r-project.org/src/base/R-4/R-4.0.4.tar.gz

or wait for it to be mirrored at a CRAN site nearer to you.

Binaries for various platforms will appear in due course.


For the R Core Team,

Peter Dalgaard

These are the checksums (md5 and SHA-256) for the freshly created files, in 
case you wish
to check that they are uncorrupted:

MD5 (AUTHORS) = b9c44f9f78cab3184ad9898bebc854b4
MD5 (COPYING) = eb723b61539feef013de476e68b5c50a
MD5 (COPYING.LIB) = a6f89e2100d9b6cdffcea4f398e37343
MD5 (FAQ) = a5596520508b8749aa18baea2cf8ff80
MD5 (INSTALL) = 7893f754308ca31f1ccf62055090ad7b
MD5 (NEWS) = eeb2d15f39e0a38935de2c419b4263f7
MD5 (NEWS.0) = bfcd7c147251b5474d96848c6f57e5a8
MD5 (NEWS.1) = eb78c4d053ec9c32b815cf0c2ebea801
MD5 (NEWS.2) = 496062c138e2def06cebccddfb814ac6
MD5 (NEWS.3) = 012e7f4a80cc8ec947bf3f0ff6117ec8
MD5 (R-latest.tar.gz) = e205f000947f99eeba0fb6311bd61970
MD5 (README) = f468f281c919665e276a1b691decbbe6
MD5 (RESOURCES) = 529223fd3ffef95731d0a87353108435
MD5 (THANKS) = 251d20510bfc3cc93b82c5a99f7efcc6
MD5 (VERSION-INFO.dcf) = 6a5ad95f3b708ce0dc19bab8bbfc3bc0
MD5 (R-4/R-4.0.4.tar.gz) = e205f000947f99eeba0fb6311bd61970


2cde824a7b18958e5f06b391c801c8288be0f84fa8934b7ddefef23c67e60c09  AUTHORS
e6d6a009505e345fe949e1310334fcb0747f28dae2856759de102ab66b722cb4  COPYING
6095e9ffa777dd22839f7801aa845b31c9ed07f3d6bf8a26dc5d2dec8ccc0ef3  COPYING.LIB
e9783551b3724b368a42c1300a8e5795ae84add34823c4eb9d8054a0e76f592c  FAQ
f87461be6cbaecc4dce44ac58e5bd52364b0491ccdadaf846cb9b452e9550f31  INSTALL
2227d48d78c4d70d07c367ecd4c5ba60a04a699ed0391fabac3da6edffdaa5db  NEWS
4e21b62f515b749f80997063fceab626d7258c7d650e81a662ba8e0640f12f62  NEWS.0
12b30c724117b1b2b11484673906a6dcd48a361f69fc420b36194f9218692d01  NEWS.1
e80de410c77f05ff2012fa70051b89119845f734a7fa5c55857e61e4ed7d5f6e  NEWS.2
7201d139947afa52b5e09d26dc01445edf444506264355b2185122bc1ed3dce0  NEWS.3
523f27d69744a08c8f0bd5e1e6c3d89a4db29ed983388ba70963a3cd3a4a802e  
R-latest.tar.gz
2fdd3e90f23f32692d4b3a0c0452f2c219a10882033d1774f8cadf25886c3ddc  README
408737572ecc6e1135fdb2cf7a9dbb1a6cb27967c757f1771b8c39d1fd2f1ab9  RESOURCES
c9c7cb32308b4e560a22c858819ade9de524a602abd4e92d1c328c89f8037d73  THANKS
6c5117e36f4e69f0cd90f3bab6e7fd47ec90b0047e2aaed145300ad4ece20ede  
VERSION-INFO.dcf
523f27d69744a08c8f0bd5e1e6c3d89a4db29ed983388ba70963a3cd3a4a802e  
R-4/R-4.0.4.tar.gz

This is the relevant part of the NEWS file

CHANGES IN R 4.0.4:

  NEW FEATURES:

* File share/texmf/tex/latex/jss.cls has been updated to work with
  LaTeX versions since Oct 2020.

* Unicode character width tables (as used by nchar(, type = "w"))
  have been updated to Unicode 12.1 by Brodie Gaslam (PR#17781),
  including many emoji.

* The internal table for iswprint (used on Windows, macOS and AIX)
  has been updated to include many recent Unicode characters.

  INSTALLATION on a UNIX-ALIKE:

* If an external BLAS is specified by --with-blas=foo or _via_
  environment variable BLAS_LIBS is not found, this is now a
  configuration error.  The previous behaviour was not clear from
  the documentation: it was to continue the search as if
  --with-blas=yes was specified.

  BUG FIXES:

* all.equal(x,y) now "sees" the two different NAs in factors,
  thanks to Bill Dunlap and others in PR#17897.

* (~ NULL)[1] and similar formula subsetting now works, thanks to a
  report and patch by Henrik Bengtsson in PR#17935.  Additionally,
  subsetting leaving an empty formula now works too, thanks to
  suggestions by Suharto Anggono.

* .traceback(n) keeps source references again, as before R 4.0.0,
  fixing a regression; introduced by the PR#17580, reported
  including two patch proposals by Brodie Gaslam.

* unlist(plst, recursive=FALSE) no longer drops content for
  pairlists with list components, thanks to the report and patch by
  Suharto Anggono in PR#17950.

* iconvlist() now also works on MUSL based (Linux) systems, from a
  report and patch suggestion by Wesley Chan in PR#17970.

* round() and signif() no longer tolerate wrong argument names,
  notably in 1-argument calls; reported by Shane Mueller on R-devel
  (mailing list); later reported as PR#17976.

* .Machine has longdouble.* elements only if
  capabilities("long.double") is true, as documented.  (Previously
  they were included if the platform had long double identical to
  double, as ARM does.)

* p.adjust(numeric(), n=0) now works, fixing PR#18002.

* identical(x,y) no longer prints "Unknown Type .." for typeof(x)
  == "..." objects.

* Fix (auto-)print()ing of named complex vectors, see PR#17868 and
  PR#18019.

* all.equal(, <...>) now works,

[R] [Rd] R 4.0.4 scheduled for February 15

2021-01-21 Thread Peter Dalgaard via R-help
Full schedule is available on https://developer.r-project.org (or 
https://svn.r-project.org/R-dev-web/trunk/index.html for the impatient).

-- 
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-de...@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

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


Re: [R] Converting "day of year" to "year", "month" and "day"

2021-01-16 Thread peter dalgaard
04.
> 1998  70  0  530.
> 1998  71  0  525.
> 1998  72  0  484.
> 1998  73  0  430.
> 1998  74  0  388.
> 1998  75  0  347.
> 1998  76  0  337.
> 1998  77  0  342.
> 1998  78  0  305.
> 1998  79  0  329.
> 1998  80  0  420.
> 1998  81  0  564.
> 1998  82  0  483.
> 1998  83  0  385.
> 1998  84  0  393.
> 1998  85  0  437.
> 1998  86  0  441.
> 1998  87  0  434.
> 1998  88  0  471.
> 1998  89  0  429.
> 1998  90  0  412.
> 1998  91  0  370.
> 1998  92  0  326.
> 1998  93  0  357.
> 1998  94  0  338.
> 1998  95  0  380.
> 1998  96  0  339.
> 1998  97  0  312.
> 1998  98  0  313.
> 1998  99  0  327.
> 1998 100  0  362.
> 1998 101  0  358.
> 1998 102  0  387.
> 1998 103  0  397.
> 1998 104  0  375.
> 1998 105  0  350.
> 1998 106  0  357.
> 1998 107  0  472.
> 1998 108  0  526.
> 1998 109  0  396.
> 1998 110  0  374.
> 1998 111  0  376.
> 1998 112  0  355.
> 1998 113  0  343.
> 1998 114  0  425.
> 1998 115  0  426.
> 1998 116  0  479.
> 1998 117  0  469.
> 1998 118  0  425.
> 1998 119  0  344.
> 1998 120  0  341.
> 1998 121  0  426.
> 1998 122  0  601.
> 1998 123  0  476.
> 1998 124  0  670.
> 1998 125  0  585.
> 1998 126  0  496.
> 1998 127  0  479.
> 1998 128  0  569.
> 1998 129  0  531.
> 1998 130  0  489.
> 1998 131  0  484.
> 1998 132  0  480.
> 1998 133  0  393.
> 1998 134  0  332.
> 1998 135  0  327.
> 1998 136  0  493.
> 1998 137  0  493.
> 1998 138  0  430.
> 1998 139  0  396.
> 1998 140  0  408.
> 1998 141  0  416.
> 1998 142  0  376.
> 1998 143  0  375.
> 1998 144  0  415.
> 1998 145  0  407.
> 1998 146  0  398.
> 1998 147  0  352.
> 1998 148  0  349.
> 1998 149  0  517.
> 1998 150  0  597.
> 1998 151  0  480.
> 1998 152  0  435.
> 1998 153  0  408.
> 1998 154  0  441.
> 1998 155  0  397.
> 1998 156  0  374.
> 1998 157  0  413.
> 1998 158  0  582.
> 1998 159  0  513.
> 1998 160  0  459.
> 1998 161  0  466.
> 1998 162  0  414.
> 1998 163  0  354.
> 1998 164  0  341.
> 1998 165  0  343.
> 1998 166  0  369.
> 1998 167  0  411.
> 1998 168  0  355.
> Thanks
> Jibrin
> 
> On Fri, Jan 15, 2021 at 7:15 PM Rui Barradas  wrote:
> 
>> Hello,
>> 
>> No dataset was attached. Like the posting guide says,
>> 
>> No binary attachments except for PS, PDF, and some image and archive
>> formats (others are automatically stripped off because they can contain
>> malicious software). Files in other formats and larger ones should
>> rather be put on the web and have only their URLs posted. This way a
>> reader has the option to download them or not.
>> 
>> 
>> Can you post sample data? Please post the output of `dput(df)`. Or, if
>> it is too big the output of `dput(head(df, 20))`. (`df` is the name of
>> your dataset.)
>> 
>> Hope this helps,
>> 
>> Rui Barradas
>> 
>> Às 11:30 de 15/01/21, Jibrin Alhassan escreveu:
>>> Dear R users,
>>> I am very new to R software. I have solar wind speed data needed for my
>>> work. How do I convert day in the year to year, month, and day with R
>>> software? I have used this code
>>> as.Date(0, origin = "1998-01-01")
>>> but it can only convert one day of the year at a time. Meanwhile, I have
>> up
>>> to the 1998-2002 data set. Attached is my data.
>>> Kindly help, please.
>>> Jibrin Alhassan
>>> __
>>> 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.

-- 
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-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] newdata for predict.lm() ??

2020-11-04 Thread peter dalgaard
Don't use $ notation in lm() formulas. Use lm(w ~ h, data=DAT).

-pd

> On 4 Nov 2020, at 10:50 , Boris Steipe  wrote:
> 
> Can't get data from a data frame into predict() without a detour that seems 
> quite unnecessary ...
> 
> Reprex:
> 
> # Data frame with simulated data in columns "h" (independent) and "w" 
> (dependent)
> DAT <- structure(list(h = c(2.174, 2.092, 2.059, 1.952, 2.216, 2.118, 
>1.755, 2.060, 2.136, 2.126, 1.792, 1.574,
>2.117, 1.741, 2.295, 1.526, 1.666, 1.581,
>1.522, 1.995), 
>  w = c(90.552, 89.518, 84.124, 94.685, 94.710, 82.429,
>87.176, 90.318, 76.873, 84.183, 57.890, 62.005,
>84.258, 78.317,101.304, 64.982, 71.237, 77.124,
>65.010, 81.413)),
> row.names = c( "1",  "2",  "3",  "4",  "5",  "6",  "7", 
>"8",  "9", "10", "11", "12", "13", "14",
>   "15", "16", "17", "18", "19", "20"),
> class = "data.frame")
> 
> 
> myFit <- lm(DAT$w ~ DAT$h)
> coef(myFit)
> 
> # (Intercept)   DAT$h 
> #   11.7647535.92002 
> 
> 
> # Create 50 x-values with seq() to plot confidence intervals
> myNew <- data.frame(seq(min(DAT$h), max(DAT$h), length.out = 50))
> 
> pc <- predict(myFit, newdata = myNew, interval = "confidence")
> 
> # Warning message:
> # 'newdata' had 50 rows but variables found have 20 rows 
> 
> # Problem: predict() was not able to take the single column in myNew
> # as the independent variable.
> 
> # Ugly workaround: but with that everything works as expected.
> xx <- DAT$h
> yy <- DAT$w
> myFit <- lm(yy ~ xx)
> coef(myFit)
> 
> myNew <- data.frame(seq(min(DAT$h), max(DAT$h), length.out = 50))
> colnames(myNew) <- "xx"  # This fixes it!
> 
> pc <- predict(myFit, newdata = myNew, interval = "confidence")
> str(pc)
> 
> # So: specifying the column in newdata to have same name as the coefficient
> # name should work, right?
> # Back to the original ...
> 
> myFit <- lm(DAT$w ~ DAT$h)
> colnames(myNew) <- "`DAT$h`"
> # ... same error
> 
> colnames(myNew) <- "h"
> # ... same error again.
> 
> Bottom line: how can I properly specify newdata? The documentation is opaque. 
> It seems the algorithm is trying to EXACTLY match the text of the RHS of the 
> formula, which is unlikely to result in a useful column name, unless I assign 
> to an intermediate variable. There must be a better way ...
> 
> 
> 
> Thanks!
> Boris
> 
> __
> 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  Priv: pda...@gmail.com

__
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] [Rd] R 4.0.3 is released

2020-10-10 Thread Peter Dalgaard
The build system rolled up R-4.0.3.tar.gz (codename "Bunny-Wunnies Freak Out") 
this morning.

The list below details the changes in this release.

You can get the source code from

https://cran.r-project.org/src/base/R-4/R-4.0.3.tar.gz

or wait for it to be mirrored at a CRAN site nearer to you.

Binaries for various platforms will appear in due course.


For the R Core Team,

Peter Dalgaard

These are the checksums (md5 and SHA-256) for the freshly created files, in 
case you wish
to check that they are uncorrupted:

MD5 (AUTHORS) = b9c44f9f78cab3184ad9898bebc854b4
MD5 (COPYING) = eb723b61539feef013de476e68b5c50a
MD5 (COPYING.LIB) = a6f89e2100d9b6cdffcea4f398e37343
MD5 (FAQ) = 5be656453b81e9393e2a0c42688b04b8
MD5 (INSTALL) = 7893f754308ca31f1ccf62055090ad7b
MD5 (NEWS) = 71728ef32a09c5b9df36b496b52d5c8e
MD5 (NEWS.0) = bfcd7c147251b5474d96848c6f57e5a8
MD5 (NEWS.1) = eb78c4d053ec9c32b815cf0c2ebea801
MD5 (NEWS.2) = 496062c138e2def06cebccddfb814ac6
MD5 (NEWS.3) = 012e7f4a80cc8ec947bf3f0ff6117ec8
MD5 (R-latest.tar.gz) = 8ecf46afa36c9aff9904aad5ca422c6d
MD5 (README) = f468f281c919665e276a1b691decbbe6
MD5 (RESOURCES) = 529223fd3ffef95731d0a87353108435
MD5 (THANKS) = 251d20510bfc3cc93b82c5a99f7efcc6
MD5 (VERSION-INFO.dcf) = bfbcfb2f4ef4416b635087160f965904
MD5 (R-4/R-4.0.3.tar.gz) = 8ecf46afa36c9aff9904aad5ca422c6d

2cde824a7b18958e5f06b391c801c8288be0f84fa8934b7ddefef23c67e60c09  AUTHORS
e6d6a009505e345fe949e1310334fcb0747f28dae2856759de102ab66b722cb4  COPYING
6095e9ffa777dd22839f7801aa845b31c9ed07f3d6bf8a26dc5d2dec8ccc0ef3  COPYING.LIB
4390543804392e072378b2d75cd3fb0d57e9885f9dc38ddd5a2ff780487b9d97  FAQ
f87461be6cbaecc4dce44ac58e5bd52364b0491ccdadaf846cb9b452e9550f31  INSTALL
895ba3f810fd33d3be63deb6c4588be1f7ba3f5bf80e10ffeafc194221dd5ba9  NEWS
4e21b62f515b749f80997063fceab626d7258c7d650e81a662ba8e0640f12f62  NEWS.0
12b30c724117b1b2b11484673906a6dcd48a361f69fc420b36194f9218692d01  NEWS.1
e80de410c77f05ff2012fa70051b89119845f734a7fa5c55857e61e4ed7d5f6e  NEWS.2
7201d139947afa52b5e09d26dc01445edf444506264355b2185122bc1ed3dce0  NEWS.3
09983a8a78d5fb6bc45d27b1c55f9ba5265f78fa54a55c13ae691f87c5bb9e0d  
R-latest.tar.gz
2fdd3e90f23f32692d4b3a0c0452f2c219a10882033d1774f8cadf25886c3ddc  README
408737572ecc6e1135fdb2cf7a9dbb1a6cb27967c757f1771b8c39d1fd2f1ab9  RESOURCES
c9c7cb32308b4e560a22c858819ade9de524a602abd4e92d1c328c89f8037d73  THANKS
cd9666c09064b120655598c1ac792266ad20adb57c36aab4d094dedc7e480fa6  
VERSION-INFO.dcf
09983a8a78d5fb6bc45d27b1c55f9ba5265f78fa54a55c13ae691f87c5bb9e0d  
R-4/R-4.0.3.tar.gz

This is the relevant part of the NEWS file

CHANGES IN R 4.0.3:

  NEW FEATURES:

* On platforms using configure option --with-internal-tzcode,
  additional values "internal" and (on macOS only) "macOS" are
  accepted for the environment variable TZDIR.  (See ?TZDIR.)

  On macOS, "macOS" is used by default if the system timezone
  database is a newer version than that in the R installation.

* When install.packages(type = "source") fails to find a package in
  a repository it mentions package versions which are excluded by
  their R version requirement and links to hints on why a package
  might not be found.

* The default value for options("timeout") can be set from
  enviromnent variable R_DEFAULT_INTERNET_TIMEOUT, still defaulting
  to 60 (seconds) if that is not set or invalid.

  This may be needed when child R processes are doing downloads,
  for example during the installation of source packages which
  download jars or other forms of data.

  LINK-TIME OPTIMIZATION on a UNIX-ALIKE:

* There is now support for parallelized Link-Time Optimization
  (LTO) with GCC and for 'thin' LTO with clang _via_ setting the
  LTO macro.

* There is support for setting a different LTO flag for the Fortran
  compiler, including to empty when mixing clang and gfortran (as
  on macOS).  See file config.site.

* There is a new LTO_LD macro to set linker options for LTO
  compilation, for example to select an alternative linker or to
  parallelize thin LTO.

  DEPRECATED AND DEFUNCT:

* The LINPACK argument to chol.default(), chol2inv(),
  solve.default() and svd() has been defunct since R 3.1.0.  Using
  it now gives a warning which will become an error in R 4.1.0.

  BUG FIXES:

* The code mitigating stack overflow with PCRE regexps on very long
  strings is enabled for PCRE2 < 10.30 also when JIT is enabled,
  since stack overflows have been seen in that case.

* Fix to correctly show the group labels in dotchart() (which where
  lost in the ylab improvement for R 4.0.0).

* addmargins(*, ..) now also works when fn() is a local function,
  thanks to bug report and patch PR#17124 from Alex Bertram.

* rank(x) and hence sort(x) now work when x is an object (as per
  is.object(x)) of type "r

Re: [R] RStudio question

2020-10-08 Thread peter dalgaard
This list has a no-homework policy. I assume that your teaching material has 
examples that are sufficiently similar so that you should be able to modify 
them.

-pd

> On 8 Oct 2020, at 10:10 , Xavier Garcia via R-help  
> wrote:
> 
> I'm solving the following problem: Create a variable (column) in the “wf”
> dataframe named “Zone” that takes value of “tropic” if Latitude is less
> than or equal to 30, or “non-tropic” for Latitude greater than 30. Show you
> Zone variable. Latitude is a column of my dataframe. I don't know the
> sintaxis and the process to create the column.
> 
>   [[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.

-- 
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-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 as.list(substitute(...()))

2020-10-06 Thread peter dalgaard



> On 6 Oct 2020, at 09:22 , Dénes Tóth  wrote:
> 
> > foo <- function(...) substitute({...()})
> > foo(abc$de, fg[h], i)
> {
>   pairlist(abc$de, fg[h], i)
> }
> > foo(abc$de, fg[h], , i) # add a missing argument for extra fun
> {
>   as.pairlist(alist(abc$de, fg[h], , i))
> }
> 

The 2nd one here is actually an artifact of deparse(). The result is still a 
pairlist, just one that pairlist() cannot reproduce:

> e <- foo(abc$de, fg[h], , i) 
> e[[2]]
[[1]]
abc$de

[[2]]
fg[h]

[[3]]


[[4]]
i

> deparse(e[[2]])
[1] "as.pairlist(alist(abc$de, fg[h], , i))"
> dput(e[[2]])
as.pairlist(alist(abc$de, fg[h], , i))
> mode(e[[2]])
[1] "pairlist"
> mode(e[[2]][[3]])
[1] "name"

I.e. the list in e[2] contains the missing indicator (an empty name). (I'm 
slightly puzzled why we need the curlies to trigger a deparse, though) 



-- 
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-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] [Rd] R 4.0.3 scheduled for October 10

2020-10-05 Thread Peter Dalgaard via R-help
[Oops, this apparently got omitted during release scheduling]

Full schedule is available on developer.r-project.org.

-- 
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-de...@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

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


Re: [R] (no subject)

2020-10-01 Thread Peter Dalgaard
Then please follow the link in the footer. Other recipients can't help you.


> On 1 Oct 2020, at 09:30 , Marte Lilleeng  wrote:
> 
> I want to unsubscribe from this list.
> 
> -- 
> Mvh Marte Synnøve Lilleeng
> tlf 97 74 38 12
> 
>   [[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.

-- 
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-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] open file on R GUI results in spinning wheel and frozen R - Mac OS

2020-09-23 Thread Peter Dalgaard
...or try R-patched, which I'm told has the newer GUI.

-pd

> On 21 Sep 2020, at 21:43 , Berend Hasselman  wrote:
> 
> 
> 
>> On 21 Sep 2020, at 20:24, Gonçalo Ferraz  wrote:
>> 
>> Hello,
>> 
>> I’ve been using R-studio for a while and today I needed to try something 
>> directly on the R-GUI.
>> 
>> But when I try to open any *.R file I get a spinning wheel and R freezes. I 
>> can only shut it down with ‘force quit’.
>> 
>> I have deleted and re-installed R three times, each time trying to run a 
>> more thorough uninstall, but the problem persists.
>> 
>> I am using Mac OS Catalina 10.15.6 and the latest version of R ->  R 4.0.2 
>> GUI 1.72 Catalina build (7847)
>> 
>> Strangely, as this problem was happening on the R GUI, I was still able to 
>> open R scripts on RStudio. But now I uninstalled RStudio as well, in the 
>> latest attempt to start from scratch.
>> 
>> Is this problem familiar to anyone?
>> 
> 
> See this thread on the R-SIG-Mac list: 
> https://stat.ethz.ch/pipermail/r-sig-mac/2020-June/013575.html
> and her for a solution (sequel of above): 
> https://stat.ethz.ch/pipermail/r-sig-mac/2020-July/013641.html
> 
> Go to https://mac.r-project.org/ and get the latest revision of the R GUI 
> which is noe 
> https://mac.r-project.org/high-sierra/R-4.0-branch/R-GUI-7884-4.0-high-sierra-Release.dmg
> 
> I have revision 7849; if the above does not work I can mail you the dmg of 
> revision 7849.
> 
> Berend
> 
> 
> 
>> Thanks for any help,
>> 
>> Gonçalo
>> __
>> 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  Priv: pda...@gmail.com

__
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] Odd Results when generating predictions with nnet function

2020-09-02 Thread peter dalgaard
The problem seems to be the fit rather than the predictions. Looks like nnet is 
happier with data between 0 and 1, witness

Fit <- nnet(y/max(y) ~ x, a, size = 5, maxit = 1000, lineout = T, decay = 0.001)
plot(y/max(y)~x,a)
lines(fitted(Fit)~x,a)


> On 2 Sep 2020, at 16:21 , Paul Bernal  wrote:
> 
> Dear Dr. Martin and Dr. Peter, 
> 
> Hope you are doing well. Thank you for your kind feedback. I also tried 
> fitting the nnet using y ~ x, but the model kept on generating odd 
> predictions. If I understand correctly, from what Dr. Martin said, it would 
> be a good idea to try modeling sqrt(y) ~ x and then backtransform raising 
> both y and x to 0.5?
> 
> I was looking at a video where the guy modeled count data without doing any 
> kind of transformation and didn't get odd results, which is rather extrange.
> 
> Cheers,
> 
> Paul
> 
> 
> 
> El mié., 2 sept. 2020 a las 2:37, Martin Maechler 
> () escribió:
> >>>>> peter dalgaard 
> >>>>> on Wed, 2 Sep 2020 08:41:09 +0200 writes:
> 
> > Generically, nnet(a$y ~ a$x, a ...) should be nnet(y ~ x,
> > data=a, ...) otherwise predict will go looking for a$x, no
> > matter what is in xnew.  
> 
> > But more importantly, nnet() is a _classifier_, 
> > so the LHS should be a class, not a numeric variable.
> 
> > -pd
> 
> Well, nnet() can be used for both classification *and* regression,
> which is quite clear from the MASS book, but indeed, not from
> its help page, which indeed mentions one formula  'class ~ ...'
> and then only has classification examples.
> 
> So, indeed, the  ?nnet  help page could improved.
> 
> In his case, y are counts,  so  John Tukey's good old
> "first aid transformation" principle would suggest to model
> 
> sqrt(y) ~ ..   in a *regression* model which nnet() can do.
> 
> Martin Maechler
> ETH Zurich  and  R Core team
> 
> 
> 
> >> On 1 Sep 2020, at 22:19 , Paul Bernal
> >>  wrote:
> >> 
> >> Dear friends,
> >> 
> >> Hope you are all doing well. I am currently using R
> >> version 4.0.2 and working with the nnet package.
> >> 
> >> My dataframe consists of three columns, FECHA which is
> >> the date, x, which is a sequence from 1 to 159, and y,
> >> which is the number of covid cases (I am also providing
> >> the dput for this data frame below).
> >> 
> >> I tried fitting a neural net model using the following
> >> code:
> >> 
> >> xnew = 1:159 Fit <- nnet(a$y ~ a$x, a, size = 5, maxit =
> >> 1000, lineout = T, decay = 0.001)
> >> 
> >> Finally, I attempted to generate predictions with the
> >> following code:
> >> 
> >> predictions <- predict(Fit, newdata = list(x = xnew),
> >> type = "raw")
> >> 
> >> But obtained extremely odd results: As you can see,
> >> instead of obtaining numbers, more or less in the range
> >> of the last observations of a$y, I end up getting a bunch
> >> of 1s, which doesn´t make any sense (if anyone could help
> >> me understand what could be causing this):
> >> dput(predictions) structure(c(1, 1, 1, 1, 1, 1, 1, 1, 1,
> >> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
> >> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
> >> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
> >> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
> >> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
> >> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
> >> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
> >> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), .Dim
> >> = c(159L, 1L), .Dimnames = list(c("1", "2", "3", "4",
> >> "5", "6", "7", "8", "9", "10", "11", "12", "13", "14",
> >> "15", "16", "17", "18", "19", "20", "21", "22", "23",
> >> "24", "25", "26", "27", "28", "29", "30", "31", "32",
> >> "33", "34", "35", "36", "37", "38", "39", "4

Re: [R] Odd Results when generating predictions with nnet function

2020-09-01 Thread peter dalgaard
50, 18351,
> 18352, 18353, 18354, 18355, 18356, 18357, 18358, 18359, 18360,
> 18361, 18362, 18363, 18364, 18365, 18366, 18367, 18368, 18369,
> 18370, 18371, 18372, 18373, 18374, 18375, 18376, 18377, 18378,
> 18379, 18380, 18381, 18382, 18383, 18384, 18385, 18386, 18387,
> 18388, 18389, 18390, 18391, 18392, 18393, 18394, 18395, 18396,
> 18397, 18398, 18399, 18400, 18401, 18402, 18403, 18404, 18405,
> 18406, 18407, 18408, 18409, 18410, 18411, 18412, 18413, 18414,
> 18415, 18416, 18417, 18418, 18419, 18420, 18421, 18422, 18423,
> 18424, 18425, 18426, 18427, 18428, 18429, 18430, 18431, 18432,
> 18433, 18434, 18435, 18436, 18437, 18438, 18439, 18440, 18441,
> 18442, 18443, 18444, 18445, 18446, 18447, 18448, 18449, 18450,
> 18451, 18452, 18453, 18454, 18455, 18456, 18457, 18458, 18459,
> 18460, 18461, 18462, 18463, 18464, 18465, 18466, 18467, 18468,
> 18469, 18470, 18471, 18472, 18473, 18474, 18475, 18476, 18477,
> 18478, 18479, 18480, 18481, 18482, 18483, 18484, 18485, 18486,
> 18487, 18488), class = "Date"), x = 1:159, y = c(1, 8, 14, 27,
> 36, 43, 55, 69, 86, 109, 137, 200, 245, 313, 345, 443, 558, 674,
> 786, 901, 989, 1075, 1181, 1317, 1475, 1673, 1801, 1988, 2100,
> 2249, 2528, 2752, 2974, 3234, 3400, 3472, 3574, 3751, 4016, 4210,
> 4273, 4467, 4658, 4821, 4992, 5166, 5338, 5538, 5779, 6021, 6200,
> 6378, 6532, 6720, 7090, 7197, 7387, 7523, 7731, 7868, 8070, 8282,
> 8448, 8616, 8783, 8944, 9118, 9268, 9449, 9606, 9726, 9867, 9977,
> 10116, 10267, 10577, 10926, 11183, 11447, 11728, 12131, 12531,
> 13015, 13463, 13837, 14095, 14609, 15044, 15463, 16004, 16425,
> 16854, 17233, 17889, 18586, 19211, 20059, 20686, 21422, 21962,
> 22597, 23351, 24274, 25222, 26030, 26752, 27314, 28030, 29037,
> 29905, 30658, 31686, 32785, 33550, 34463, 35237, 35995, 36983,
> 38149, 39334, 40291, 41251, 42216, 43257, 44352, 45633, 47177,
> 48096, 49243, 50373, 51408, 52261, 53468, 54426, 55153, 55906,
> 56817, 57993, 58864, 60296, 61442, 62223, 63269, 64191, 65256,
> 66383, 67453, 68456, 69424, 70231, 71418, 72560, 73651, 74492,
> 75394, 76464, 77377, 78446, 79402)), row.names = c(NA, 159L), class =
> "data.frame")
> Any help and/or guidance will be greatly appreciated,
> 
> Cheers,
> 
> Paul
> 
>   [[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.

-- 
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-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] Can I use "mcnemar.test" for 3*3 tables (or is there a bug in the command?)

2020-08-31 Thread peter dalgaard



> On 30 Aug 2020, at 20:11 , Kyungmin Ko  wrote:
> 
>> 2) The second one is to produce a 3 by 3 table, with the rows indicating
>> what the kids answered to setting 1 of the experiment, and the columns
>> indicating the kids answers to setting 2.
>> Now the question is:
>> was there marginal homogenity? if not, then that is an indicator that the
>> general response to the experimental settings was different for the kids.
> 
>> 1) can I use "mcnemar.test" for 3*3 (or more) tables ?
> As Peter Dalgaard and jchavez12 (on Nabble) pointed out,

Um, that was on July 19, 2009.

> "mcnemar.test" does McNemar-Bowker test (Bowker's test) which tests
> symmetry, not marginal homogeneity.
> Marginal homogeneity and symmetry are equivalent in 2x2 matrices but
> not for larger tables.
> I also was confused because many resources (for example Wikipedia
> accessed 2020-08-30) introduce McNemar's test as a test of marginal
> homogeneity (which it is only for 2x2 matrices).
> The R Reference Manual entry for mcnemar.test states that it tests for 
> symmetry.
> The code for mcnemar.test is also consistent with the McNemar-Bowker
> test for symmetry.
> 
>> Is there a bug in the command?
> Since the function does what the manual states it does, I would not
> call this a bug.
> Although, I would like it if the result of mcnemar.test would print
> "McNemar's Chi-squared test of symmetry" rather than just "McNemar's
> Chi-squared test."
> 
>> Is the one necessarily better then the other? (for example for
>> sparser matrices ?)
> mcnemar.test often fails for sparse matrices, because symmetric zeros
> produce a NaN due to division by zero in the following line of
> mcnemar.test code:
> STATISTIC <- sum(y[upper.tri(x)]^2/x[upper.tri(x)])
> The McNemar-Bowker test uses Chi-squared approximation, which would
> not be good for small counts (and sparse matrices).
> mcnemar.test does not perform continuity correction for matrices
> larger than 2x2.
> Is there an exact test for symmetry of matrices larger than 2x2?
> I could not find one.

The exact test for the 2x2 case is isomorphic to a binomial test of the two 
off-diagonal elements (conditioning on the sum).

The natural way of constructing a test for the k x k case would be based on the 
Cartesian product of k(k-1)/2 binomials with p=.5, (one for each 
i,j-combination). This shouldn't be too hard if k is small, but of course it 
explodes combinatorially as k increases.

-pd

> 
>> Is there a bug in the command?
> I would not call this a bug.
> This behavior of giving "NA" due to a division by zero seems to be
> consistent across statistical tests in R.
> For example chisq.test(matrix(c(0, 0, 1, 2), nrow = 2) gives NA.
> 
>> So which one is "right" ?
> You have the option of the McNemar-Bowker test for symmetry
> (mcnemar.test), and Stuart-Maxwell test (mh_test).
> As an "indicator that the general response to the experimental
> settings was different for the kids,"
> I would think that if marginal homogeneity is rejected, the two tests
> are not equivalent.
> I would run mh_test with distribution = "exact" .
> The relationship between symmetry and equivalence of two tests is not
> as clear to me.
> I suppose if the two experimental settings are equivalent and the
> distribution of random error for each test are also the same the
> resulting matrix would be symmetric?
> 
> R 4.0.2 . coin 1.3.1 .
> 
> __
> 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  Priv: pda...@gmail.com

__
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 obtain individual log-likelihood value from glm?

2020-08-29 Thread peter dalgaard
Briefly, you shouldn't. One way of seeing it is if you switch the model to y~1, 
you still get logLik==0.

The root cause is the rounding in binomial()$aic:

> binomial()$aic
function (y, n, mu, wt, dev) 
{
m <- if (any(n > 1)) 
n
else wt
-2 * sum(ifelse(m > 0, (wt/m), 0) * dbinom(round(m * y), 
round(m), mu, log = TRUE))
}

which, if wt is small enough ends up calculating dbinom(0, 0, p, log=TRUE) 
which is zero. 

(Not rounding gives you NaN, because you're trying to fit a model with a 
non-integer number of observations.)

-pd

> On 29 Aug 2020, at 03:28 , John Smith  wrote:
> 
> If the weights < 1, then we have different values! See an example below. How  
> should I interpret logLik value then?
> 
> set.seed(135)
>  y <- c(rep(0, 50), rep(1, 50))
>  x <- rnorm(100)
>  data <- data.frame(cbind(x, y))
>  weights <- c(rep(1, 50), rep(2, 50))
>  fit <- glm(y~x, data, family=binomial(), weights/10)
>  res.dev <- residuals(fit, type="deviance")
>  res2 <- -0.5*res.dev^2
>  cat("loglikelihood value", logLik(fit), sum(res2), "\n")
> 
> On Tue, Aug 25, 2020 at 11:40 AM peter dalgaard  wrote:
> If you don't worry too much about an additive constant, then half the 
> negative squared deviance residuals should do. (Not quite sure how weights 
> factor in. Looks like they are accounted for.)
> 
> -pd
> 
> > On 25 Aug 2020, at 17:33 , John Smith  wrote:
> > 
> > Dear R-help,
> > 
> > The function logLik can be used to obtain the maximum log-likelihood value
> > from a glm object. This is an aggregated value, a summation of individual
> > log-likelihood values. How do I obtain individual values? In the following
> > example, I would expect 9 numbers since the response has length 9. I could
> > write a function to compute the values, but there are lots of
> > family members in glm, and I am trying not to reinvent wheels. Thanks!
> > 
> > counts <- c(18,17,15,20,10,20,25,13,12)
> > outcome <- gl(3,1,9)
> > treatment <- gl(3,3)
> > data.frame(treatment, outcome, counts) # showing data
> > glm.D93 <- glm(counts ~ outcome + treatment, family = poisson())
> > (ll <- logLik(glm.D93))
> > 
> >   [[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.
> 
> -- 
> 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

__
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 obtain individual log-likelihood value from glm?

2020-08-29 Thread peter dalgaard



> On 25 Aug 2020, at 18:40 , peter dalgaard  wrote:
> 
> If you don't worry too much about an additive constant, then half the 
> negative squared deviance residuals should do. (Not quite sure how weights 
> factor in. Looks like they are accounted for.)
> 
> -pd
> 
>> On 25 Aug 2020, at 17:33 , John Smith  wrote:
>> 
>> Dear R-help,
>> 
>> The function logLik can be used to obtain the maximum log-likelihood value
>> from a glm object. This is an aggregated value, a summation of individual
>> log-likelihood values. How do I obtain individual values? In the following
>> example, I would expect 9 numbers since the response has length 9. I could
>> write a function to compute the values, but there are lots of
>> family members in glm, and I am trying not to reinvent wheels. Thanks!
>> 
>> counts <- c(18,17,15,20,10,20,25,13,12)
>>outcome <- gl(3,1,9)
>>treatment <- gl(3,3)
>>data.frame(treatment, outcome, counts) # showing data
>>glm.D93 <- glm(counts ~ outcome + treatment, family = poisson())
>>(ll <- logLik(glm.D93))
>> 
>>  [[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.
> 
> -- 
> 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

__
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] Importing data using Foreign

2020-08-26 Thread peter dalgaard
It is because you don't know whether you want it or not. 

It is a bit more obvious with integer indexing, as in color[race]: if race is 
NA you don't know what color to put in, but the result should be the same 
length as race. 

With logical indices, the behaviour is a bit annoying, but ultimately follows 
from the coercion rules: You might think that you could treat NA as FALSE (& 
the subset() function does just that), but then you'd get the problem that 
x[NA] would differ from x[as.integer(NA)] because NA is of mode "logical", 
lowest in the coercion hierarchy.

-pd

> On 26 Aug 2020, at 17:06 , Elham Daadmehr  wrote:
> 
> Thanks guys. but I'm a bit confused. the input is the first column (z[,1] and 
> z1[,1]).
> How is it possible that a subset of a non-NA vector, contains NA?
> 
> On Wed, Aug 26, 2020 at 4:58 PM Eric Berger  wrote:
> Good point! :-)
> 
> 
> On Wed, Aug 26, 2020 at 5:55 PM peter dalgaard  wrote:
> Offhand, I suspect that the NAs are in the 8th column.
> 
> > On 26 Aug 2020, at 10:57 , Elham Daadmehr  wrote:
> > 
> > Hi all,
> > 
> > I have a simple problem. I get stuck in using the imported spss data (.sav)
> > using "read.spss".
> > I imported data (z) without any problem. After importing, the first column
> > doesn't contain any "NA". but when I choose a subset of it (like:
> > z[z[,8]=="11"|z[,8]=="12"|z[,8]=="14",]), lots of NA appears (even in the
> > first column).
> > 
> > The (.sav) file is the output of Compustat (WRDS).
> > 
> > It is terrible, I can't find the mistake.
> > 
> > Thank you in advance for your help,
> > Elham
> > 
> >   [[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.
> 
> -- 
> 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-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  Priv: pda...@gmail.com

__
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] Importing data using Foreign

2020-08-26 Thread peter dalgaard
Offhand, I suspect that the NAs are in the 8th column.

> On 26 Aug 2020, at 10:57 , Elham Daadmehr  wrote:
> 
> Hi all,
> 
> I have a simple problem. I get stuck in using the imported spss data (.sav)
> using "read.spss".
> I imported data (z) without any problem. After importing, the first column
> doesn't contain any "NA". but when I choose a subset of it (like:
> z[z[,8]=="11"|z[,8]=="12"|z[,8]=="14",]), lots of NA appears (even in the
> first column).
> 
> The (.sav) file is the output of Compustat (WRDS).
> 
> It is terrible, I can't find the mistake.
> 
> Thank you in advance for your help,
> Elham
> 
>   [[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.

-- 
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-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 obtain individual log-likelihood value from glm?

2020-08-25 Thread peter dalgaard
If you don't worry too much about an additive constant, then half the negative 
squared deviance residuals should do. (Not quite sure how weights factor in. 
Looks like they are accounted for.)

-pd

> On 25 Aug 2020, at 17:33 , John Smith  wrote:
> 
> Dear R-help,
> 
> The function logLik can be used to obtain the maximum log-likelihood value
> from a glm object. This is an aggregated value, a summation of individual
> log-likelihood values. How do I obtain individual values? In the following
> example, I would expect 9 numbers since the response has length 9. I could
> write a function to compute the values, but there are lots of
> family members in glm, and I am trying not to reinvent wheels. Thanks!
> 
> counts <- c(18,17,15,20,10,20,25,13,12)
> outcome <- gl(3,1,9)
> treatment <- gl(3,3)
> data.frame(treatment, outcome, counts) # showing data
> glm.D93 <- glm(counts ~ outcome + treatment, family = poisson())
> (ll <- logLik(glm.D93))
> 
>   [[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.

-- 
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-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] Best settings for RStudio video recording?

2020-08-14 Thread peter dalgaard
[Sorry about the misfire a second ago...]

As others have said, for deeper questions, try RStudio's own lists or 
R-sig-teaching.

However, FWIW, I seem to have gotten away with just using a separate virtual 
desktop with my usual work setup, and then switch to it when necessary. This 
was for Panopto video recordings, but Zoom et al. should be much the same. 
Compared to physical lecturing it is actually somewhat easier, because you 
don't need to worry so much about projector shortcomings, readability from the 
back row, etc.

-pd

> On 13 Aug 2020, at 20:58 , Jonathan Greenberg  wrote:
> 
> Folks:
> 
> I was wondering if you all would suggest some helpful RStudio
> configurations that make recording a session via e.g. zoom the most useful
> for students doing remote learning.  Thoughts?
> 
> --j
> 
> -- 
> Jonathan A. Greenberg, PhD
> Randall Endowed Professor and Associate Professor of Remote Sensing
> Global Environmental Analysis and Remote Sensing (GEARS) Laboratory
> Natural Resources & Environmental Science
> University of Nevada, Reno
> 1664 N Virginia St MS/0186
> Reno, NV 89557
> Phone: 415-763-5476
> https://www.gearslab.org/
> 
>   [[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.

-- 
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-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] Best settings for RStudio video recording?

2020-08-14 Thread peter dalgaard



> On 14 Aug 2020, at 09:50 , Jeff Newmiller  wrote:
> 
> perhaps. I wasn't aware of it. Given the level of traffic there it looks like 
> I am not alone.
> 
> On August 13, 2020 5:22:21 PM PDT, Bert Gunter  wrote:
>> Well then:
>> "Using the multi-OS RStudio for teaching R seems rather less off-topic
>> than
>> that."
>> 
>> If the query is about teaching r, wouldn't R-Sig-teaching be the right
>> place to post?
>> 
>> 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 Thu, Aug 13, 2020 at 5:11 PM Jeff Newmiller
>> 
>> wrote:
>> 
>>> The jab about a "private company" detracted from your point. It is a
>>> public benefit corporation, but either way they produce open source
>>> software that is frequently used to introduce people to R, and the
>> company
>>> management structure is irrelevant.
>>> 
>>> While I would have preferred to see a question that was open to any
>>> presentation format, forbidding discussion of how to teach R just
>> because
>>> the query happens to limit itself to RStudio seems excessively narrow
>> to me.
>>> 
>>> I have been frustrated by the fact that there is no r-sig-windows,
>> since I
>>> find myself uncomfortably discussing OS-specific issues on R-help for
>> which
>>> there is no better place to forward them. Using the multi-OS RStudio
>> for
>>> teaching R seems rather less off-topic than that.
>>> 
>>> On August 13, 2020 3:15:31 PM PDT, Bert Gunter
>> 
>>> wrote:
>>>> Way off topic. Ask at RStudio. This is **R-Help** -- help on R
>>>> programming.  RStudio is a private company.
>>>> 
>>>> 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 Thu, Aug 13, 2020 at 3:05 PM Jonathan Greenberg
>> 
>>>> wrote:
>>>> 
>>>>> Folks:
>>>>> 
>>>>> I was wondering if you all would suggest some helpful RStudio
>>>>> configurations that make recording a session via e.g. zoom the
>> most
>>>> useful
>>>>> for students doing remote learning.  Thoughts?
>>>>> 
>>>>> --j
>>>>> 
>>>>> --
>>>>> Jonathan A. Greenberg, PhD
>>>>> Randall Endowed Professor and Associate Professor of Remote
>> Sensing
>>>>> Global Environmental Analysis and Remote Sensing (GEARS)
>> Laboratory
>>>>> Natural Resources & Environmental Science
>>>>> University of Nevada, Reno
>>>>> 1664 N Virginia St MS/0186
>>>>> Reno, NV 89557
>>>>> Phone: 415-763-5476
>>>>> https://www.gearslab.org/
>>>>> 
>>>>>[[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.
>>> 
>>> --
>>> 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.
>>> 
> 
> -- 
> 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.

-- 
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-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] optim with upper and lower bounds

2020-08-11 Thread peter dalgaard
This stuff is of course dependent on exactly which optimization problem you 
have, but optimx::optimr is often a very good drop-in replacement for optim, 
especially when bounds are involved (e.g., optim has an awkward habit of 
attempting evaluations outside the domain when numerical derivatives are 
needed).

You might want to look at the last examples in ?stats4::mle (in R 4.x.x)

-pd

> On 10 Aug 2020, at 22:08 , Roy Mendelssohn - NOAA Federal via R-help 
>  wrote:
> 
> I am running a lot of optimization problems, at the moment using 'optim'  
> ('optim' is actually called by another program).  All of the problems have 
> variables with simple upper and lower bounds,  which I can easily transform 
> into a form that is unconstrained and solve using 'BFGS'.  But I was 
> wondering is if it is more robust to solve the problem this way,  or to use 
> L-BFGS-B instead.
> 
> Also how much difference can it make using 'optimx' instead 'optim'?  The 
> program I am using (KFAS) allows this,  I just have to do some extra 
> programming to use it.
> 
> Thanks,
> 
> -Roy
> 
> 
> 
> **
> "The contents of this message do not reflect any position of the U.S. 
> Government or NOAA."
> **
> Roy Mendelssohn
> Supervisory Operations Research Analyst
> NOAA/NMFS
> Environmental Research Division
> Southwest Fisheries Science Center
> ***Note new street address***
> 110 McAllister Way
> Santa Cruz, CA 95060
> Phone: (831)-420-3666
> Fax: (831) 420-3980
> e-mail: roy.mendelss...@noaa.gov www: https://www.pfeg.noaa.gov/
> 
> "Old age and treachery will overcome youth and skill."
> "From those who have been given much, much will be expected" 
> "the arc of the moral universe is long, but it bends toward justice" -MLK Jr.
> 
> __
> 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  Priv: pda...@gmail.com

__
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] A Question about MLE in R

2020-07-22 Thread peter dalgaard
Simulated annealing is a probabilistic method and will do things like that. You 
should probably read an introduction to the method, e.g. the Wikipedia page. 
Not too unlikely, you really want to use one of the other methods in optim() 
(or better still optimr from the optimx package). 

(I take it that logLik is really the _negative_ log-likelihood function, right? 
Otherwise, the problem could be that you are minimizing, not maximizing.)

-pd

> On 22 Jul 2020, at 09:06 , Zixuan Qi  wrote:
> 
> Hi,
> 
> I encounter a problem. I use optim() function in R to estimate likelihood
> function and the method is SANN in the optim function.
> out <-
> optim(parm,logLik,method='SANN',hessian=T,control=list(maxit=500))
> 
> However, I find that each time I run the program, I will get different
> values of parameters. My initial values are same, but the number of
> iterations has reached the maximum limit. I expanded the number of
> iterations to 5 million, but it�s still wrong.
> 
> I want to know what I should do. Is anyone willing to help me? Thanks so
> much!
> 
> Best,
> Cisy
> 
>   [[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.

-- 
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-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] A WSL question with allocation

2020-07-21 Thread peter dalgaard
Does "ulimit -a" give a hint? (NB: no n in there...)

-pd

> On 21 Jul 2020, at 17:30 , Erin Hodgess  wrote:
> 
> Hello!
> 
> Hope everyone is staying well.
> 
> I’m not sure if this is the right list for this question, but here goes.
> 
> I am using the new experimental WSL on my Windows laptop.  It was going
> well until yesterday.   I’m using Ubuntu 20.04.  I am starting to get “
> error: cannot allocate vector of size 1.3 gb”.  I have 32 gb of RAM.  I
> tried using “unlimit -v 16”, not working.
> 
> Has anyone else had trouble with this, please? I’m thinking that it might
> be because of the newness of the WSL platform.
> 
> Thanks,
> Erin
> 
> -- 
> Erin Hodgess, PhD
> mailto: erinm.hodg...@gmail.com
> 
>   [[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.

-- 
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-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 use mle2 function?

2020-07-01 Thread peter dalgaard
og-likelihood function
>>>>> ```
>>>>> If I pass the negative log-function (assuming a binomial distribution
>>>>> of the data, which I am not sure about)
>>>>> ```
>>>>> nll = function(p, n, k) {
>>>>>  # extract parms
>>>>>  a = p[1]
>>>>>  h = p[2]
>>>>>  # calculate probability of attack
>>>>>  pred = a/(1+a*h*n)
>>>>>  # calc NLL
>>>>>  -sum(dbinom(k, prob = pred, size = n, log = TRUE))
>>>>> }
>>>>> ```
>>>>> then I get the same error:
>>>>> ```
>>>>>> O = mle2(minuslogl = nll, start = list(a = A, h = B),
>>>>> +  data = list(n = 5720, k = A))
>>>>> Error in mle2(minuslogl = nll, start = list(a = A, h = B), data =
>>>>> list(n = 5720,  :
>>>>>  some named arguments in 'start' are not arguments to the specified
>>>>> log-likelihood function
>>>>> ```
>>>>> but with the disadvantage of working on an assumed function (nll).
>>>>> How can I optimize the function `holling` properly?
>>>>> Thank you
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> --
>>>>> Best regards,
>>>>> Luigi
>>>>> 
>>>>> __
>>>>> 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.
>>> 
>>> 
>>> 
>>> --
>>> Best regards,
>>> Luigi
> 
> 
> 
> -- 
> Best regards,
> Luigi
> 
> __
> 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  Priv: pda...@gmail.com

__
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 extract specific subscript of a matrix

2020-06-27 Thread peter dalgaard
For that, it is more straightforward to use

which(M==1, arr.ind=TRUE)

However, the desired output has 8 indices, not 12. I don't see what the desired 
pattern is...

- pd

> On 11 Jun 2020, at 03:01 , Jeff Newmiller  wrote:
> 
> M <- matrix(c(2,2,rep(1,12), 2), nrow = 5,byrow = FALSE)
> ix <- expand.grid( r = seq.int( nrow( M ) )
> , c = seq.int( ncol( M ) )
> )
> ix[ 1 == c(M), ]
> 
> 
> On June 10, 2020 5:29:10 PM PDT, Jinsong Zhao  wrote:
>> Hi there,
>> 
>> I have a matrix similar as:
>> 
>> M <- matrix(c(2,2,rep(1,12), 2), nrow = 5,byrow = FALSE)
>> 
>> I hope to get the border subscript of the block with value 1. In the 
>> above example, I hope to get:
>> 
>> (3,1), (5,1), (5,2), (4,2), (4,3), (1,3), (1,2), (3,2)
>> 
>> Is there any function can do that? or any implement idea? Thanks!
>> 
>> Best,
>> Jinsong
>> 
>> __
>> 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.

-- 
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-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 4.0.2 is released

2020-06-22 Thread Peter Dalgaard via R-help
The build system rolled up R-4.0.2.tar.gz (codename "Taking Off Again") this 
morning.

The list below details the changes in this release.

You can get the source code from

http://cran.r-project.org/src/base/R-4/R-4.0.2.tar.gz

or wait for it to be mirrored at a CRAN site nearer to you.

Binaries for various platforms will appear in due course.


For the R Core Team,

Peter Dalgaard

These are the checksums (md5 and SHA-256) for the freshly created files, in 
case you wish
to check that they are uncorrupted:

MD5 (AUTHORS) = b9c44f9f78cab3184ad9898bebc854b4
MD5 (COPYING) = eb723b61539feef013de476e68b5c50a
MD5 (COPYING.LIB) = a6f89e2100d9b6cdffcea4f398e37343
MD5 (FAQ) = 4afa171cd982aaa60f0ba92e2e7bc5d6
MD5 (INSTALL) = 7893f754308ca31f1ccf62055090ad7b
MD5 (NEWS) = 566a6bb3642e28e6bf01cf98db31137c
MD5 (NEWS.0) = bfcd7c147251b5474d96848c6f57e5a8
MD5 (NEWS.1) = eb78c4d053ec9c32b815cf0c2ebea801
MD5 (NEWS.2) = 496062c138e2def06cebccddfb814ac6
MD5 (NEWS.3) = 012e7f4a80cc8ec947bf3f0ff6117ec8
MD5 (R-latest.tar.gz) = 1eac7293d5fe313a56ddabfda02b437e
MD5 (README) = f468f281c919665e276a1b691decbbe6
MD5 (RESOURCES) = 529223fd3ffef95731d0a87353108435
MD5 (THANKS) = 251d20510bfc3cc93b82c5a99f7efcc6
MD5 (VERSION-INFO.dcf) = 62496d3a0fd8cc2ed644ea518c052371
MD5 (R-4/R-4.0.2.tar.gz) = 1eac7293d5fe313a56ddabfda02b437e

2cde824a7b18958e5f06b391c801c8288be0f84fa8934b7ddefef23c67e60c09  AUTHORS
e6d6a009505e345fe949e1310334fcb0747f28dae2856759de102ab66b722cb4  COPYING
6095e9ffa777dd22839f7801aa845b31c9ed07f3d6bf8a26dc5d2dec8ccc0ef3  COPYING.LIB
eddf87b12197c7b3b19cbc9b11c1beab95b14e3dcd715bf37d2f6a8b2a72c2a1  FAQ
f87461be6cbaecc4dce44ac58e5bd52364b0491ccdadaf846cb9b452e9550f31  INSTALL
ec05bba338358410fae6b34fed061605989ab3601aba1b3fcb45a610d5dd2eb9  NEWS
4e21b62f515b749f80997063fceab626d7258c7d650e81a662ba8e0640f12f62  NEWS.0
12b30c724117b1b2b11484673906a6dcd48a361f69fc420b36194f9218692d01  NEWS.1
e80de410c77f05ff2012fa70051b89119845f734a7fa5c55857e61e4ed7d5f6e  NEWS.2
7201d139947afa52b5e09d26dc01445edf444506264355b2185122bc1ed3dce0  NEWS.3
d3bceab364da0876625e4097808b42512395fdf41292f4915ab1fd257c1bbe75  
R-latest.tar.gz
2fdd3e90f23f32692d4b3a0c0452f2c219a10882033d1774f8cadf25886c3ddc  README
408737572ecc6e1135fdb2cf7a9dbb1a6cb27967c757f1771b8c39d1fd2f1ab9  RESOURCES
c9c7cb32308b4e560a22c858819ade9de524a602abd4e92d1c328c89f8037d73  THANKS
10cc5f566a4a5ce49147e7dcfbe9180dba09ccb9efb17298b067309eb799e92e  
VERSION-INFO.dcf
d3bceab364da0876625e4097808b42512395fdf41292f4915ab1fd257c1bbe75  
R-4/R-4.0.2.tar.gz

This is the relevant part of the NEWS file

CHANGES IN R 4.0.2:

  UTILITIES:

* R CMD check skips vignette re-building (with a warning) if the
  VignetteBuilder package(s) are not available.

  BUG FIXES:

* Paths with non-ASCII characters caused problems for package
  loading on Windows PR#17833.

* Using tcltk widgets no longer crashes R on Windows.

* source(*, echo=TRUE) no longer fails in some cases with empty
  lines; reported by Bill Dunlap in PR#17769.

* on.exit() now correctly matches named arguments, thanks to
  PR#17815 (including patch) by Brodie Gaslam.

* regexpr(*, perl=TRUE) no longer returns incorrect positions into
  text containing characters outside of the Unicode Basic
  Multilingual Plane on Windows.

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


Re: [R] Error in "plot(aov.object)" after upgradation to R-4.0.0 and R-4.0.1 for given R-Script-Example

2020-06-21 Thread peter dalgaard
This is fallout from the stringsAsFactors changes. You have 'Permanganate' as a 
character vector and it runs afoul of this code

aterms <- attributes(terms(x))
dcl <- aterms$dataClasses[-aterms$response]
facvars <- names(dcl)[dcl %in% c("factor", "ordered")]

which does not include 'Permanganate', even though the model fit has de facto 
promoted it to a factor. In the end, you try to multiply a px2-matrix by a 
3-vector and things go poof.

This probably counts a bug in R, but I see that your code actually tries to 
pre-convert the variables to factors. However, you misspelled "Permangate"

-pd

> On 19 Jun 2020, at 17:13 , Akhilesh Singh  
> wrote:
> 
> Dear learned experts of R,
> 
> I was writing a book through RStudio-Rmarkdown and had finally compiled it
> successfully based on R package R-3.6.2. Afterwards, I updated my R-3.6.2
> to R-4.0.0 and even later to R-4.0.1.
> 
> Then, the publishers demanded to recompile the book with font embedding, so
> I tried to recompile the book, when I found the following error:
> 
> "Error in (dm - 1) %*% ff : non-conformable arguments"
> 
> For convenience and reproducibility of the error, I am giving below the
> same code chunk as an R-Script-Example, wherein the error is occurring in
> the plot() function with the input of an aov() object.
> 
> R-Script-Example producing error:
> ==
> 
> setwd("E:/AKS-DATA-New/Software/R and allied
> packages/R-Markdown/knitr/MyBooks/STAT-512_STAT-564")
> getwd()
> 
> #After Upgrading to R-4.0.0 and even in R-4.0.1 following error in "plot()"
> function occurs:
> 
> Block=c(1,1,1,1,2,2,2,2,3,3,3,3)
> Permanganate=c("without","without","with","with","without","without","with","with","without","without","with","with")
> Sample.Size=c(0.25,1,0.25,1,0.25,1,0.25,1,0.25,1,0.25,1)
> Riboflavin=c(39.5,38.6,27.2,24.6,43.1,39.5,23.2,24.2,45.2,33,24.8,22.2)
> 
> #Creating data frame
> sned.2x2.woint=data.frame(Block, Sample.Size, Permanganate, Riboflavin)
> 
> #Declaring Block, Sample.Size, Permanganate as factors
> sned.2x2.woint$Block = factor(sned.2x2.woint$Block)
> sned.2x2.woint$Sample.Size = factor(sned.2x2.woint$Sample.Size)
> sned.2x2.woint$Permangate=factor(sned.2x2.woint$Permanganate)
> 
> #ANOVA of RBD when Block, Sample.Size, Permanganate are a fixed effects
> sned.2x2.woint.aov1=aov(Riboflavin ~ Block + Sample.Size + Permanganate +
> Sample.Size:Permanganate,data=sned.2x2.woint)
> 
> cat("ANOVA of RBD when Block, Sample.Size and Permanganate are fixed
> effects:\n")
> summary(sned.2x2.woint.aov1)
> 
> #ANOVA of RBD when Block, Sample.Size, Permanganate are fixed effects
> sned.2x2.woint.aov2=aov(Riboflavin ~ Block + Sample.Size + Permanganate,
> data=sned.2x2.woint)
> 
> cat("ANOVA of RBD when Block, Sample.Size and Permanganate are fixed
> effects:\n")
> 
> summary(sned.2x2.woint.aov2)
> 
> plot(sned.2x2.woint.aov2, which=1) #OK
> plot(sned.2x2.woint.aov2, which=2) #Ok
> plot(sned.2x2.woint.aov2, which=3) #OK
> plot(sned.2x2.woint.aov2, which=4) #OK
> 
> plot(sned.2x2.woint.aov2, which=5) #Error in (dm - 1) %*% ff :
> non-conformable arguments
> 
> plot(sned.2x2.woint.aov2, which=6) #OK
> =
> 
> I request the esteemed and learned experts of R to kindly me out to
> overcome this error.
> 
> With regards
> 
> 
> 
> -- 
> Dr. A.K. Singh
> Professor and Head (Agricultural Statistics)
> Department of Agricultural Statistics and Social Science (L)
> Indira Gandhi Krishi Vishwavidyalaya, Raipur-492 012,
> Chhattisgarh, India
> Mobile: +918770625795
> Email: akhileshsingh.i...@gmail.com
> 
>   [[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.

-- 
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-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] [Rd] R 4.0.2 scheduled for June 22

2020-06-09 Thread Peter Dalgaard via R-help
Unfortunatly, a memory allocation bug prevented the R Commander package from 
working on Windows. This is fixed in R-patched, but we cannot have this not 
working in the official release when IT departments start installing for the 
Fall semester, so we need to issue a new release.

Full schedule is available on developer.r-project.org.

-- 
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-de...@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

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


Re: [R] R 4.0.1 crashes with R commander

2020-06-08 Thread Peter Dalgaard
This was fixed by r78653, so should be in R-patched already

https://cran.r-project.org/bin/windows/base/rpatched.html

-pd

> On 7 Jun 2020, at 19:15 , Paulo Figueiredo  wrote:
> 
> Hi,
> 
> I just updated R from 4.0 to 4.0.1 and when trying to load R commander (both 
> in R and RStudio) the programme crashes. Any suggestion?
> 
> Thanks
> 
> 
> -- 
> This email has been checked for viruses by Avast antivirus software.
> https://www.avast.com/antivirus
> 
> __
> 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  Priv: pda...@gmail.com

__
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 4.0.1 is released

2020-06-06 Thread Peter Dalgaard via R-help
The build system rolled up R-4.0.1.tar.gz (codename "See Things Now") this 
morning.

The list below details the changes in this release.

You can get the source code from

http://cran.r-project.org/src/base/R-4/R-4.0.1.tar.gz

or wait for it to be mirrored at a CRAN site nearer to you.

Binaries for various platforms will appear in due course.


For the R Core Team,

Peter Dalgaard

These are the checksums (md5 and SHA-256) for the freshly created files, in 
case you wish
to check that they are uncorrupted:

MD5 (AUTHORS) = b9c44f9f78cab3184ad9898bebc854b4
MD5 (COPYING) = eb723b61539feef013de476e68b5c50a
MD5 (COPYING.LIB) = a6f89e2100d9b6cdffcea4f398e37343
MD5 (FAQ) = 4afa171cd982aaa60f0ba92e2e7bc5d6
MD5 (INSTALL) = 7893f754308ca31f1ccf62055090ad7b
MD5 (NEWS) = 425fd186ac71e462e66af7fb33f86ab4
MD5 (NEWS.0) = bfcd7c147251b5474d96848c6f57e5a8
MD5 (NEWS.1) = eb78c4d053ec9c32b815cf0c2ebea801
MD5 (NEWS.2) = 496062c138e2def06cebccddfb814ac6
MD5 (NEWS.3) = 012e7f4a80cc8ec947bf3f0ff6117ec8
MD5 (R-latest.tar.gz) = 8d199d11865c202cf2bd006e7f32dab7
MD5 (README) = f468f281c919665e276a1b691decbbe6
MD5 (RESOURCES) = 529223fd3ffef95731d0a87353108435
MD5 (THANKS) = 251d20510bfc3cc93b82c5a99f7efcc6
MD5 (VERSION-INFO.dcf) = 7d8af8c338a1e146f9471744d092078a
MD5 (R-4/R-4.0.1.tar.gz) = 8d199d11865c202cf2bd006e7f32dab7

2cde824a7b18958e5f06b391c801c8288be0f84fa8934b7ddefef23c67e60c09  AUTHORS
e6d6a009505e345fe949e1310334fcb0747f28dae2856759de102ab66b722cb4  COPYING
6095e9ffa777dd22839f7801aa845b31c9ed07f3d6bf8a26dc5d2dec8ccc0ef3  COPYING.LIB
eddf87b12197c7b3b19cbc9b11c1beab95b14e3dcd715bf37d2f6a8b2a72c2a1  FAQ
f87461be6cbaecc4dce44ac58e5bd52364b0491ccdadaf846cb9b452e9550f31  INSTALL
1dfd76a990f2a1b11ee4ff17284d18c2177179ee7bbaef51b32e1e7a58719596  NEWS
4e21b62f515b749f80997063fceab626d7258c7d650e81a662ba8e0640f12f62  NEWS.0
12b30c724117b1b2b11484673906a6dcd48a361f69fc420b36194f9218692d01  NEWS.1
e80de410c77f05ff2012fa70051b89119845f734a7fa5c55857e61e4ed7d5f6e  NEWS.2
7201d139947afa52b5e09d26dc01445edf444506264355b2185122bc1ed3dce0  NEWS.3
95fe24a4d8d8f8f888460c8f5fe4311cec656e7a1722d233218bc03861bc6f32  
R-latest.tar.gz
2fdd3e90f23f32692d4b3a0c0452f2c219a10882033d1774f8cadf25886c3ddc  README
408737572ecc6e1135fdb2cf7a9dbb1a6cb27967c757f1771b8c39d1fd2f1ab9  RESOURCES
c9c7cb32308b4e560a22c858819ade9de524a602abd4e92d1c328c89f8037d73  THANKS
d3cdccb1b1645fce356d08892baa0587aa2aef2e851ad552d47cce856137d9b3  
VERSION-INFO.dcf
95fe24a4d8d8f8f888460c8f5fe4311cec656e7a1722d233218bc03861bc6f32  
R-4/R-4.0.1.tar.gz

This is the relevant part of the NEWS file

CHANGES IN R 4.0.1:

  NEW FEATURES:

* paste() and paste0() gain a new optional argument recycle0.  When
  set to true, zero-length arguments are recycled leading to
  character(0) after the sep-concatenation, i.e., to the empty
  string "" if collapse is a string and to the zero-length value
  character(0) when collapse = NULL.

  A package whose code uses this should depend on R (>= 4.0.1).

* The summary() method now maps the counts correctly to
  the warning messages.

  BUG FIXES:

* aov(frml, ...) now also works where the formula deparses to more
  than 500 characters, thanks to a report and patch proposal by Jan
  Hauffa.

* Fix a dozen places (code, examples) as Sys.setlocale() returns
  the new rather than the previous setting.

* Fix for adding two complex grid units via sum().  Thanks to Gu
  Zuguang for the report and Thomas Lin Pedersen for the patch.

* Fix parallel::mclapply(..., mc.preschedule=FALSE) to handle raw
  vector results correctly. PR#17779

* Computing the base value, i.e., 2, "everywhere", now uses
  FLT_RADIX, as the original machar code looped indefinitely on the
  ppc64 architecture for the longdouble case.

* In R 4.0.0, sort.list(x) when is.object(x) was true, e.g., for x
  <- I(letters), was accidentally using method = "radix".
  Consequently, e.g., merge() was much slower than
  previously; reported in PR#17794.

* plot(y ~ x, ylab = quote(y[i])) now works, as e.g., for xlab;
  related to PR#10525.

* parallel::detect.cores(all.tests = TRUE) tries a matching OS name
  before the other tests (which were intended only for unknown
  OSes).

* Parse data for raw strings is now recorded correctly. Reported by
  Gabor Csardi.

-- 
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/pos

Re: [R] How to create a warning inside the factorial function for decimal numbers

2020-06-01 Thread peter dalgaard
You might check that n %% 1 == 0.

(Factorials do exist for fractional numbers -- check e.g. factorial(6.5). And 
please don't send HTML because, well, you can see the result below)

- pd

> On 1 Jun 2020, at 12:49 , Vahid Borji  wrote:
> 
> I am writing a code for the factorial function. My code is as follows:
> 
>> f<- function(n){+ factorial <- 1+ if( n < 0 )+ print("Factorial of negative 
>> numbers is not possible")+ else if( n == 0 )+ print("Factorial of 0 is 1")+ 
>> else {+ for(i in 1:n)+ factorial <- factorial * i+ print(paste("Factorial of 
>> ",n," is ",factorial))+ }+ }
> 
> My problem with this code is for decimal numbers as input. For example for
> f(6.5) my code computes 720, but we know 6.5 ! does not exist. For decimal
> numbers like, or sqrt(2) I would like to see a message like
> 
> "The factorial for this number does not exist".
> 
> How can I fix this problem in my 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.

-- 
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-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] [Rd] R 4.0.1 scheduled for June 6

2020-05-24 Thread Peter Dalgaard via R-help
Full schedule is available on developer.r-project.org.

-- 
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-de...@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

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


Re: [R] [External Email] Re: [External] Re: access for free more than 500 essential Springer Nature textbooks

2020-05-23 Thread peter dalgaard
Some of them are generally available. At least they look that way from here

E.g., (shameless plug...)

https://link.springer.com/book/10.1007/978-0-387-79054-1

-pd


> On 23 May 2020, at 06:15 , Christopher W. Ryan  wrote:
> 
> Am I interpreting this offer correctly, that it is for libraries to
> obtain access to the e-books for free? It does not seem to me that an
> invididual can download one--am I missing that part?
> 
> Thanks
> 
> --Chris Ryan
> 
> Mark Leeds wrote:
>> Abby: here's an easier link for seeing what you might like.
>> 
>> https://link.springer.com/search?facet-content-type=%22Book%22&package=mat-covid19_textbooks&%23038;facet-language=%22En%22&%23038;sortOrder=newestFirst&%23038;showAll=true
>> 
>> On Fri, May 22, 2020 at 9:18 PM Richard O'Keefe  wrote:
>> 
>>> the real pleasure comes from things you weren't looking for but recognise
>>> as just what you needed.
>>> 
>>> On Sat, 23 May 2020 at 12:34, Jeff Newmiller 
>>> wrote:
>>> 
>>>> You are bound to be disappointed if you invert the purpose of the list.
>>>> This is marketing... think of it as a sale... stores rarely put their
>>>> entire stock on sale... particularly if the sale price is zero. You have
>>> to
>>>> start with the list and look for interesting titles.
>>>> 
>>>> But don't let me dissuade you from adding to your killfile if that seems
>>>> more useful to you.
>>>> 
>>>> On May 22, 2020 5:04:29 PM PDT, Abby Spurdle 
>>> wrote:
>>>>>> The Excel file is what you need.
>>>>> 
>>>>> Well, now I'm in a bad mood.
>>>>> 
>>>>> I went to all the trouble of opening the thing...
>>>>> And the first two Springer-published books I look for, aren't there.
>>>>> 
>>>>> (1) Programming with Data, John Chambers
>>>>> (2) Applied Econometrics with R, Z and co.
>>>>> 
>>>>> Next time someone tells me to use an Excel document, I'm adding them
>>>>> to the spam list.
>>>>> 
>>>>> __
>>>>> 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.
>>>> 
>>> 
>>>[[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.
>> 
> 
> __
> 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  Priv: pda...@gmail.com

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


  1   2   3   4   5   6   7   8   9   10   >