234k views
6 votes
Using state.area a vector measuring the area of

each U.S. state in square miles, find which values are
greater than or equal to 100,000 but less than 200,000.
Assign a logical vector for this comparison called
gt_100k as your answer.
R programming language

User Mockee
by
7.6k points

1 Answer

5 votes

Step-by-step explanation:

The second way to index vectors is with logical vectors. A logical vector is a vector that only contains TRUE and FALSE values. In R, true values are designated with TRUE, and false values with FALSE. When you index a vector with a logical vector, R will return values of the vector for which the indexing vector is TRUE. If that was confusing, think about it this way: a logical vector, combined with the brackets [ ], acts as a filter for the vector it is indexing. It only lets values of the vector pass through for which the logical vector is TRUE.

User Ian Robinson
by
8.3k points

No related questions found