Software Tools for Earth and Environmental Science

– 11th WEEK –

Emir Toker

14/11/2019

R Promgramming - Part 2

  • Syllabus and Book
  • DataCamp Class
  • Practice - Assessment Test
  • R Advance - ncdf4 & RNetCDF Packages

Coffee Break

  • R Elemantary Statistics
  • Basic Data Visualization

QUIZ

  • Next Week

Syllabus and Book

Syllabus

Book

Book

DataCamp Class

DataCamp Class

LINK

Practice - Assessment Test

Practice - Assessment Test

  1. Open Your R-Studio :)
  2. Create a new “R Project”
  3. Create a new “R Script” file and save it
  4. Learn your Working Directory
  5. Check files, under your working directory
  6. Create a vector with four numeric elements using seq()
  7. Assign it to a new variable (vec1)
  8. Check the length of vector
  9. Calculate the mean of vector
  10. Coerce your numeric vector to characteristic vector
  11. Check the class of your new vetcor
  12. Print the second element of your vector
  13. Change the second element as “TRUE”, assign it as vec1

Practice - Assessment Test

  1. Create a new vector with 12 elements using runif()
  2. Assign it as vec2
  3. Create a new matrix, 3 rows, 4 columns using this vector
  4. Assign this matrix as a new variable
  5. Check dimensions of this matrix
  6. Create a new matrix (4x4) with using vec1 and vec2
  7. Explain what is happening (bycol or byrow)
  8. Create the same matrix again, this time with byrow=T
  9. Assign it as mat1
  10. Create a new array with 4 rows, 4 columns and 2 layers using mat1
  11. Assign it as arr1
  12. Select 2nd row, 3rd column and change it with NA for each layers

Practice - Assessment Test

  1. Go to main web page of our course
  2. Copy this data : Istanbul_Cekmekoy_Omerli_26072017-29072017_15min - txt
  3. Paste your “Download” folder
  4. Turn back to R Studio
  5. Read the station data, be careful about file path, header and seperator
  6. Assign it as sta_data
  7. Check the structure and attributes of sta_data
  8. Print and plot precipiptation of sta_data
  9. Write a condition; if total precipitation is higher than zero than print “Weather was rainy”
  10. Install & load “ncdf4”, “RNetCDF” and “ggplot2” packages

NETCDF

NETCDF - Data and Packages

LINK

R Elemantary Statistics

R Elemantary Statistics

R Elemantary Statistics

LINK

Basic Data Visualization

Basic Data Visualization

LINK