- Create a numeric object called
number with a number of
your choice. (1 pt)
number = 7
number
## [1] 7
- Use a logical operator to check if
number is less than
62. (1 pt)
number = 27
Y = number < 62
# where Y will be TRUE if number is less than 62 otherwise FALSE
Y
## [1] TRUE
- Create a numeric vector called
v with the following
elements: 5, 2, \(\pi\), 8, 4.3, \(e^3\). (1 pt)
v <- c( 5, 2, pi, 8, 4.3, exp(1)^3)
v
## [1] 5.000000 2.000000 3.141593 8.000000 4.300000 20.085537
- Use arithmetic operators to find the area of a sphere that has a
radius of
number. (1 pt)
4*pi*number^2
## [1] 9160.884
- Use operators to create a vector of TRUE/FALSE values that
correspond to the components of vector
v that are between 2
and 4. (1 pt)
(v>2) & (v<4)
## [1] FALSE FALSE TRUE FALSE FALSE FALSE
- Describe two different types of operators in your own words. (1
pt)
# Arithmetic operators: They are used to perform basic mathematical operations. They operate on numerical values and include operations such as addition, subtraction, multiplication, division.
# Logrithmic operators: They are used to perform logical operations, typically on boolean values (true or false). for example && for 'and' , || for 'or'.
- Please fill out the following survey: https://forms.gle/bfSPuNcT5S41JLKYA (1.5 pts)
# I have filled the followind survey