By using R language do the following for the following data : Question1 Part1 -Calculate the mean age for females and males and correlation coefficient between weights and lengths - Several types of correlation coefficients exist. Go to the help of the cor() function and find which correlation coefficient is calculated by default. -Add the appropriate argument to the cor() function in the previous command so that the Spearman correlation is calculated instead.
"id" "surgery" "sex" "age" "weight" "length" "BMIpre" "BMIpost" "complic" "comorb" "depressi" "diabetes" "SES"
1 0 "Female" NA NA NA NA NA NA 0 0 0 1
2 0 "Female" 63 94 1,63 35,3795777 26,34649403 1 0 0 0 3
3 0 "Female" 29 74 1,57 30,02150189 NA 1 0 0 0 1
4 0 "Female" 32 112 1,67 40,15920255 25,4580659 0 0 0 0 1
5 0 "Female" 33 92 1,66 33,38655828 23,22543185 0 1 0 0 2
6 0 "Female" 33 108 1,55 44,95317378 NA 0 0 0 0 3
7 0 "Female" 41 70 1,62 26,6727633 NA 0 0 0 0 2
8 1 "Female" 20 102 1,76 32,92871901 25,82644628 0 0 0 0 3
9 1 "Female" 33 150 1,77 47,87896198 34,47285263 1 1 1 0 1
10 1 "Female" 37 113 1,69 39,56444102 30,28605441 1 1 0 0 1
11 1 "Female" 42 149 1,7 51,55709343 37,37024221 0 1 0 0 2
12 0 "Male" 52 128 1,8 39,50617284 30,86419753 1 0 0 0 3
13 0 "Male" 50 100 1,74 33,02946228 NA 0 0 0 0 1
14 0 "Male" 17 NA NA NA NA 0 1 0 0 2
15 0 "Male" 45 117 1,9 32,4099723 NA 1 0 0 0 2
16 0 "Male" 26 145 1,82 43,77490641 33,8123415 0 0 0 0 3
17 0 "Male" 54 128 1,8 39,50617284 NA 0 0 0 0 1
18 0 "Male" 26 142 1,87 40,60739512 NA 0 0 0 0 1
19 1 "Male" 36 145 1,8 44,75308642 NA 0 1 0 0 3
20 1 "Male" 41 150 1,78 47,34250726 36,92715566 1 0 0 0 1
21 1 "Male" 33 180 1,83 53,74899221 29,86055123 1 1 0 0 2
22 1 "Male" 41 118 1,72 39,88642509 22,98539751 1 1 0 0 2
By using R language do the following for the following data :
Question1
Part1
-Calculate the mean age for females and males and correlation coefficient between weights and lengths
- Several types of correlation coefficients exist. Go to the help of the cor() function and find which correlation coefficient is calculated by default.
-Add the appropriate argument to the cor() function in the previous command so that the Spearman correlation is calculated instead.
Part2
-What is the maximum value of weight in the entire dataset?
- How many missing values are there for age?
- What is the mean value for BMIpre for the two surgical techniques (variable surgery)?
Step by step
Solved in 4 steps with 2 images