### ==================== lab 1: basic R ====================
### This is your first lab.  Write the code that performs
### the following tasks underneath each comment.
### Always ensure that your code produces output!
### You'll see it at the end if you compile the report
## What is your name?  Assign this to variable 'name'
name <- "Ott"  # this does not produce output, you need the following line:
name  # this produces output
## [1] "Ott"
## What is your favorite place you'd like to be?  Assign it to
## a suitable named variable
"A warm and sunny place"  # wrong: not assigned to a variable
## [1] "A warm and sunny place"
dreamPlace <- "A warm and sunny place"  # this is assignment
dreamPlace  # and this is output
## [1] "A warm and sunny place"
### 1. ---------- compute ----------

## Convert degrees F to degrees C
## The formula is c = (f - 32)/1.8

## What is the temperature today?  Assign it to a variable 'fahrenheit'
fahrenheit <- 59 

## Compute temperature in C and assign it to variable 'centigrade'
C <- (fahrenheit - 32)/1.8
centigrade <- C

## Print the output with an informative message.
cat("Today's temperature is", centigrade, "centigrade.") 
## Today's temperature is 15 centigrade.
## Convert feet, inches to meters
## 1 foot is 0.3048 m
## 1 in is 0.0254 m

## create a variable 'feet' which is your heigh in feet (no inches here)
## e.g. it may be 5
feet <- 5

## create a variable 'inches' which is the inch part of your height
## e.g. it may be 3, if you are 5'3"
inch <- 2
## compute variable 'meters' that is your height in meters
meters <- 0.3048 * feet + 0.0254 * inch
## print this with an informative message (use 'cat')
cat("my height is", meters)
## my height is 1.5748
## Create a variable `puppies` equal to the number of puppies you'd like to
## have

## Create a variable `price`, which is how expensive you think a puppy is

## Create a variable `total` that has the total cost of all of your
## puppies

## Create a variable `max_puppies`, which is the number of puppies you can
## afford for $1K.  Compute this in R, not just assign!
## Hint: use integer division %/%


### 2. ---------- text ----------

## Create a variable `hometown` that stores the city in which you were born

## Assign your name to the variable `name`

## Print a message where you tell your name and where you are from.
## But use the values in variables to print it.
## The output should be like "My name is Ott and I am from Tartu".


## 2. ----- Logical variables

## Create a boolean variable `too.expensive`, set to true if the cost
## of all puppies you want is greater than $1,000

## Now let's do weather forecast:
## assign 'true' or 'false' to a variable named 'I_saw_raindrops'

I_saw_raindrops <- FALSE
## assign 'true' or 'false' to a variable named 'my_shoes_are_wet'

my_shoes_are_wet <- FALSE
## assign 'true' or 'false' to a variable named 'my_professor_is_soaked'
my_professor_is_soaked <- FALSE
## compute chance of rain in Seattle today: add all these three variables and
forcast <- I_saw_raindrops + my_shoes_are_wet + my_professor_is_soaked /3
## divide by 3.  Print the result with an informative message (use `cat()`).
cat("The probability of rain today is", forcast)
## The probability of rain today is 0
## Reminder: the result should be between 0 and 1!
## Finally, compile your work as html report and submit on canvas!
## You can compile it from the menu: File > Compile Report...
## It is not graded, but this is how you need to submit graded work.