Due date : 29 Now 2019, 18:00


Objectives

Hints : You can use these functions and the main web page of our course - LINK

getwd()
setwd()
list.files()
file.path()

read.csv()
read.delim()
read.table()

attributes()
attr()
colMeans()
plot()

if (condition) {

} else {

}

Instructions

PART-1 Manage Directory, Find and Read Data

  1. Go to main webpage of course
  2. Open Data “Istanbul_Goztepe_Mean_Temperature_1839-2013_Monthly” (.dat) LINK
  3. Copy and Paste it in your “Downloads” directory in a text file with “.dat” extension
  4. Open your R Studio

WAY 1 - GO TO FILE

  1. Check your Project Name and your Working directory
  2. Go to “Downloads” directory in R Studio
  3. List files and Read Data with three different read functions (read.csv(), read.delim(), read.table() )
  4. Choose the best
  5. Assign your data as “temp_1”

WAY 2 - CALL THE FILE

  1. Go Back to your Working directory
  2. Define your file path with file.path()
  3. Assign the path a new variable as “path_my_file”
  4. Use your best read() function
  5. Read the file with “path_my_file”
  6. Assign your data as “temp_2”

WAY 3 - IMPORT THE FILE

  1. Use “Import Datase”
  2. Assign your data as “temp_3”

WAY 4 - DOWNLOAD THE FILE

  1. Copy the LINK of data
  2. Use your best read() function
  3. Read the file with this function and LINK
  4. Assign your data as “temp_4”

Last step

  1. Choose your favorite " temp_1 or _2 or _3 or _4" and assign as just “temp

PART-2 Play with the Data

Meet with the Data

  1. Look at structure
  2. Learn attributes and dimensions
  3. Rename attributes

Clear NA and Choose Colomn

  1. Print “temp”
  2. Delete rows which include NA ( na.omit() )
  3. Assign it as “temp_b”
  4. Select summer season
  5. Assign it as “temp_b_summer”

Use Condition Statements - if

  1. Compare June Mean Temperature and July Mean Temperature
  2. IF June Mean Temperature is LOWER than July then print “June has LOWER Mean Temperature.”

Use Condition Statements - else

  1. ELSE print “June has HIGHER Mean Temperature”
  2. Calculate mean of each month ( colMeans() )

Plot

  1. Plot temperature for June
  2. Add title and unit
  3. Edit x-axis, which years are they ?
  4. What about July and August ? Plot them.
  5. Is there any strangeness thing, what do you think ? Compare three plots.

For questions or problems, please use Ninova


LS0tCnRpdGxlOiAiU29m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