Save a list of plots from environment in R

I want to save all my plots from my R environment with ggsave(). How can I save list of plots from environment in R and then use the list as input to ggsave() ? I got some plots with cars from here to illustrate: PlotA <- ggplot(mtcars, aes(x=hp, y=mpg, color=cyl, shape=cyl)) + geom_point(size=3) PlotB <-… Read More Save a list of plots from environment in R

How to customize bar plot color using base barplot in R

data(iris) barplot(iris$Sepal.Length, col = iris$Species) The default colors are black, red, and green. How can I change these colors to, say, yellow, blue, orange? For the 3 iris species, respectively? >Solution : Create a named vector of colors and match the species with the vector’s names. Use this to index the colors vector. data(iris) colrs… Read More How to customize bar plot color using base barplot in R

R Error: <index> contains invalid column names

I am following this tutorial here https://rpubs.com/brandonkopp/creating-a-treemap-in-r on data visualization. Since the dataset used for this tutorial is no longer available, I learned how to obtain this dataset in the last question I asked (Finding a Dataset That Is No Longer Available?): outlays <- read.csv(‘https://web.archive.org/web/20160705194932if_/https://www.whitehouse.gov/sites/default/files/omb/budget/fy2017/assets/outlays.csv&#8217;) str(data) From here, I am now trying to follow the… Read More R Error: <index> contains invalid column names