# if using VSCode may been
#install.packages("languageserver")
hist(mtcars$mpg)
How can we make our lessons a bit more interactive??
You can define sections in your quarto using html.
# if using VSCode may been
#install.packages("languageserver")
hist(mtcars$mpg)
Write a function to convert map scale. For example, on a 1:25,000 map (good for hiking!) the distance between two points is 15 cm. How far apart are these in real life? (3750 m).
[Reminder: 15 cm * 25000 = 375000 cm = 3750 m]
Your function should take as input two numbers: the distance on the map (in cm) and the second number of the scale and, i.e. calculate_distance(15, 25000) should return 375000
#Declare the name of the function
# this is not a R example - but you get the idea!
def calculate_distance(distance_cm,scale):
'''calculates distance based on map and scale
returns: z
inputs: distance_cm,scale
distance_cm and scale are two integers
returns the product of distance_cm and scale
'''
return(distance_cm * scale)All materials copyright Sydney Informatics Hub, University of Sydney