Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Download the following data: weather.csv (source https://www.kaggle.com/zaraavagyan/weathercsv/downloads/weathercsv.zip/1).

  2. Copy the downloaded file into your project folder.

  3. Import the data. You have two options:

  4. Import the data using one of these options:

    1. Using the Files tool of R Studio (Botton right of the screen), find the downloaded file. Click on the file and select import Dataset…. Change the name to weather_file and click on Import.

    2. Alternatively, on the Environment (top right corner), click on the Import dataset option. Select the second option (i.e., From Text (readr). Use the Browse utility to find and select weather.csv. Change the name to weather_file and click on Import.

  5. A second data frame should have been created in the Environment. Open the new data frame in a new tab and explore the data.

Practice - Extracting some information from a data frame.

  1. Let’s show the humidity and temperatures for Monday; humidity3pm type weather[ 1 ,13].

  2. Let’s show the first 3 rows of the data frame: type weather[1:3,]

  3. Let’s show all the temperatures; type weather[,3]

  4. Let’s show the first two columns of the data frame; type weather[,1:2]

  5. Type weather[1:3,1:2]. The first 3 rows and first two columns are shown.

  6. Show the values of the last three rows.

  7. Show the values of the second column.

  8. Show the values of last three rows and the second column.

  9. Try other combinations of your own.

...