Write a R program to create a factor corresponding to height of women data set, which contains height and weights for a sample of women.
data = women print("Women data set of height and weights:") print(data) height_f = cut(women$height,3) print("Factor corresponding to height:") print(table(height_f))
Sample Output:
[1] "Women data set of height and weights:" height weight 1 58 115 2 59 117 3 60 120 4 61 123 5 62 126 6 63 129 7 64 132 8 65 135 9 66 139 10 67 142 11 68 146 12 69 150 13 70 154 14 71 159 15 72 164 [1] "Factor corresponding to height:" height_f (58,62.7] (62.7,67.3] (67.3,72] 5 5 5
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
Sample Output:
[1] "Women data set of height and weights:" height weight 1 58 115 2 59 117 3 60 120 4 61 123 5 62 126 6 63 129 7 64 132 8 65 135 9 66 139 10 67 142 11 68 146 12 69 150 13 70 154 14 71 159 15 72 164 [1] "Factor corresponding to height:" height_f (58,62.7] (62.7,67.3] (67.3,72] 5 5 5need an explanation for this answer? contact us directly to get an explanation for this answer