documents:111012rtricks
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revision | |||
| documents:111012rtricks [2016/05/24 12:46] – external edit 127.0.0.1 | documents:111012rtricks [2020/11/26 07:08] (current) – kota | ||
|---|---|---|---|
| Line 4: | Line 4: | ||
| When you import data from the out put of other software, you might have trailing 0s at the end of each column: | When you import data from the out put of other software, you might have trailing 0s at the end of each column: | ||
| - | < | + | <code:R> |
| > d0 | > d0 | ||
| [1] 69.444 70.889 86.667 95.667 83.444 78.333 67.889 | [1] 69.444 70.889 86.667 95.667 83.444 78.333 67.889 | ||
| Line 18: | Line 18: | ||
| </ | </ | ||
| To remove them, there could be many ways, but here is my one liner. | To remove them, there could be many ways, but here is my one liner. | ||
| - | <code R> | + | <code:R> |
| d0c <- d0[rev(cumsum(rev(d0)))> | d0c <- d0[rev(cumsum(rev(d0)))> | ||
| </ | </ | ||
| Line 34: | Line 34: | ||
| ===== Plotting a matrix data as a color-coded image ===== | ===== Plotting a matrix data as a color-coded image ===== | ||
| - | <sxh> | + | <code:R> |
| #a 2Dplot, color coded. | #a 2Dplot, color coded. | ||
| x <- c(1:20) | x <- c(1:20) | ||
| Line 49: | Line 49: | ||
| mat <- list(x, y, z) | mat <- list(x, y, z) | ||
| image(x, y, z) | image(x, y, z) | ||
| - | </sxh> | + | </code> |
| [{{: | [{{: | ||
| ... a bit faster way calculation wise uses indexing. | ... a bit faster way calculation wise uses indexing. | ||
| - | <sxh> | + | <code:R> |
| width <- 10 | width <- 10 | ||
| height <- 20 | height <- 20 | ||
| Line 76: | Line 76: | ||
| return (all) | return (all) | ||
| } | } | ||
| - | </sxh> | + | </code> |
| ===== Inserting math formula & symbols in label or title ===== | ===== Inserting math formula & symbols in label or title ===== | ||
documents/111012rtricks.1464094015.txt.gz · Last modified: 2016/05/24 12:46 by 127.0.0.1
