R

in costruzione

Working Directory default (Windows)

Modifico il link nella taskbar nel seguente modo png

Enviroment

1
2
# version
version
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
               _                           
platform       x86_64-w64-mingw32          
arch           x86_64                      
os             mingw32                     
system         x86_64, mingw32             
status                                     
major          4                           
minor          0.0                         
year           2020                        
month          04                          
day            24                          
svn rev        78286                       
language       R                           
version.string R version 4.0.0 (2020-04-24)
nickname       Arbor Day                   
1
2
# session info
sessionInfo()
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
R version 4.0.0 (2020-04-24)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18363)

Matrix products: default

locale:
[1] LC_COLLATE=Italian_Italy.1252  LC_CTYPE=Italian_Italy.1252   
[3] LC_MONETARY=Italian_Italy.1252 LC_NUMERIC=C                  
[5] LC_TIME=Italian_Italy.1252    

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

loaded via a namespace (and not attached):
 [1] compiler_4.0.0  IRdisplay_0.7.0 pbdZMQ_0.3-4    tools_4.0.0    
 [5] htmltools_0.5.0 pillar_1.4.4    base64enc_0.1-3 crayon_1.3.4   
 [9] uuid_0.1-4      IRkernel_1.1.1  jsonlite_1.6.1  digest_0.6.25  
[13] repr_1.1.0      rlang_0.4.6     evaluate_0.14  
1
2
# env info (mostra tutti i path)
Sys.getenv()
1
2
3
# default lib path
.libPaths()
# .libPaths('~/R/win-library/4.0') per aggiungere path specifico alla sessione
1
2
'C:/Users/nomeUtente/Documents/R/win-library/4.0'
'C:/Program Files/R/R-4.0.0/library'
1
2
# numero librerie nell'attuale path
nrow(installed.packages())
1
141
1
2
# path R
R.home()
1
'C:/PROGRA~1/R/R-40~1.0'

multicore testing

1
2
3
4
5
6
7
8
library('parallel')
testFun <- function(x, size){
  set.seed(1)
  sum(rnorm(size))
}
cl <- makeCluster(detectCores())
system.time(clusterApply(cl, 1:1000, testFun, size=1e6))
stopCluster(cl)

utili

Divisione in classi

1
as.character(cut(X, breaks=c(-Inf, 17, 34, 64, 74, Inf), labels=c("[1] 0-17", "[2] 18-34", "[3] 35-64", "[4] 65-74", "[5] 75+"), right = TRUE))