#*****************************************************************************80 # ## nile_histogram plots a histogram of yearly flood levels for the Nile. # # Licensing: # # This code is distributed under the MIT license. # # Modified: # # 27 February 2020 # # Author: # # John Burkardt # cat ( '\n' ) cat ( 'nile_histogram:\n' ) cat ( " ", version$version.string, "\n" ) cat ( ' Make a histogram of yearly Nile flood levels.\n' ) filename = "nile_data.txt" data <- read.table ( filename, header = FALSE ) print ( data[1:5,1:2] ) m = dim ( data )[1] n = dim ( data )[2] cat ( '\n' ) cat ( ' ', m, ' x ', n, ' data records read from file.\n' ) # # For simplicity, copy column 2 and call it "height". # height = data[,2] filename = "nile_histogram.png" png ( filename ) hist ( height, main = 'Yearly Nile Flood Height', xlab = '<-- Height of Nile at Maximum Flood -->', ylab = '<-- Frequency -->', col = 'blue', breaks = 20 ) grid ( 10, 10 ) cat ( ' Graphics saved as "', filename, '"\n' ) # # Terminate. # cat ( "\n" ) cat ( "nile_histogram:\n" ) cat ( " Normal end of execution.\n" ) quit ( )