Write the logical expression to extract blood.glucose greater
than 10 and short.velocity
greater than 1.5 in the thuesen data set (Using
R)
ANSWER:
The code and output is given below:
> library(ISwR)
> data<-thuesen
> data
blood.glucose short.velocity
1 15.3 1.76
2 10.8 1.34
3 8.1 1.27
4 19.5 1.47
5 7.2 1.27
6 5.3 1.49
7 9.3 1.31
8 11.1 1.09
9 7.5 1.18
10 12.2 1.22
11 6.7 1.25
12 5.2 1.19
13 19.0 1.95
14 15.1 1.28
15 6.7 1.52
16 8.6 NA
17 4.2 1.12
18 10.3 1.37
19 12.5 1.19
20 16.1 1.05
21 13.3 1.32
22 4.9 1.03
23 8.8 1.12
24 9.5 1.70
>
> # Extract blood.glucose greater than 10
>
>
> data$blood.glucose[which(data$blood.glucose>10)]
[1] 15.3 10.8 19.5 11.1 12.2 19.0 15.1 10.3 12.5 16.1 13.3
>
> # Extract short.velocity greater than 10
>
> data$short.velocity[which(data$short.velocity>1.5)]
[1] 1.76 1.95 1.52 1.70
Get Answers For Free
Most questions answered within 1 hours.