[Rd] diag(-1) produces weird result

William Revelle li@t@ @ending from revelle@net
Mon Sep 17 18:14:41 CEST 2018


Dear list

A strange bug in the psych package is due to the behavior of the diag function:

It gives the expected values for 1, a vector (-1,1), but not for -1

Is this a known feature?


> diag(1)
     [,1]
[1,]    1
> diag(c(-1,1))
     [,1] [,2]
[1,]   -1    0
[2,]    0    1
> diag(-1)
Error in diag(-1) : invalid 'nrow' value (< 0)


Bill


William Revelle		   personality-project.org/revelle.html
Professor			          personality-project.org
Department of Psychology www.wcas.northwestern.edu/psych/
Northwestern University	   www.northwestern.edu/
Use R for psychology         personality-project.org/r
It is 2   minutes to midnight   www.thebulletin.org



More information about the R-devel mailing list