notes/r.md

50 lines
1.1 KiB
Markdown
Raw Permalink Normal View History

2023-01-12 17:33:50 -05:00
installation
---------------------------------------
* to install R on ubuntu can to [r download page](https://cran.r-project.org/)
* there are instruction on what to add to sources.list.
* After doing apt-get update, will probably need to add the public key which is addressed [here](https://askubuntu.com/questions/13065/how-do-i-fix-the-gpg-error-no-pubkey#15272)
* then do `sudo apt-get install r-base`
using grid.arrange
https://cran.r-project.org/web/packages/gridExtra/vignettes/arrangeGrob.html
set and mirror axis limits:
```
scale_y_continuous(
breaks=seq(glob$PriceMin, glob$PriceMax, round(glob$StdDev * .5,2)),
limits = c(glob$PriceMin, glob$PriceMax)
) +
```
how to loop through rows of a column
```
for (i in dim1) {
for (j in i) {
print(j);
}
}
```
build a list of plots and use grid.arrange
```
do.call(grid.arrange,plot_list)
```
re-sort a dataframe and print each row of a column
```
dim1 <- dim1[order(dim1$list),];
for (i in dim1) {
for (j in i) {
print(j);
}
}
```
to run a script from the command line
`R --vanilla < scriptfile.R`
2023-03-02 14:32:05 -05:00
listing of R colors:
http://www.endmemo.com/r/color.php