Related to R code. Question: Write a function called temp_categorizer that takes one argument ‘temperature’ and returns the following:         - a value of “hot” if temperature is greater or equal to 90   - a value of "warm" if temperature is greater than 60 but less than 90   - a value of "cold" if temperature is more than 32 but less than 60   - a value of "freezing" if temperature is 32 or below And also Use the following vector for problem number : sentence <- c("Learning", "loops", "in", "R", "is", "not", "that", "bad") Create a loop that: loops over the range of possible word lengths displays a message detailing the words that match the length For example: at length 8, the loop should state that the word "Learning" has 8 letters Hints: Use the function nchar() which gives the number of letters in each word. • Example: try nchar(sentence) min() and max() may help you specify a range

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter16: Searching, Sorting And Vector Type
Section: Chapter Questions
Problem 20PE
icon
Related questions
Question

Related to R code.

Question: Write a function called temp_categorizer that takes one argument ‘temperature’ and returns the following:      

  - a value of “hot” if temperature is greater or equal to 90

  - a value of "warm" if temperature is greater than 60 but less than 90

  - a value of "cold" if temperature is more than 32 but less than 60

  - a value of "freezing" if temperature is 32 or below

And also Use the following vector for problem number :

sentence <- c("Learning", "loops", "in", "R", "is", "not", "that", "bad")

Create a loop that:

  • loops over the range of possible word lengths
  • displays a message detailing the words that match the length
  • For example: at length 8, the loop should state that the word "Learning" has 8 letters

Hints:

  • Use the function nchar() which gives the number of letters in each word. • Example: try nchar(sentence)
  • min() and max() may help you specify a range

 

 

 

 

 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
User Defined DataType
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,