I'm running the latest stable versions of RStudio and R, and have long been using Export-> Save as Image (above the plot viewer). However, a current project requires me to create code that runs itself and outputs image files.
I have a list of words and frequencies, and have produced a wordcloud (library(wordcloud),library(wordcloud2)) with the following code:
wordcloud2(data=TweetData,size=1.6,color='random-dark')
Of course, this produces an image in the viewer, but now I need to save the image on my local drive (as png, jpg, etc.). I tried the following code:
png("tweetdata.png")
wordcloud2(data=TweetData,size=1.6,color='random-dark')
dev.off()
but nothing happens -- no file is saved anywhere (I searched in the wd directory as well as my entire computer. Dev.off() simpy returns "Rstudio GD2" or "NULL DEVICE 1." What is going wrong? I've also tried lots of other variations of this method, ex: dev.new(), etc.