title: Copying a histogram from screen device to png in R
body: <p>I have used the following code to copy a histogram I created to a png file in my working directory:</p>
  
  <pre><code>    ## STEP 5: Drawing a histogram, using the Global_active_power variable
  hist(tidyFile$Global_active_power, main = "Global Active Power", xlab = "Global Active Power (kilowatts)", ylab = "Frequency", col = "red")
  par(mar= c(4, 4, 2, 1))
  
  ## STEP 6: Copy to png file
  dev.copy(png, filename = "plot1.png", width = 480, height = 480, units = "px", bg = "white")
  </code></pre>
  
  <p>What is returned by R is the following:</p>
  
  <pre><code>quartz_off_screen 
              6 
  </code></pre>
  
  <p>When I check my working directory folder, the new png file was not created/copied. Only my plot1.R file is found, but no .png file. </p>
  
  <p>What am I doing wrong?</p>