Please download the answer file and edit it on Rstudio. Write your student number in the correct place at the beginning of the answer file. When you finish, send the answers.R
file to the answers’ mailbox. All questions are independent and can be answered in any order.
x
, with two elements, called weight
and group
, with the values shown below. Then you must show the content of x
. If everything is right, you should get something like this:## $weight
## [1] 4.17 5.18 4.50 5.17 5.33 4.81 4.41 5.87 6.03 4.32 6.31 5.54 5.37 4.92 5.80
##
## $group
## [1] ctrl ctrl ctrl ctrl ctrl trt1 trt1 trt1 trt1 trt1 trt2 trt2 trt2 trt2 trt2
## Levels: ctrl trt1 trt2
# replace all this line (including the `#` symbol) with your answer
x$weights
, except the third one.## [1] 4.17 5.18 5.17 5.33 4.81 4.41 5.87 6.03 4.32 6.31 5.54 5.37 4.92 5.80
# replace all this line (including the `#` symbol) with your answer
x$weight
only for the cases where group
is equal to "trt1"
.## [1] 5.088
# replace all this line (including the `#` symbol) with your answer
x$group
of the element whose x$weight
is equal to the median of all x$weight
.## [1] ctrl
## Levels: ctrl trt1 trt2
# replace all this line (including the `#` symbol) with your answer
For this question we will use data about several countries evaluated in the year 2007. The homework Rmd document includes a data frame called world
with columns representing some demographic values for each country. You do not need to write it again.
world
.## [1] "population" "continent" "life_exp"
# replace all this line (including the `#` symbol) with your answer
Write the command to find how many lines are there in the world
data frame
## [1] 142
# replace all this line (including the `#` symbol) with your answer
world
.## population continent life_exp
## Afghanistan 31889923 Asia 43.828
## Albania 3600523 Europe 76.423
## Algeria 33333216 Africa 72.301
## Angola 12420476 Africa 42.731
## Argentina 40301927 Americas 75.320
# replace all this line (including the `#` symbol) with your answer
## population continent life_exp
## Turkey 71158647 Europe 71.777
# replace all this line (including the `#` symbol) with your answer
continent
column.##
## Africa Americas Asia Europe Oceania
## 52 25 33 30 2
# replace all this line (including the `#` symbol) with your answer
## population continent life_exp
## China 1318683096 Asia 72.961
## India 1110396331 Asia 64.698
## Indonesia 223547000 Asia 70.650
## United States 301139947 Americas 78.242
# replace all this line (including the `#` symbol) with your answer
Africa
with all the rows of world
where continent=='Africa'
. Show the result of summary(Africa)
## population continent life_exp
## Min. : 199579 Africa :52 Min. :39.61
## 1st Qu.: 2909226 Americas: 0 1st Qu.:47.83
## Median : 10093310 Asia : 0 Median :52.93
## Mean : 17875763 Europe : 0 Mean :54.81
## 3rd Qu.: 19363654 Oceania : 0 3rd Qu.:59.44
## Max. :135031164 Max. :76.44
# replace all this line (including the `#` symbol) with your answer
## [1] 135031164
# replace all this line (including the `#` symbol) with your answer
## population continent life_exp
## Nigeria 135031164 Africa 46.859
# replace all this line (including the `#` symbol) with your answer
life_exp
column of the country which population is the minimum.# replace all this line (including the `#` symbol) with your answer
## [1] 65.528