logo

Crowdly

Which package is used to manipulate your data, such as adding columns or computi...

✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.

Which package is used to manipulate your data, such as adding columns or computing summaries?

Which function would you use to:

  • compute a new column for your dataset?
  • reduce multiple values down to a single summary?
  • pick variables based on their names?
  • pick observations based on their values?
  • changes the ordering of the rows?

The ChickWeight dataset provides the weight chicks on 4 different diets as they age. The weight column is the chick’s body weight in grams, Time is their age in days, Chick is an identifier of each chick, and Diet is the experimental diet given to that chick.

as_tibble(ChickWeight)

## # A tibble: 578 x 4

## weight Time Chick Diet

## <dbl> <dbl> <ord> <fct>

## 1 42 0 1 1

## 2 51 2 1 1

## 3 59 4 1 1

## 4 64 6 1 1

## 5 76 8 1 1

## 6 93 10 1 1

## 7 106 12 1 1

## 8 125 14 1 1

## 9 149 16 1 1

## 10 171 18 1 1

## # i 568 more rows

Complete the code to compute the weight of each chick at 21 days old:

FinalChickWeight <- as_tibble(ChickWeight) |>

( == )

## # A tibble: 45 x 4

## weight Time Chick Diet

## <dbl> <dbl> <ord> <fct>

## 1 205 21 1 1

## 2 215 21 2 1

## 3 202 21 3 1

## 4 157 21 4 1

## 5 223 21 5 1

## 6 157 21 6 1

## 7 305 21 7 1

## 8 98 21 9 1

## 9 124 21 10 1

## 10 175 21 11 1

## # i 35 more rows

Complete the code to compute the average weight of 21 day old chicks for each diet type:

FinalChickWeight |>

(

) |>

(())

## # A tibble: 4 x 2

## Diet `mean(weight)`

## <fct> <dbl>

## 1 1 178.

## 2 2 215.

## 3 3 270.

## 4 4 239.

More questions like this

Want instant access to all verified answers on learning.monash.edu?

Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!