It behaves as per documentation.
" Using diag(x) can have unexpected effects if x is a vector that could be of
length one. Use diag(x, nrow = length(x)) for consistent behavior."
Ravi
From: R-devel on behalf of Gábor Csárdi
Sent: Monday, September 17, 2018
On Mon, Sep 17, 2018 at 5:22 PM, Gábor Csárdi
wrote:
> I would say it is a mis-feature. If the 'x' argument of diag() is a
> vector of length 1, then it creates an identity matrix of that size,
> instead of creating a 1x1 matrix with the given value:
>
> ❯ diag(3)
> [,1] [,2] [,3]
> [1,]
On 17/09/2018 12:14 PM, William Revelle wrote:
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?
It is pretty clearly documented:
"diag has four distinct usag
I would say it is a mis-feature. If the 'x' argument of diag() is a
vector of length 1, then it creates an identity matrix of that size,
instead of creating a 1x1 matrix with the given value:
❯ diag(3)
[,1] [,2] [,3]
[1,]100
[2,]010
[3,]001
Of course this
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,] -10
[2,]01
> diag(-1)
Error in
On 17 September 2018 at 07:09, Duncan Murdoch wrote:
| I would not assume that shell behaviour in Windows and Unix would always
| be the same. A better comparison would be to list some other command on
| the same system that behaves differently. For example, on MacOS I see
|
| $ echo 'ls()
|
On 16/09/2018 4:53 AM, Voeten, C.C. wrote:
Hello,
I have found what I believe to be a bug in the Linux version of the Rscript
binary.
Under Windows (official 64-bit 3.5.1 R distribution running on an up-to-date
Win10), I can do the following (e.g. under powershell):
PS H:\Users\Cesko> Rscript
Same on Mac:
$ Rscript -e 'ls()
> ls()'
ARGUMENT 'ls()' __ignored__
character(0)
as well as using “\n” as a line separator:
$ Rscript -e 'ls()\nls()'
ARGUMENT 'ls()' __ignored__
character(0)
> On 16 Sep 2018, at 10:53, Voeten, C.C. wrote:
>
> Rscript -e 'ls()
--
Rainer M. Krug, PhD
Hello,
I have found what I believe to be a bug in the Linux version of the Rscript
binary.
Under Windows (official 64-bit 3.5.1 R distribution running on an up-to-date
Win10), I can do the following (e.g. under powershell):
PS H:\Users\Cesko> Rscript -e 'ls()
>> ls()'
character(0)
character(0)