Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| habrok:examples:r [2025/06/11 12:07] – Use R syntax highlighting pedro | habrok:examples:r [2025/06/11 12:15] (current) – [Multiple CPUs] lint pedro | ||
|---|---|---|---|
| Line 10: | Line 10: | ||
| # Simple t-test between two equally large groups. | # Simple t-test between two equally large groups. | ||
| # Let us generate some data. | # Let us generate some data. | ||
| - | apples <- rnorm(20, | + | apples <- rnorm(20, mean = 1.5, sd = .1) |
| - | pears <- rnorm(20, | + | pears <- rnorm(20, mean = 1.6, sd = .1) |
| - | print(t.test(pears, | + | print(t.test(pears, |
| </ | </ | ||
| Line 86: | Line 86: | ||
| cpu <- Sys.getenv(" | cpu <- Sys.getenv(" | ||
| - | hosts <- rep(" | + | hosts <- rep(" |
| cl <- makeCluster(hosts, | cl <- makeCluster(hosts, | ||
| # Create random matrices. | # Create random matrices. | ||
| n <- 5000 | n <- 5000 | ||
| - | A <- matrix(rnorm(n^2), | + | A <- matrix(rnorm(n^2), |
| - | B <- matrix(rnorm(n^2), | + | B <- matrix(rnorm(n^2), |
| # Single core time of matrix multiplication of matrices | # Single core time of matrix multiplication of matrices | ||