[Rd] collapsing list of NULLs dimnames into a NULL

2016-06-10 Thread Hervé Pagès
Hi, Here are two different ways to create a 0 x 0 logical matrix: m1 <- matrix(nrow=0, ncol=0) m1 # <0 x 0 matrix> m2 <- as.matrix(data.frame()) m2 # <0 x 0 matrix> Surprisingly: identical(m1, m2) # [1] FALSE That's because of their dimnames: dimnames(m1) # NULL dimna

[Rd] typosquatting and trojan horses in packages

2016-06-10 Thread Ben Bolker
A friend passed along this interesting link: http://incolumitas.com/2016/06/08/typosquatting-package-managers/ about the strategy of using "typosquatting" (packages with very similar names to existing packages) to trick users into downloading/installing packages with malicious code). They made fak

[Rd] as.array() on a data.frame

2016-06-10 Thread Hervé Pagès
Wouldn't it make sense to have as.array() work on a data.frame and be equivalent to as.matrix()? df <- data.frame(stuff=1:3) # as.matrix(df) # stuff # [1,] 1 # [2,] 2 # [3,] 3 as.array(df) # Error in `dimnames<-.data.frame`(`*tmp*`, value = list(n)) : # inva