[Rd] svd(X, LINPACK=TRUE) alters its input

William Dunlap wdunlap at tibco.com
Thu Dec 6 16:32:33 CET 2012


Ordinary functions should not alter their inputs but in R-2.15.2
svd(LINPACK=TRUE,X) does.  (It worked in 2.15.0 but not in 2.15.1
or 2.15.2 and became deprecated in 2.15.2.)

> X <- matrix(c(1,2,3, 5,7,11, 13,17,19), 3, 3)
> X
     [,1] [,2] [,3]
[1,]    1    5   13
[2,]    2    7   17
[3,]    3   11   19
> svd(X, LINPACK=TRUE)$d
[1] 31.9718214  2.3882717  0.3143114
Warning message:
In svd(X, LINPACK = TRUE) : LINPACK = TRUE is deprecated
> X
          [,1]        [,2]        [,3]
[1,] 1.2672612 -13.8975846 -27.7951692
[2,] 0.5345225   1.0945920   2.1072825
[3,] 0.8017837   0.9955161  -0.9794695
> version
               _                            
platform       x86_64-w64-mingw32           
arch           x86_64                       
os             mingw32                      
system         x86_64, mingw32              
status                                      
major          2                            
minor          15.2                         
year           2012                         
month          10                           
day            26                           
svn rev        61015                        
language       R                            
version.string R version 2.15.2 (2012-10-26)
nickname       Trick or Treat  
> sessionInfo()
R version 2.15.2 (2012-10-26)
Platform: x86_64-w64-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=English_United States.1252 
[2] LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base                  

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com



More information about the R-devel mailing list