Question: Question 2 . b # Create a function area _ to _ the _ left, which takes a single variable # ( x 1 )

Question 2.b
# Create a function "area_to_the_left", which takes a single variable
# (x1) and calculates the area to the left, returning a value between
# 0 and 1. The basic setup of the function is defined below. Note that
# you will need to use a slightly different equation if x1 is less than or
# greater than 3.
# Hint: for a triangle with height H and base B, the height of the subtriangle
# with width Y% of B is Y% of H.
area_to_the_left<-function(x1){
if(x1<0){
# Area to the left of 0(or less) is 0.
return(0)
} else if (x1<3){
#Edit this part
return(NA)
} else if (x1<5){
#Edit this part
return(NA)
} else {
# Area to the left of 5(or more) is 1.
return(1)
}
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!