Actividad 1

1

set.seed(2016)
e=rlnorm(n=120,meanlog=5,sdlog=0.85)
options(digits=4)
e
##   [1]   68.20  347.60  141.46  190.98   13.84  116.71   77.56   82.91  202.76
##  [10]  173.39  102.81  116.82  463.24   68.73  575.75  197.11   70.42  359.60
##  [19]   81.73   81.96  103.93   85.07  112.60  246.18  172.90   63.25   85.64
##  [28]  466.56  388.19   59.46   63.79  138.09  422.20   41.41  155.29  468.85
##  [37]   72.77   74.83   97.31   41.80  139.03  220.22  114.00   87.24  312.49
##  [46]  116.98   50.18  958.23  302.29   34.78  129.69   69.67   17.50   56.95
##  [55]  169.50   37.27  595.25   51.61  111.70  105.89  270.38  263.52   93.08
##  [64]   91.89  222.64  482.58  118.35   57.50  106.00  300.29  335.77  199.82
##  [73]   29.22  144.80  143.79  294.42  179.98  317.87  146.86  108.44  234.35
##  [82]  231.80  235.32   73.88   41.88  809.09   92.11  262.39  118.37  176.91
##  [91]  466.61  245.16   54.16  278.23  109.60   90.34  170.51  115.71   21.42
## [100]  421.25  253.31   48.54   62.11  546.92  195.69  343.63 1051.11 1395.43
## [109]  176.88  411.21  162.91 1346.12  106.82  185.29  752.57  143.07  231.49
## [118]  743.48  592.20   56.97

2

set.seed(2016)
e=rbinom(n=120,size=20,prob=0.8)
e
##   [1] 18 18 14 18 16 18 16 14 20 19 17 17 17 14 17 17 15 18 16 18 17 15 17 16 14
##  [26] 16 18 16 13 16 15 14 18 14 14 18 17 17 17 15 17 18 17 15 17 17 15 17 16 16
##  [51] 18 16 17 17 14 16 14 19 18 17 18 16 16 18 14 14 19 18 16 14 14 13 18 15 17
##  [76] 19 17 14 19 18 16 18 15 14 17 18 17 15 14 16 17 15 18 15 12 18 15 16 19 17
## [101] 16 18 18 17 20 16 18 16 16 18 19 15 13 14 18 16 17 17 17 12

3

set.seed(2016)
e=rpois(n=120,lambda=10.5)
e
##   [1]  7  6 11 13 14  9 19  9 14  7  9 13 14  7  8  6  9 12 11  7  9 10  5  7  7
##  [26]  5 14 15 12  5  5  7  9  8 10 12 12  6  4  7 16  6 15  6  8 12 12  8  6 14
##  [51]  9  6 10  7 11  4 11 11 12 10 10  9  6 12 12  7  4  8 10 11  8 12  6  6  8
##  [76]  9 18 12 11 12 10 10 11 13  8 19 11 14 10 18  9 11 16 10 12 16 15  6 13 10
## [101] 11  7  4 14 14  8 10  9 10 10 12 11 11  5 12  9 11 10 11  6

4

set.seed(2016)
seq(1,300,1)
##   [1]   1   2   3   4   5   6   7   8   9  10  11  12  13  14  15  16  17  18
##  [19]  19  20  21  22  23  24  25  26  27  28  29  30  31  32  33  34  35  36
##  [37]  37  38  39  40  41  42  43  44  45  46  47  48  49  50  51  52  53  54
##  [55]  55  56  57  58  59  60  61  62  63  64  65  66  67  68  69  70  71  72
##  [73]  73  74  75  76  77  78  79  80  81  82  83  84  85  86  87  88  89  90
##  [91]  91  92  93  94  95  96  97  98  99 100 101 102 103 104 105 106 107 108
## [109] 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
## [127] 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144
## [145] 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162
## [163] 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180
## [181] 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198
## [199] 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216
## [217] 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234
## [235] 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252
## [253] 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270
## [271] 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288
## [289] 289 290 291 292 293 294 295 296 297 298 299 300
sample.int(seq(300,300),120, replace = TRUE)
##   [1]  32 152  50  62 267 172 252 104 294 175 170 150 197 229 190 187  54 179
##  [19] 242  16 113 107  98  65  26 103  32  68 251 167  21 296 264  61   3   2
##  [37] 268 272 214  72  42 207  22  83 247   6 100 119 265 124 299 101  72 234
##  [55]  19 122 122  25 131  21  20 163 120 242 264 214 288 154 117 215 228 262
##  [73] 295 297 266  57  52  90  52 141 250 176 157 123 189 291 158  92 216  58
##  [91] 201 184 225  28 264 209 292  32 244 150 251  41 297  17  85 216  47 155
## [109]  52 133 144 235  38  62  98  36 235 283 133   3

5

library(purrr)
set.seed(2016)
bernoulli=rbernoulli(120,0.75)
ifelse(bernoulli==TRUE,'presente','ausente')
##   [1] "ausente"  "ausente"  "presente" "ausente"  "presente" "ausente" 
##   [7] "presente" "presente" "ausente"  "ausente"  "presente" "presente"
##  [13] "ausente"  "presente" "ausente"  "presente" "presente" "ausente" 
##  [19] "presente" "ausente"  "presente" "presente" "presente" "presente"
##  [25] "presente" "presente" "ausente"  "presente" "presente" "presente"
##  [31] "presente" "presente" "ausente"  "presente" "presente" "ausente" 
##  [37] "ausente"  "presente" "ausente"  "presente" "presente" "ausente" 
##  [43] "presente" "presente" "presente" "presente" "presente" "presente"
##  [49] "presente" "presente" "ausente"  "presente" "presente" "presente"
##  [55] "presente" "presente" "presente" "ausente"  "ausente"  "presente"
##  [61] "ausente"  "presente" "presente" "ausente"  "presente" "presente"
##  [67] "ausente"  "ausente"  "presente" "presente" "presente" "presente"
##  [73] "ausente"  "presente" "ausente"  "ausente"  "presente" "presente"
##  [79] "ausente"  "ausente"  "presente" "ausente"  "presente" "presente"
##  [85] "presente" "ausente"  "presente" "presente" "presente" "presente"
##  [91] "presente" "presente" "ausente"  "presente" "presente" "ausente" 
##  [97] "presente" "presente" "ausente"  "presente" "presente" "ausente" 
## [103] "ausente"  "presente" "ausente"  "presente" "ausente"  "presente"
## [109] "presente" "ausente"  "ausente"  "presente" "presente" "presente"
## [115] "ausente"  "presente" "presente" "presente" "presente" "presente"

6

set.seed(2016)
gl(n=3,k=40, labels = c("S", "PA", "MA"))
##   [1] S  S  S  S  S  S  S  S  S  S  S  S  S  S  S  S  S  S  S  S  S  S  S  S  S 
##  [26] S  S  S  S  S  S  S  S  S  S  S  S  S  S  S  PA PA PA PA PA PA PA PA PA PA
##  [51] PA PA PA PA PA PA PA PA PA PA PA PA PA PA PA PA PA PA PA PA PA PA PA PA PA
##  [76] PA PA PA PA PA MA MA MA MA MA MA MA MA MA MA MA MA MA MA MA MA MA MA MA MA
## [101] MA MA MA MA MA MA MA MA MA MA MA MA MA MA MA MA MA MA MA MA
## Levels: S PA MA

7

set.seed(2016)
x<-runif(n=120, min=0, max=1.2)
ifelse(x<0.5, yes="FO",no="FI")
##   [1] "FO" "FO" "FI" "FO" "FI" "FO" "FI" "FI" "FO" "FO" "FO" "FO" "FO" "FI" "FO"
##  [16] "FO" "FI" "FO" "FI" "FO" "FO" "FI" "FO" "FI" "FI" "FI" "FO" "FI" "FI" "FI"
##  [31] "FI" "FI" "FO" "FI" "FI" "FO" "FO" "FO" "FO" "FI" "FO" "FO" "FO" "FI" "FO"
##  [46] "FO" "FI" "FO" "FI" "FI" "FO" "FO" "FO" "FO" "FI" "FI" "FI" "FO" "FO" "FO"
##  [61] "FO" "FI" "FI" "FO" "FI" "FI" "FO" "FO" "FI" "FI" "FI" "FI" "FO" "FI" "FO"
##  [76] "FO" "FO" "FI" "FO" "FO" "FI" "FO" "FI" "FI" "FO" "FO" "FO" "FI" "FI" "FI"
##  [91] "FO" "FI" "FO" "FI" "FI" "FO" "FI" "FI" "FO" "FO" "FI" "FO" "FO" "FO" "FO"
## [106] "FI" "FO" "FI" "FI" "FO" "FO" "FI" "FI" "FI" "FO" "FI" "FO" "FO" "FO" "FI"

Actividad 2.1

a

set.seed(2016)
biomasa<-rlnorm(n=120,meanlog=5,sdlog=0.85)
options(digits=4)

Biomasa_dt<-data.frame(biomasa)
colnames(Biomasa_dt)=c("Gramos")
Biomasa_dt
##      Gramos
## 1     68.20
## 2    347.60
## 3    141.46
## 4    190.98
## 5     13.84
## 6    116.71
## 7     77.56
## 8     82.91
## 9    202.76
## 10   173.39
## 11   102.81
## 12   116.82
## 13   463.24
## 14    68.73
## 15   575.75
## 16   197.11
## 17    70.42
## 18   359.60
## 19    81.73
## 20    81.96
## 21   103.93
## 22    85.07
## 23   112.60
## 24   246.18
## 25   172.90
## 26    63.25
## 27    85.64
## 28   466.56
## 29   388.19
## 30    59.46
## 31    63.79
## 32   138.09
## 33   422.20
## 34    41.41
## 35   155.29
## 36   468.85
## 37    72.77
## 38    74.83
## 39    97.31
## 40    41.80
## 41   139.03
## 42   220.22
## 43   114.00
## 44    87.24
## 45   312.49
## 46   116.98
## 47    50.18
## 48   958.23
## 49   302.29
## 50    34.78
## 51   129.69
## 52    69.67
## 53    17.50
## 54    56.95
## 55   169.50
## 56    37.27
## 57   595.25
## 58    51.61
## 59   111.70
## 60   105.89
## 61   270.38
## 62   263.52
## 63    93.08
## 64    91.89
## 65   222.64
## 66   482.58
## 67   118.35
## 68    57.50
## 69   106.00
## 70   300.29
## 71   335.77
## 72   199.82
## 73    29.22
## 74   144.80
## 75   143.79
## 76   294.42
## 77   179.98
## 78   317.87
## 79   146.86
## 80   108.44
## 81   234.35
## 82   231.80
## 83   235.32
## 84    73.88
## 85    41.88
## 86   809.09
## 87    92.11
## 88   262.39
## 89   118.37
## 90   176.91
## 91   466.61
## 92   245.16
## 93    54.16
## 94   278.23
## 95   109.60
## 96    90.34
## 97   170.51
## 98   115.71
## 99    21.42
## 100  421.25
## 101  253.31
## 102   48.54
## 103   62.11
## 104  546.92
## 105  195.69
## 106  343.63
## 107 1051.11
## 108 1395.43
## 109  176.88
## 110  411.21
## 111  162.91
## 112 1346.12
## 113  106.82
## 114  185.29
## 115  752.57
## 116  143.07
## 117  231.49
## 118  743.48
## 119  592.20
## 120   56.97

b

set.seed(2016)
flores.r=rbinom(n=120,size=20,prob=0.8)

Flores.r_dt<-data.frame(flores.r)
colnames(Flores.r_dt)=c("Conteo de flores en tres ramas")
Flores.r_dt
##     Conteo de flores en tres ramas
## 1                               18
## 2                               18
## 3                               14
## 4                               18
## 5                               16
## 6                               18
## 7                               16
## 8                               14
## 9                               20
## 10                              19
## 11                              17
## 12                              17
## 13                              17
## 14                              14
## 15                              17
## 16                              17
## 17                              15
## 18                              18
## 19                              16
## 20                              18
## 21                              17
## 22                              15
## 23                              17
## 24                              16
## 25                              14
## 26                              16
## 27                              18
## 28                              16
## 29                              13
## 30                              16
## 31                              15
## 32                              14
## 33                              18
## 34                              14
## 35                              14
## 36                              18
## 37                              17
## 38                              17
## 39                              17
## 40                              15
## 41                              17
## 42                              18
## 43                              17
## 44                              15
## 45                              17
## 46                              17
## 47                              15
## 48                              17
## 49                              16
## 50                              16
## 51                              18
## 52                              16
## 53                              17
## 54                              17
## 55                              14
## 56                              16
## 57                              14
## 58                              19
## 59                              18
## 60                              17
## 61                              18
## 62                              16
## 63                              16
## 64                              18
## 65                              14
## 66                              14
## 67                              19
## 68                              18
## 69                              16
## 70                              14
## 71                              14
## 72                              13
## 73                              18
## 74                              15
## 75                              17
## 76                              19
## 77                              17
## 78                              14
## 79                              19
## 80                              18
## 81                              16
## 82                              18
## 83                              15
## 84                              14
## 85                              17
## 86                              18
## 87                              17
## 88                              15
## 89                              14
## 90                              16
## 91                              17
## 92                              15
## 93                              18
## 94                              15
## 95                              12
## 96                              18
## 97                              15
## 98                              16
## 99                              19
## 100                             17
## 101                             16
## 102                             18
## 103                             18
## 104                             17
## 105                             20
## 106                             16
## 107                             18
## 108                             16
## 109                             16
## 110                             18
## 111                             19
## 112                             15
## 113                             13
## 114                             14
## 115                             18
## 116                             16
## 117                             17
## 118                             17
## 119                             17
## 120                             12

c

set.seed(2016)
flores.d=rpois(n=120,lambda=10.5)

Flores.d_dt<-data.frame(flores.d)
colnames(Flores.d_dt)=c("Conteo de flores desprendidas")
Flores.d_dt
##     Conteo de flores desprendidas
## 1                               7
## 2                               6
## 3                              11
## 4                              13
## 5                              14
## 6                               9
## 7                              19
## 8                               9
## 9                              14
## 10                              7
## 11                              9
## 12                             13
## 13                             14
## 14                              7
## 15                              8
## 16                              6
## 17                              9
## 18                             12
## 19                             11
## 20                              7
## 21                              9
## 22                             10
## 23                              5
## 24                              7
## 25                              7
## 26                              5
## 27                             14
## 28                             15
## 29                             12
## 30                              5
## 31                              5
## 32                              7
## 33                              9
## 34                              8
## 35                             10
## 36                             12
## 37                             12
## 38                              6
## 39                              4
## 40                              7
## 41                             16
## 42                              6
## 43                             15
## 44                              6
## 45                              8
## 46                             12
## 47                             12
## 48                              8
## 49                              6
## 50                             14
## 51                              9
## 52                              6
## 53                             10
## 54                              7
## 55                             11
## 56                              4
## 57                             11
## 58                             11
## 59                             12
## 60                             10
## 61                             10
## 62                              9
## 63                              6
## 64                             12
## 65                             12
## 66                              7
## 67                              4
## 68                              8
## 69                             10
## 70                             11
## 71                              8
## 72                             12
## 73                              6
## 74                              6
## 75                              8
## 76                              9
## 77                             18
## 78                             12
## 79                             11
## 80                             12
## 81                             10
## 82                             10
## 83                             11
## 84                             13
## 85                              8
## 86                             19
## 87                             11
## 88                             14
## 89                             10
## 90                             18
## 91                              9
## 92                             11
## 93                             16
## 94                             10
## 95                             12
## 96                             16
## 97                             15
## 98                              6
## 99                             13
## 100                            10
## 101                            11
## 102                             7
## 103                             4
## 104                            14
## 105                            14
## 106                             8
## 107                            10
## 108                             9
## 109                            10
## 110                            10
## 111                            12
## 112                            11
## 113                            11
## 114                             5
## 115                            12
## 116                             9
## 117                            11
## 118                            10
## 119                            11
## 120                             6

d

set.seed(2016)
seq(1,300,1)
##   [1]   1   2   3   4   5   6   7   8   9  10  11  12  13  14  15  16  17  18
##  [19]  19  20  21  22  23  24  25  26  27  28  29  30  31  32  33  34  35  36
##  [37]  37  38  39  40  41  42  43  44  45  46  47  48  49  50  51  52  53  54
##  [55]  55  56  57  58  59  60  61  62  63  64  65  66  67  68  69  70  71  72
##  [73]  73  74  75  76  77  78  79  80  81  82  83  84  85  86  87  88  89  90
##  [91]  91  92  93  94  95  96  97  98  99 100 101 102 103 104 105 106 107 108
## [109] 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
## [127] 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144
## [145] 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162
## [163] 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180
## [181] 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198
## [199] 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216
## [217] 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234
## [235] 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252
## [253] 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270
## [271] 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288
## [289] 289 290 291 292 293 294 295 296 297 298 299 300
hojas.d=sample.int(seq(300,300),120, replace = TRUE)

Hojas.d_dt<-data.frame(hojas.d)
colnames(Hojas.d_dt)=c("Conteo de hojas desprendidas")
Hojas.d_dt
##     Conteo de hojas desprendidas
## 1                             32
## 2                            152
## 3                             50
## 4                             62
## 5                            267
## 6                            172
## 7                            252
## 8                            104
## 9                            294
## 10                           175
## 11                           170
## 12                           150
## 13                           197
## 14                           229
## 15                           190
## 16                           187
## 17                            54
## 18                           179
## 19                           242
## 20                            16
## 21                           113
## 22                           107
## 23                            98
## 24                            65
## 25                            26
## 26                           103
## 27                            32
## 28                            68
## 29                           251
## 30                           167
## 31                            21
## 32                           296
## 33                           264
## 34                            61
## 35                             3
## 36                             2
## 37                           268
## 38                           272
## 39                           214
## 40                            72
## 41                            42
## 42                           207
## 43                            22
## 44                            83
## 45                           247
## 46                             6
## 47                           100
## 48                           119
## 49                           265
## 50                           124
## 51                           299
## 52                           101
## 53                            72
## 54                           234
## 55                            19
## 56                           122
## 57                           122
## 58                            25
## 59                           131
## 60                            21
## 61                            20
## 62                           163
## 63                           120
## 64                           242
## 65                           264
## 66                           214
## 67                           288
## 68                           154
## 69                           117
## 70                           215
## 71                           228
## 72                           262
## 73                           295
## 74                           297
## 75                           266
## 76                            57
## 77                            52
## 78                            90
## 79                            52
## 80                           141
## 81                           250
## 82                           176
## 83                           157
## 84                           123
## 85                           189
## 86                           291
## 87                           158
## 88                            92
## 89                           216
## 90                            58
## 91                           201
## 92                           184
## 93                           225
## 94                            28
## 95                           264
## 96                           209
## 97                           292
## 98                            32
## 99                           244
## 100                          150
## 101                          251
## 102                           41
## 103                          297
## 104                           17
## 105                           85
## 106                          216
## 107                           47
## 108                          155
## 109                           52
## 110                          133
## 111                          144
## 112                          235
## 113                           38
## 114                           62
## 115                           98
## 116                           36
## 117                          235
## 118                          283
## 119                          133
## 120                            3

e

library(purrr)
set.seed(2016)
Plaga=bernoulli=rbernoulli(120,0.75)

plaga_dt<-data.frame(Plaga)
ifelse(data.frame(Plaga)==TRUE,'presente','ausente')
##        Plaga     
##   [1,] "ausente" 
##   [2,] "ausente" 
##   [3,] "presente"
##   [4,] "ausente" 
##   [5,] "presente"
##   [6,] "ausente" 
##   [7,] "presente"
##   [8,] "presente"
##   [9,] "ausente" 
##  [10,] "ausente" 
##  [11,] "presente"
##  [12,] "presente"
##  [13,] "ausente" 
##  [14,] "presente"
##  [15,] "ausente" 
##  [16,] "presente"
##  [17,] "presente"
##  [18,] "ausente" 
##  [19,] "presente"
##  [20,] "ausente" 
##  [21,] "presente"
##  [22,] "presente"
##  [23,] "presente"
##  [24,] "presente"
##  [25,] "presente"
##  [26,] "presente"
##  [27,] "ausente" 
##  [28,] "presente"
##  [29,] "presente"
##  [30,] "presente"
##  [31,] "presente"
##  [32,] "presente"
##  [33,] "ausente" 
##  [34,] "presente"
##  [35,] "presente"
##  [36,] "ausente" 
##  [37,] "ausente" 
##  [38,] "presente"
##  [39,] "ausente" 
##  [40,] "presente"
##  [41,] "presente"
##  [42,] "ausente" 
##  [43,] "presente"
##  [44,] "presente"
##  [45,] "presente"
##  [46,] "presente"
##  [47,] "presente"
##  [48,] "presente"
##  [49,] "presente"
##  [50,] "presente"
##  [51,] "ausente" 
##  [52,] "presente"
##  [53,] "presente"
##  [54,] "presente"
##  [55,] "presente"
##  [56,] "presente"
##  [57,] "presente"
##  [58,] "ausente" 
##  [59,] "ausente" 
##  [60,] "presente"
##  [61,] "ausente" 
##  [62,] "presente"
##  [63,] "presente"
##  [64,] "ausente" 
##  [65,] "presente"
##  [66,] "presente"
##  [67,] "ausente" 
##  [68,] "ausente" 
##  [69,] "presente"
##  [70,] "presente"
##  [71,] "presente"
##  [72,] "presente"
##  [73,] "ausente" 
##  [74,] "presente"
##  [75,] "ausente" 
##  [76,] "ausente" 
##  [77,] "presente"
##  [78,] "presente"
##  [79,] "ausente" 
##  [80,] "ausente" 
##  [81,] "presente"
##  [82,] "ausente" 
##  [83,] "presente"
##  [84,] "presente"
##  [85,] "presente"
##  [86,] "ausente" 
##  [87,] "presente"
##  [88,] "presente"
##  [89,] "presente"
##  [90,] "presente"
##  [91,] "presente"
##  [92,] "presente"
##  [93,] "ausente" 
##  [94,] "presente"
##  [95,] "presente"
##  [96,] "ausente" 
##  [97,] "presente"
##  [98,] "presente"
##  [99,] "ausente" 
## [100,] "presente"
## [101,] "presente"
## [102,] "ausente" 
## [103,] "ausente" 
## [104,] "presente"
## [105,] "ausente" 
## [106,] "presente"
## [107,] "ausente" 
## [108,] "presente"
## [109,] "presente"
## [110,] "ausente" 
## [111,] "ausente" 
## [112,] "presente"
## [113,] "presente"
## [114,] "presente"
## [115,] "ausente" 
## [116,] "presente"
## [117,] "presente"
## [118,] "presente"
## [119,] "presente"
## [120,] "presente"

f

set.seed(2016)
Status=gl(n=3,k=40, labels = c("S", "PA", "MA"))

Status_dt=data.frame(Status)
Status_dt
##     Status
## 1        S
## 2        S
## 3        S
## 4        S
## 5        S
## 6        S
## 7        S
## 8        S
## 9        S
## 10       S
## 11       S
## 12       S
## 13       S
## 14       S
## 15       S
## 16       S
## 17       S
## 18       S
## 19       S
## 20       S
## 21       S
## 22       S
## 23       S
## 24       S
## 25       S
## 26       S
## 27       S
## 28       S
## 29       S
## 30       S
## 31       S
## 32       S
## 33       S
## 34       S
## 35       S
## 36       S
## 37       S
## 38       S
## 39       S
## 40       S
## 41      PA
## 42      PA
## 43      PA
## 44      PA
## 45      PA
## 46      PA
## 47      PA
## 48      PA
## 49      PA
## 50      PA
## 51      PA
## 52      PA
## 53      PA
## 54      PA
## 55      PA
## 56      PA
## 57      PA
## 58      PA
## 59      PA
## 60      PA
## 61      PA
## 62      PA
## 63      PA
## 64      PA
## 65      PA
## 66      PA
## 67      PA
## 68      PA
## 69      PA
## 70      PA
## 71      PA
## 72      PA
## 73      PA
## 74      PA
## 75      PA
## 76      PA
## 77      PA
## 78      PA
## 79      PA
## 80      PA
## 81      MA
## 82      MA
## 83      MA
## 84      MA
## 85      MA
## 86      MA
## 87      MA
## 88      MA
## 89      MA
## 90      MA
## 91      MA
## 92      MA
## 93      MA
## 94      MA
## 95      MA
## 96      MA
## 97      MA
## 98      MA
## 99      MA
## 100     MA
## 101     MA
## 102     MA
## 103     MA
## 104     MA
## 105     MA
## 106     MA
## 107     MA
## 108     MA
## 109     MA
## 110     MA
## 111     MA
## 112     MA
## 113     MA
## 114     MA
## 115     MA
## 116     MA
## 117     MA
## 118     MA
## 119     MA
## 120     MA

g

set.seed(2016)
Fertilizacion=x<-runif(n=120, min=0, max=1.2)
x
##   [1] 0.216196 0.171532 1.009976 0.160290 0.573003 0.145510 0.739958 1.068657
##   [9] 0.003148 0.064151 0.466425 0.327544 0.267096 1.051889 0.296003 0.471945
##  [17] 0.771862 0.158156 0.687120 0.106719 0.399510 0.822657 0.466944 0.672675
##  [25] 1.091679 0.718872 0.219092 0.734665 1.133562 0.514379 0.756898 0.985346
##  [33] 0.228262 1.054420 1.021319 0.177297 0.289657 0.337147 0.290904 0.808313
##  [41] 0.405067 0.118848 0.307576 0.803764 0.447160 0.329903 0.869037 0.374689
##  [49] 0.685562 0.581719 0.189378 0.497445 0.310611 0.448811 1.093313 0.597337
##  [57] 1.045212 0.068677 0.169117 0.455406 0.192317 0.601115 0.559443 0.206288
##  [65] 1.068777 1.028963 0.079890 0.111915 0.625508 1.054966 1.094420 1.132734
##  [73] 0.241041 0.824203 0.252290 0.078908 0.371706 1.049651 0.081605 0.198177
##  [81] 0.563256 0.193644 0.814518 0.990864 0.453781 0.240157 0.319149 0.755946
##  [89] 0.971367 0.639018 0.467689 0.867008 0.121250 0.834471 1.183068 0.118648
##  [97] 0.958426 0.633751 0.052709 0.429349 0.524363 0.211101 0.224180 0.377260
## [105] 0.007136 0.652337 0.155860 0.700789 0.674517 0.114343 0.062406 0.807558
## [113] 1.138656 1.047973 0.128397 0.628470 0.442854 0.382527 0.414732 1.162946
Fertilizacion_dt<-data.frame(Fertilizacion)
ifelse(Fertilizacion_dt<0.5, yes = "FO", no = "FI")
##        Fertilizacion
##   [1,] "FO"         
##   [2,] "FO"         
##   [3,] "FI"         
##   [4,] "FO"         
##   [5,] "FI"         
##   [6,] "FO"         
##   [7,] "FI"         
##   [8,] "FI"         
##   [9,] "FO"         
##  [10,] "FO"         
##  [11,] "FO"         
##  [12,] "FO"         
##  [13,] "FO"         
##  [14,] "FI"         
##  [15,] "FO"         
##  [16,] "FO"         
##  [17,] "FI"         
##  [18,] "FO"         
##  [19,] "FI"         
##  [20,] "FO"         
##  [21,] "FO"         
##  [22,] "FI"         
##  [23,] "FO"         
##  [24,] "FI"         
##  [25,] "FI"         
##  [26,] "FI"         
##  [27,] "FO"         
##  [28,] "FI"         
##  [29,] "FI"         
##  [30,] "FI"         
##  [31,] "FI"         
##  [32,] "FI"         
##  [33,] "FO"         
##  [34,] "FI"         
##  [35,] "FI"         
##  [36,] "FO"         
##  [37,] "FO"         
##  [38,] "FO"         
##  [39,] "FO"         
##  [40,] "FI"         
##  [41,] "FO"         
##  [42,] "FO"         
##  [43,] "FO"         
##  [44,] "FI"         
##  [45,] "FO"         
##  [46,] "FO"         
##  [47,] "FI"         
##  [48,] "FO"         
##  [49,] "FI"         
##  [50,] "FI"         
##  [51,] "FO"         
##  [52,] "FO"         
##  [53,] "FO"         
##  [54,] "FO"         
##  [55,] "FI"         
##  [56,] "FI"         
##  [57,] "FI"         
##  [58,] "FO"         
##  [59,] "FO"         
##  [60,] "FO"         
##  [61,] "FO"         
##  [62,] "FI"         
##  [63,] "FI"         
##  [64,] "FO"         
##  [65,] "FI"         
##  [66,] "FI"         
##  [67,] "FO"         
##  [68,] "FO"         
##  [69,] "FI"         
##  [70,] "FI"         
##  [71,] "FI"         
##  [72,] "FI"         
##  [73,] "FO"         
##  [74,] "FI"         
##  [75,] "FO"         
##  [76,] "FO"         
##  [77,] "FO"         
##  [78,] "FI"         
##  [79,] "FO"         
##  [80,] "FO"         
##  [81,] "FI"         
##  [82,] "FO"         
##  [83,] "FI"         
##  [84,] "FI"         
##  [85,] "FO"         
##  [86,] "FO"         
##  [87,] "FO"         
##  [88,] "FI"         
##  [89,] "FI"         
##  [90,] "FI"         
##  [91,] "FO"         
##  [92,] "FI"         
##  [93,] "FO"         
##  [94,] "FI"         
##  [95,] "FI"         
##  [96,] "FO"         
##  [97,] "FI"         
##  [98,] "FI"         
##  [99,] "FO"         
## [100,] "FO"         
## [101,] "FI"         
## [102,] "FO"         
## [103,] "FO"         
## [104,] "FO"         
## [105,] "FO"         
## [106,] "FI"         
## [107,] "FO"         
## [108,] "FI"         
## [109,] "FI"         
## [110,] "FO"         
## [111,] "FO"         
## [112,] "FI"         
## [113,] "FI"         
## [114,] "FI"         
## [115,] "FO"         
## [116,] "FI"         
## [117,] "FO"         
## [118,] "FO"         
## [119,] "FO"         
## [120,] "FI"

Actividad 2.2

a

gramos=rlnorm(n=120,meanlog=5,sdlog=0.85)
options(digits=4)

dim.data.frame(Biomasa_dt)
## [1] 120   1
str(gramos)
##  num [1:120] 270.4 263.5 93.1 91.9 222.6 ...
class(gramos)
## [1] "numeric"
names(Biomasa_dt)
## [1] "Gramos"
is.na(Biomasa_dt)
##        Gramos
##   [1,]  FALSE
##   [2,]  FALSE
##   [3,]  FALSE
##   [4,]  FALSE
##   [5,]  FALSE
##   [6,]  FALSE
##   [7,]  FALSE
##   [8,]  FALSE
##   [9,]  FALSE
##  [10,]  FALSE
##  [11,]  FALSE
##  [12,]  FALSE
##  [13,]  FALSE
##  [14,]  FALSE
##  [15,]  FALSE
##  [16,]  FALSE
##  [17,]  FALSE
##  [18,]  FALSE
##  [19,]  FALSE
##  [20,]  FALSE
##  [21,]  FALSE
##  [22,]  FALSE
##  [23,]  FALSE
##  [24,]  FALSE
##  [25,]  FALSE
##  [26,]  FALSE
##  [27,]  FALSE
##  [28,]  FALSE
##  [29,]  FALSE
##  [30,]  FALSE
##  [31,]  FALSE
##  [32,]  FALSE
##  [33,]  FALSE
##  [34,]  FALSE
##  [35,]  FALSE
##  [36,]  FALSE
##  [37,]  FALSE
##  [38,]  FALSE
##  [39,]  FALSE
##  [40,]  FALSE
##  [41,]  FALSE
##  [42,]  FALSE
##  [43,]  FALSE
##  [44,]  FALSE
##  [45,]  FALSE
##  [46,]  FALSE
##  [47,]  FALSE
##  [48,]  FALSE
##  [49,]  FALSE
##  [50,]  FALSE
##  [51,]  FALSE
##  [52,]  FALSE
##  [53,]  FALSE
##  [54,]  FALSE
##  [55,]  FALSE
##  [56,]  FALSE
##  [57,]  FALSE
##  [58,]  FALSE
##  [59,]  FALSE
##  [60,]  FALSE
##  [61,]  FALSE
##  [62,]  FALSE
##  [63,]  FALSE
##  [64,]  FALSE
##  [65,]  FALSE
##  [66,]  FALSE
##  [67,]  FALSE
##  [68,]  FALSE
##  [69,]  FALSE
##  [70,]  FALSE
##  [71,]  FALSE
##  [72,]  FALSE
##  [73,]  FALSE
##  [74,]  FALSE
##  [75,]  FALSE
##  [76,]  FALSE
##  [77,]  FALSE
##  [78,]  FALSE
##  [79,]  FALSE
##  [80,]  FALSE
##  [81,]  FALSE
##  [82,]  FALSE
##  [83,]  FALSE
##  [84,]  FALSE
##  [85,]  FALSE
##  [86,]  FALSE
##  [87,]  FALSE
##  [88,]  FALSE
##  [89,]  FALSE
##  [90,]  FALSE
##  [91,]  FALSE
##  [92,]  FALSE
##  [93,]  FALSE
##  [94,]  FALSE
##  [95,]  FALSE
##  [96,]  FALSE
##  [97,]  FALSE
##  [98,]  FALSE
##  [99,]  FALSE
## [100,]  FALSE
## [101,]  FALSE
## [102,]  FALSE
## [103,]  FALSE
## [104,]  FALSE
## [105,]  FALSE
## [106,]  FALSE
## [107,]  FALSE
## [108,]  FALSE
## [109,]  FALSE
## [110,]  FALSE
## [111,]  FALSE
## [112,]  FALSE
## [113,]  FALSE
## [114,]  FALSE
## [115,]  FALSE
## [116,]  FALSE
## [117,]  FALSE
## [118,]  FALSE
## [119,]  FALSE
## [120,]  FALSE

b

conteodefloresentresramas=rbinom(n=120,size=20,prob=0.8)

dim.data.frame(Flores.r_dt)
## [1] 120   1
str(conteodefloresentresramas)
##  int [1:120] 14 17 17 14 16 14 14 19 19 17 ...
class(conteodefloresentresramas)
## [1] "integer"
names(Flores.r_dt)
## [1] "Conteo de flores en tres ramas"
is.na(Flores.r_dt)
##        Conteo de flores en tres ramas
##   [1,]                          FALSE
##   [2,]                          FALSE
##   [3,]                          FALSE
##   [4,]                          FALSE
##   [5,]                          FALSE
##   [6,]                          FALSE
##   [7,]                          FALSE
##   [8,]                          FALSE
##   [9,]                          FALSE
##  [10,]                          FALSE
##  [11,]                          FALSE
##  [12,]                          FALSE
##  [13,]                          FALSE
##  [14,]                          FALSE
##  [15,]                          FALSE
##  [16,]                          FALSE
##  [17,]                          FALSE
##  [18,]                          FALSE
##  [19,]                          FALSE
##  [20,]                          FALSE
##  [21,]                          FALSE
##  [22,]                          FALSE
##  [23,]                          FALSE
##  [24,]                          FALSE
##  [25,]                          FALSE
##  [26,]                          FALSE
##  [27,]                          FALSE
##  [28,]                          FALSE
##  [29,]                          FALSE
##  [30,]                          FALSE
##  [31,]                          FALSE
##  [32,]                          FALSE
##  [33,]                          FALSE
##  [34,]                          FALSE
##  [35,]                          FALSE
##  [36,]                          FALSE
##  [37,]                          FALSE
##  [38,]                          FALSE
##  [39,]                          FALSE
##  [40,]                          FALSE
##  [41,]                          FALSE
##  [42,]                          FALSE
##  [43,]                          FALSE
##  [44,]                          FALSE
##  [45,]                          FALSE
##  [46,]                          FALSE
##  [47,]                          FALSE
##  [48,]                          FALSE
##  [49,]                          FALSE
##  [50,]                          FALSE
##  [51,]                          FALSE
##  [52,]                          FALSE
##  [53,]                          FALSE
##  [54,]                          FALSE
##  [55,]                          FALSE
##  [56,]                          FALSE
##  [57,]                          FALSE
##  [58,]                          FALSE
##  [59,]                          FALSE
##  [60,]                          FALSE
##  [61,]                          FALSE
##  [62,]                          FALSE
##  [63,]                          FALSE
##  [64,]                          FALSE
##  [65,]                          FALSE
##  [66,]                          FALSE
##  [67,]                          FALSE
##  [68,]                          FALSE
##  [69,]                          FALSE
##  [70,]                          FALSE
##  [71,]                          FALSE
##  [72,]                          FALSE
##  [73,]                          FALSE
##  [74,]                          FALSE
##  [75,]                          FALSE
##  [76,]                          FALSE
##  [77,]                          FALSE
##  [78,]                          FALSE
##  [79,]                          FALSE
##  [80,]                          FALSE
##  [81,]                          FALSE
##  [82,]                          FALSE
##  [83,]                          FALSE
##  [84,]                          FALSE
##  [85,]                          FALSE
##  [86,]                          FALSE
##  [87,]                          FALSE
##  [88,]                          FALSE
##  [89,]                          FALSE
##  [90,]                          FALSE
##  [91,]                          FALSE
##  [92,]                          FALSE
##  [93,]                          FALSE
##  [94,]                          FALSE
##  [95,]                          FALSE
##  [96,]                          FALSE
##  [97,]                          FALSE
##  [98,]                          FALSE
##  [99,]                          FALSE
## [100,]                          FALSE
## [101,]                          FALSE
## [102,]                          FALSE
## [103,]                          FALSE
## [104,]                          FALSE
## [105,]                          FALSE
## [106,]                          FALSE
## [107,]                          FALSE
## [108,]                          FALSE
## [109,]                          FALSE
## [110,]                          FALSE
## [111,]                          FALSE
## [112,]                          FALSE
## [113,]                          FALSE
## [114,]                          FALSE
## [115,]                          FALSE
## [116,]                          FALSE
## [117,]                          FALSE
## [118,]                          FALSE
## [119,]                          FALSE
## [120,]                          FALSE

c

conteodefloresdesprendidas=rpois(n=120,lambda=10.5)

dim.data.frame(Flores.d_dt)
## [1] 120   1
str(conteodefloresdesprendidas)
##  int [1:120] 9 12 12 8 8 14 14 4 13 8 ...
class(conteodefloresdesprendidas)
## [1] "integer"
names(Flores.d_dt)
## [1] "Conteo de flores desprendidas"
is.na(Flores.d_dt)
##        Conteo de flores desprendidas
##   [1,]                         FALSE
##   [2,]                         FALSE
##   [3,]                         FALSE
##   [4,]                         FALSE
##   [5,]                         FALSE
##   [6,]                         FALSE
##   [7,]                         FALSE
##   [8,]                         FALSE
##   [9,]                         FALSE
##  [10,]                         FALSE
##  [11,]                         FALSE
##  [12,]                         FALSE
##  [13,]                         FALSE
##  [14,]                         FALSE
##  [15,]                         FALSE
##  [16,]                         FALSE
##  [17,]                         FALSE
##  [18,]                         FALSE
##  [19,]                         FALSE
##  [20,]                         FALSE
##  [21,]                         FALSE
##  [22,]                         FALSE
##  [23,]                         FALSE
##  [24,]                         FALSE
##  [25,]                         FALSE
##  [26,]                         FALSE
##  [27,]                         FALSE
##  [28,]                         FALSE
##  [29,]                         FALSE
##  [30,]                         FALSE
##  [31,]                         FALSE
##  [32,]                         FALSE
##  [33,]                         FALSE
##  [34,]                         FALSE
##  [35,]                         FALSE
##  [36,]                         FALSE
##  [37,]                         FALSE
##  [38,]                         FALSE
##  [39,]                         FALSE
##  [40,]                         FALSE
##  [41,]                         FALSE
##  [42,]                         FALSE
##  [43,]                         FALSE
##  [44,]                         FALSE
##  [45,]                         FALSE
##  [46,]                         FALSE
##  [47,]                         FALSE
##  [48,]                         FALSE
##  [49,]                         FALSE
##  [50,]                         FALSE
##  [51,]                         FALSE
##  [52,]                         FALSE
##  [53,]                         FALSE
##  [54,]                         FALSE
##  [55,]                         FALSE
##  [56,]                         FALSE
##  [57,]                         FALSE
##  [58,]                         FALSE
##  [59,]                         FALSE
##  [60,]                         FALSE
##  [61,]                         FALSE
##  [62,]                         FALSE
##  [63,]                         FALSE
##  [64,]                         FALSE
##  [65,]                         FALSE
##  [66,]                         FALSE
##  [67,]                         FALSE
##  [68,]                         FALSE
##  [69,]                         FALSE
##  [70,]                         FALSE
##  [71,]                         FALSE
##  [72,]                         FALSE
##  [73,]                         FALSE
##  [74,]                         FALSE
##  [75,]                         FALSE
##  [76,]                         FALSE
##  [77,]                         FALSE
##  [78,]                         FALSE
##  [79,]                         FALSE
##  [80,]                         FALSE
##  [81,]                         FALSE
##  [82,]                         FALSE
##  [83,]                         FALSE
##  [84,]                         FALSE
##  [85,]                         FALSE
##  [86,]                         FALSE
##  [87,]                         FALSE
##  [88,]                         FALSE
##  [89,]                         FALSE
##  [90,]                         FALSE
##  [91,]                         FALSE
##  [92,]                         FALSE
##  [93,]                         FALSE
##  [94,]                         FALSE
##  [95,]                         FALSE
##  [96,]                         FALSE
##  [97,]                         FALSE
##  [98,]                         FALSE
##  [99,]                         FALSE
## [100,]                         FALSE
## [101,]                         FALSE
## [102,]                         FALSE
## [103,]                         FALSE
## [104,]                         FALSE
## [105,]                         FALSE
## [106,]                         FALSE
## [107,]                         FALSE
## [108,]                         FALSE
## [109,]                         FALSE
## [110,]                         FALSE
## [111,]                         FALSE
## [112,]                         FALSE
## [113,]                         FALSE
## [114,]                         FALSE
## [115,]                         FALSE
## [116,]                         FALSE
## [117,]                         FALSE
## [118,]                         FALSE
## [119,]                         FALSE
## [120,]                         FALSE

d

conteodehojasdesprendidas=sample.int(seq(300,300),120, replace = TRUE)

dim.data.frame(Hojas.d_dt)
## [1] 120   1
str(conteodehojasdesprendidas)
##  int [1:120] 15 180 170 36 130 253 209 207 34 35 ...
class(conteodehojasdesprendidas)
## [1] "integer"
names(Hojas.d_dt)
## [1] "Conteo de hojas desprendidas"
is.na(Hojas.d_dt)
##        Conteo de hojas desprendidas
##   [1,]                        FALSE
##   [2,]                        FALSE
##   [3,]                        FALSE
##   [4,]                        FALSE
##   [5,]                        FALSE
##   [6,]                        FALSE
##   [7,]                        FALSE
##   [8,]                        FALSE
##   [9,]                        FALSE
##  [10,]                        FALSE
##  [11,]                        FALSE
##  [12,]                        FALSE
##  [13,]                        FALSE
##  [14,]                        FALSE
##  [15,]                        FALSE
##  [16,]                        FALSE
##  [17,]                        FALSE
##  [18,]                        FALSE
##  [19,]                        FALSE
##  [20,]                        FALSE
##  [21,]                        FALSE
##  [22,]                        FALSE
##  [23,]                        FALSE
##  [24,]                        FALSE
##  [25,]                        FALSE
##  [26,]                        FALSE
##  [27,]                        FALSE
##  [28,]                        FALSE
##  [29,]                        FALSE
##  [30,]                        FALSE
##  [31,]                        FALSE
##  [32,]                        FALSE
##  [33,]                        FALSE
##  [34,]                        FALSE
##  [35,]                        FALSE
##  [36,]                        FALSE
##  [37,]                        FALSE
##  [38,]                        FALSE
##  [39,]                        FALSE
##  [40,]                        FALSE
##  [41,]                        FALSE
##  [42,]                        FALSE
##  [43,]                        FALSE
##  [44,]                        FALSE
##  [45,]                        FALSE
##  [46,]                        FALSE
##  [47,]                        FALSE
##  [48,]                        FALSE
##  [49,]                        FALSE
##  [50,]                        FALSE
##  [51,]                        FALSE
##  [52,]                        FALSE
##  [53,]                        FALSE
##  [54,]                        FALSE
##  [55,]                        FALSE
##  [56,]                        FALSE
##  [57,]                        FALSE
##  [58,]                        FALSE
##  [59,]                        FALSE
##  [60,]                        FALSE
##  [61,]                        FALSE
##  [62,]                        FALSE
##  [63,]                        FALSE
##  [64,]                        FALSE
##  [65,]                        FALSE
##  [66,]                        FALSE
##  [67,]                        FALSE
##  [68,]                        FALSE
##  [69,]                        FALSE
##  [70,]                        FALSE
##  [71,]                        FALSE
##  [72,]                        FALSE
##  [73,]                        FALSE
##  [74,]                        FALSE
##  [75,]                        FALSE
##  [76,]                        FALSE
##  [77,]                        FALSE
##  [78,]                        FALSE
##  [79,]                        FALSE
##  [80,]                        FALSE
##  [81,]                        FALSE
##  [82,]                        FALSE
##  [83,]                        FALSE
##  [84,]                        FALSE
##  [85,]                        FALSE
##  [86,]                        FALSE
##  [87,]                        FALSE
##  [88,]                        FALSE
##  [89,]                        FALSE
##  [90,]                        FALSE
##  [91,]                        FALSE
##  [92,]                        FALSE
##  [93,]                        FALSE
##  [94,]                        FALSE
##  [95,]                        FALSE
##  [96,]                        FALSE
##  [97,]                        FALSE
##  [98,]                        FALSE
##  [99,]                        FALSE
## [100,]                        FALSE
## [101,]                        FALSE
## [102,]                        FALSE
## [103,]                        FALSE
## [104,]                        FALSE
## [105,]                        FALSE
## [106,]                        FALSE
## [107,]                        FALSE
## [108,]                        FALSE
## [109,]                        FALSE
## [110,]                        FALSE
## [111,]                        FALSE
## [112,]                        FALSE
## [113,]                        FALSE
## [114,]                        FALSE
## [115,]                        FALSE
## [116,]                        FALSE
## [117,]                        FALSE
## [118,]                        FALSE
## [119,]                        FALSE
## [120,]                        FALSE

e

Plagas=bernoulli=rbernoulli(120,0.75)


dim.data.frame(plaga_dt)
## [1] 120   1
str(ifelse(data.frame(Plagas)==TRUE,'presente','ausente'))
##  chr [1:120, 1] "presente" "presente" "presente" "presente" "ausente" ...
##  - attr(*, "dimnames")=List of 2
##   ..$ : NULL
##   ..$ : chr "Plagas"
class(Plagas)
## [1] "logical"
names(plaga_dt)
## [1] "Plaga"
is.na(plaga_dt)
##        Plaga
##   [1,] FALSE
##   [2,] FALSE
##   [3,] FALSE
##   [4,] FALSE
##   [5,] FALSE
##   [6,] FALSE
##   [7,] FALSE
##   [8,] FALSE
##   [9,] FALSE
##  [10,] FALSE
##  [11,] FALSE
##  [12,] FALSE
##  [13,] FALSE
##  [14,] FALSE
##  [15,] FALSE
##  [16,] FALSE
##  [17,] FALSE
##  [18,] FALSE
##  [19,] FALSE
##  [20,] FALSE
##  [21,] FALSE
##  [22,] FALSE
##  [23,] FALSE
##  [24,] FALSE
##  [25,] FALSE
##  [26,] FALSE
##  [27,] FALSE
##  [28,] FALSE
##  [29,] FALSE
##  [30,] FALSE
##  [31,] FALSE
##  [32,] FALSE
##  [33,] FALSE
##  [34,] FALSE
##  [35,] FALSE
##  [36,] FALSE
##  [37,] FALSE
##  [38,] FALSE
##  [39,] FALSE
##  [40,] FALSE
##  [41,] FALSE
##  [42,] FALSE
##  [43,] FALSE
##  [44,] FALSE
##  [45,] FALSE
##  [46,] FALSE
##  [47,] FALSE
##  [48,] FALSE
##  [49,] FALSE
##  [50,] FALSE
##  [51,] FALSE
##  [52,] FALSE
##  [53,] FALSE
##  [54,] FALSE
##  [55,] FALSE
##  [56,] FALSE
##  [57,] FALSE
##  [58,] FALSE
##  [59,] FALSE
##  [60,] FALSE
##  [61,] FALSE
##  [62,] FALSE
##  [63,] FALSE
##  [64,] FALSE
##  [65,] FALSE
##  [66,] FALSE
##  [67,] FALSE
##  [68,] FALSE
##  [69,] FALSE
##  [70,] FALSE
##  [71,] FALSE
##  [72,] FALSE
##  [73,] FALSE
##  [74,] FALSE
##  [75,] FALSE
##  [76,] FALSE
##  [77,] FALSE
##  [78,] FALSE
##  [79,] FALSE
##  [80,] FALSE
##  [81,] FALSE
##  [82,] FALSE
##  [83,] FALSE
##  [84,] FALSE
##  [85,] FALSE
##  [86,] FALSE
##  [87,] FALSE
##  [88,] FALSE
##  [89,] FALSE
##  [90,] FALSE
##  [91,] FALSE
##  [92,] FALSE
##  [93,] FALSE
##  [94,] FALSE
##  [95,] FALSE
##  [96,] FALSE
##  [97,] FALSE
##  [98,] FALSE
##  [99,] FALSE
## [100,] FALSE
## [101,] FALSE
## [102,] FALSE
## [103,] FALSE
## [104,] FALSE
## [105,] FALSE
## [106,] FALSE
## [107,] FALSE
## [108,] FALSE
## [109,] FALSE
## [110,] FALSE
## [111,] FALSE
## [112,] FALSE
## [113,] FALSE
## [114,] FALSE
## [115,] FALSE
## [116,] FALSE
## [117,] FALSE
## [118,] FALSE
## [119,] FALSE
## [120,] FALSE

f

status=gl(n=3,k=40, labels = c("S", "PA", "MA"))

dim.data.frame(Status_dt)
## [1] 120   1
str(status)
##  Factor w/ 3 levels "S","PA","MA": 1 1 1 1 1 1 1 1 1 1 ...
class(status)
## [1] "factor"
names(Status_dt)
## [1] "Status"
is.na(Status_dt)
##        Status
##   [1,]  FALSE
##   [2,]  FALSE
##   [3,]  FALSE
##   [4,]  FALSE
##   [5,]  FALSE
##   [6,]  FALSE
##   [7,]  FALSE
##   [8,]  FALSE
##   [9,]  FALSE
##  [10,]  FALSE
##  [11,]  FALSE
##  [12,]  FALSE
##  [13,]  FALSE
##  [14,]  FALSE
##  [15,]  FALSE
##  [16,]  FALSE
##  [17,]  FALSE
##  [18,]  FALSE
##  [19,]  FALSE
##  [20,]  FALSE
##  [21,]  FALSE
##  [22,]  FALSE
##  [23,]  FALSE
##  [24,]  FALSE
##  [25,]  FALSE
##  [26,]  FALSE
##  [27,]  FALSE
##  [28,]  FALSE
##  [29,]  FALSE
##  [30,]  FALSE
##  [31,]  FALSE
##  [32,]  FALSE
##  [33,]  FALSE
##  [34,]  FALSE
##  [35,]  FALSE
##  [36,]  FALSE
##  [37,]  FALSE
##  [38,]  FALSE
##  [39,]  FALSE
##  [40,]  FALSE
##  [41,]  FALSE
##  [42,]  FALSE
##  [43,]  FALSE
##  [44,]  FALSE
##  [45,]  FALSE
##  [46,]  FALSE
##  [47,]  FALSE
##  [48,]  FALSE
##  [49,]  FALSE
##  [50,]  FALSE
##  [51,]  FALSE
##  [52,]  FALSE
##  [53,]  FALSE
##  [54,]  FALSE
##  [55,]  FALSE
##  [56,]  FALSE
##  [57,]  FALSE
##  [58,]  FALSE
##  [59,]  FALSE
##  [60,]  FALSE
##  [61,]  FALSE
##  [62,]  FALSE
##  [63,]  FALSE
##  [64,]  FALSE
##  [65,]  FALSE
##  [66,]  FALSE
##  [67,]  FALSE
##  [68,]  FALSE
##  [69,]  FALSE
##  [70,]  FALSE
##  [71,]  FALSE
##  [72,]  FALSE
##  [73,]  FALSE
##  [74,]  FALSE
##  [75,]  FALSE
##  [76,]  FALSE
##  [77,]  FALSE
##  [78,]  FALSE
##  [79,]  FALSE
##  [80,]  FALSE
##  [81,]  FALSE
##  [82,]  FALSE
##  [83,]  FALSE
##  [84,]  FALSE
##  [85,]  FALSE
##  [86,]  FALSE
##  [87,]  FALSE
##  [88,]  FALSE
##  [89,]  FALSE
##  [90,]  FALSE
##  [91,]  FALSE
##  [92,]  FALSE
##  [93,]  FALSE
##  [94,]  FALSE
##  [95,]  FALSE
##  [96,]  FALSE
##  [97,]  FALSE
##  [98,]  FALSE
##  [99,]  FALSE
## [100,]  FALSE
## [101,]  FALSE
## [102,]  FALSE
## [103,]  FALSE
## [104,]  FALSE
## [105,]  FALSE
## [106,]  FALSE
## [107,]  FALSE
## [108,]  FALSE
## [109,]  FALSE
## [110,]  FALSE
## [111,]  FALSE
## [112,]  FALSE
## [113,]  FALSE
## [114,]  FALSE
## [115,]  FALSE
## [116,]  FALSE
## [117,]  FALSE
## [118,]  FALSE
## [119,]  FALSE
## [120,]  FALSE

g

Fertilizacion=x<-runif(n=120, min=0, max=1.2)

dim.data.frame(Fertilizacion_dt)
## [1] 120   1
str(ifelse(Fertilizacion_dt<0.5, yes = "FO", no = "FI"))
##  chr [1:120, 1] "FO" "FO" "FI" "FO" "FI" "FO" "FI" "FI" "FO" "FO" "FO" "FO" ...
##  - attr(*, "dimnames")=List of 2
##   ..$ : NULL
##   ..$ : chr "Fertilizacion"
class(Fertilizacion)
## [1] "numeric"
names(Fertilizacion_dt)
## [1] "Fertilizacion"
is.na(Fertilizacion_dt)
##        Fertilizacion
##   [1,]         FALSE
##   [2,]         FALSE
##   [3,]         FALSE
##   [4,]         FALSE
##   [5,]         FALSE
##   [6,]         FALSE
##   [7,]         FALSE
##   [8,]         FALSE
##   [9,]         FALSE
##  [10,]         FALSE
##  [11,]         FALSE
##  [12,]         FALSE
##  [13,]         FALSE
##  [14,]         FALSE
##  [15,]         FALSE
##  [16,]         FALSE
##  [17,]         FALSE
##  [18,]         FALSE
##  [19,]         FALSE
##  [20,]         FALSE
##  [21,]         FALSE
##  [22,]         FALSE
##  [23,]         FALSE
##  [24,]         FALSE
##  [25,]         FALSE
##  [26,]         FALSE
##  [27,]         FALSE
##  [28,]         FALSE
##  [29,]         FALSE
##  [30,]         FALSE
##  [31,]         FALSE
##  [32,]         FALSE
##  [33,]         FALSE
##  [34,]         FALSE
##  [35,]         FALSE
##  [36,]         FALSE
##  [37,]         FALSE
##  [38,]         FALSE
##  [39,]         FALSE
##  [40,]         FALSE
##  [41,]         FALSE
##  [42,]         FALSE
##  [43,]         FALSE
##  [44,]         FALSE
##  [45,]         FALSE
##  [46,]         FALSE
##  [47,]         FALSE
##  [48,]         FALSE
##  [49,]         FALSE
##  [50,]         FALSE
##  [51,]         FALSE
##  [52,]         FALSE
##  [53,]         FALSE
##  [54,]         FALSE
##  [55,]         FALSE
##  [56,]         FALSE
##  [57,]         FALSE
##  [58,]         FALSE
##  [59,]         FALSE
##  [60,]         FALSE
##  [61,]         FALSE
##  [62,]         FALSE
##  [63,]         FALSE
##  [64,]         FALSE
##  [65,]         FALSE
##  [66,]         FALSE
##  [67,]         FALSE
##  [68,]         FALSE
##  [69,]         FALSE
##  [70,]         FALSE
##  [71,]         FALSE
##  [72,]         FALSE
##  [73,]         FALSE
##  [74,]         FALSE
##  [75,]         FALSE
##  [76,]         FALSE
##  [77,]         FALSE
##  [78,]         FALSE
##  [79,]         FALSE
##  [80,]         FALSE
##  [81,]         FALSE
##  [82,]         FALSE
##  [83,]         FALSE
##  [84,]         FALSE
##  [85,]         FALSE
##  [86,]         FALSE
##  [87,]         FALSE
##  [88,]         FALSE
##  [89,]         FALSE
##  [90,]         FALSE
##  [91,]         FALSE
##  [92,]         FALSE
##  [93,]         FALSE
##  [94,]         FALSE
##  [95,]         FALSE
##  [96,]         FALSE
##  [97,]         FALSE
##  [98,]         FALSE
##  [99,]         FALSE
## [100,]         FALSE
## [101,]         FALSE
## [102,]         FALSE
## [103,]         FALSE
## [104,]         FALSE
## [105,]         FALSE
## [106,]         FALSE
## [107,]         FALSE
## [108,]         FALSE
## [109,]         FALSE
## [110,]         FALSE
## [111,]         FALSE
## [112,]         FALSE
## [113,]         FALSE
## [114,]         FALSE
## [115,]         FALSE
## [116,]         FALSE
## [117,]         FALSE
## [118,]         FALSE
## [119,]         FALSE
## [120,]         FALSE

Actividad 2.3

tib.c <-data.frame(Biomasa_dt, Flores.r_dt, Flores.d_dt, Hojas.d_dt, plaga_dt, Status_dt, Fertilizacion_dt)
head(tib.c)
##   Gramos Conteo.de.flores.en.tres.ramas Conteo.de.flores.desprendidas
## 1  68.20                             18                             7
## 2 347.60                             18                             6
## 3 141.46                             14                            11
## 4 190.98                             18                            13
## 5  13.84                             16                            14
## 6 116.71                             18                             9
##   Conteo.de.hojas.desprendidas Plaga Status Fertilizacion
## 1                           32 FALSE      S        0.2162
## 2                          152 FALSE      S        0.1715
## 3                           50  TRUE      S        1.0100
## 4                           62 FALSE      S        0.1603
## 5                          267  TRUE      S        0.5730
## 6                          172 FALSE      S        0.1455
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
tib.i <- sample_n(tib.c, 120*0.75)
dim(tib.i)
## [1] 90  7
tib.i[20,5]<-NA
tib.i[10,2]<-NA
head(tib.i)
##   Gramos Conteo.de.flores.en.tres.ramas Conteo.de.flores.desprendidas
## 1 222.64                             14                            12
## 2  13.84                             16                            14
## 3  69.67                             16                             6
## 4 173.39                             19                             7
## 5 411.21                             18                            10
## 6  82.91                             14                             9
##   Conteo.de.hojas.desprendidas Plaga Status Fertilizacion
## 1                          264  TRUE     PA       1.06878
## 2                          267  TRUE      S       0.57300
## 3                          101  TRUE     PA       0.49745
## 4                          175 FALSE      S       0.06415
## 5                          133 FALSE     MA       0.11434
## 6                          104  TRUE      S       1.06866

Actividad 3

a

tib.c_flor<-tib.c %>%
  select(Conteo.de.flores.en.tres.ramas)
head(tib.c_flor)
##   Conteo.de.flores.en.tres.ramas
## 1                             18
## 2                             18
## 3                             14
## 4                             18
## 5                             16
## 6                             18

b

tib.c_3_6<-tib.c %>%
  select(3:6)
head(tib.c_3_6)
##   Conteo.de.flores.desprendidas Conteo.de.hojas.desprendidas Plaga Status
## 1                             7                           32 FALSE      S
## 2                             6                          152 FALSE      S
## 3                            11                           50  TRUE      S
## 4                            13                           62 FALSE      S
## 5                            14                          267  TRUE      S
## 6                             9                          172 FALSE      S

c

tib.c_sin_3_6<-select(tib.c,!(3:6))
head(tib.c_sin_3_6)
##   Gramos Conteo.de.flores.en.tres.ramas Fertilizacion
## 1  68.20                             18        0.2162
## 2 347.60                             18        0.1715
## 3 141.46                             14        1.0100
## 4 190.98                             18        0.1603
## 5  13.84                             16        0.5730
## 6 116.71                             18        0.1455

d

sin_d<-select(tib.c,!ends_with("d"))
head(sin_d)
##   Gramos Conteo.de.flores.en.tres.ramas Conteo.de.flores.desprendidas
## 1  68.20                             18                             7
## 2 347.60                             18                             6
## 3 141.46                             14                            11
## 4 190.98                             18                            13
## 5  13.84                             16                            14
## 6 116.71                             18                             9
##   Conteo.de.hojas.desprendidas Plaga Status Fertilizacion
## 1                           32 FALSE      S        0.2162
## 2                          152 FALSE      S        0.1715
## 3                           50  TRUE      S        1.0100
## 4                           62 FALSE      S        0.1603
## 5                          267  TRUE      S        0.5730
## 6                          172 FALSE      S        0.1455

e

Como tengo el nombre de mis variables distintas, reemplazaré la letra F por el nombre con el que indiqué mis variables de flores, de todos modos es lo mismo solo que lo adapto para no reemplazar lo que he hecho anteriormente

with_fl<-select(tib.c, starts_with("conteo.de.flores"))
head(with_fl)
##   Conteo.de.flores.en.tres.ramas Conteo.de.flores.desprendidas
## 1                             18                             7
## 2                             18                             6
## 3                             14                            11
## 4                             18                            13
## 5                             16                            14
## 6                             18                             9

f

start.f_and_end_d<-select(tib.c, starts_with("conteo.de.flores")& ends_with("desprendidas"))
head(start.f_and_end_d)
##   Conteo.de.flores.desprendidas
## 1                             7
## 2                             6
## 3                            11
## 4                            13
## 5                            14
## 6                             9

g

library(dplyr)
order<-tib.c %>%
  group_by(Status) %>%
  select(Fertilizacion)
## Adding missing grouping variables: `Status`
head(order)
## # A tibble: 6 × 2
## # Groups:   Status [1]
##   Status Fertilizacion
##   <fct>          <dbl>
## 1 S              0.216
## 2 S              0.172
## 3 S              1.01 
## 4 S              0.160
## 5 S              0.573
## 6 S              0.146

h

var.estatus <- tib.c %>%
   arrange(desc(Fertilizacion), by_group = TRUE)
head(var.estatus)
##   Gramos Conteo.de.flores.en.tres.ramas Conteo.de.flores.desprendidas
## 1 109.60                             12                            12
## 2  56.97                             12                             6
## 3 106.82                             13                            11
## 4 388.19                             13                            12
## 5 199.82                             13                            12
## 6 335.77                             14                             8
##   Conteo.de.hojas.desprendidas Plaga Status Fertilizacion
## 1                          264  TRUE     MA         1.183
## 2                            3  TRUE     MA         1.163
## 3                           38  TRUE     MA         1.139
## 4                          251  TRUE      S         1.134
## 5                          262  TRUE     PA         1.133
## 6                          228  TRUE     PA         1.094

i

Fertilizacion_MA<-tib.c %>%
  select(starts_with("Fertilizacion")) %>%
  filter(status == "MA")
head(Fertilizacion_MA)
##   Fertilizacion
## 1        0.5633
## 2        0.1936
## 3        0.8145
## 4        0.9909
## 5        0.4538
## 6        0.2402

j

Bio<-tib.c %>%
  filter(Biomasa_dt > 5)
head(Bio)
##   Gramos Conteo.de.flores.en.tres.ramas Conteo.de.flores.desprendidas
## 1  68.20                             18                             7
## 2 347.60                             18                             6
## 3 141.46                             14                            11
## 4 190.98                             18                            13
## 5  13.84                             16                            14
## 6 116.71                             18                             9
##   Conteo.de.hojas.desprendidas Plaga Status Fertilizacion
## 1                           32 FALSE      S        0.2162
## 2                          152 FALSE      S        0.1715
## 3                           50  TRUE      S        1.0100
## 4                           62 FALSE      S        0.1603
## 5                          267  TRUE      S        0.5730
## 6                          172 FALSE      S        0.1455

k

Plantas<-tib.c %>% filter(Status_dt=="PA"|Fertilizacion_dt=="FO")
head(Plantas)
##   Gramos Conteo.de.flores.en.tres.ramas Conteo.de.flores.desprendidas
## 1 139.03                             17                            16
## 2 220.22                             18                             6
## 3 114.00                             17                            15
## 4  87.24                             15                             6
## 5 312.49                             17                             8
## 6 116.98                             17                            12
##   Conteo.de.hojas.desprendidas Plaga Status Fertilizacion
## 1                           42  TRUE     PA        0.4051
## 2                          207 FALSE     PA        0.1188
## 3                           22  TRUE     PA        0.3076
## 4                           83  TRUE     PA        0.8038
## 5                          247  TRUE     PA        0.4472
## 6                            6  TRUE     PA        0.3299

l

plants_PA_FI<-tib.c %>%
  filter(Status == "PA"|Fertilizacion == "FI")
head(plants_PA_FI)
##   Gramos Conteo.de.flores.en.tres.ramas Conteo.de.flores.desprendidas
## 1 139.03                             17                            16
## 2 220.22                             18                             6
## 3 114.00                             17                            15
## 4  87.24                             15                             6
## 5 312.49                             17                             8
## 6 116.98                             17                            12
##   Conteo.de.hojas.desprendidas Plaga Status Fertilizacion
## 1                           42  TRUE     PA        0.4051
## 2                          207 FALSE     PA        0.1188
## 3                           22  TRUE     PA        0.3076
## 4                           83  TRUE     PA        0.8038
## 5                          247  TRUE     PA        0.4472
## 6                            6  TRUE     PA        0.3299

m y n

No supe como hacerlos

o

m.c <- median(tib.c$Conteo.de.flores.en.tres.ramas)
m.i <- median(tib.i$Conteo.de.flores.en.tres.ramas, na.rm = TRUE) 
data.frame(m.c,m.i)
##   m.c m.i
## 1  17  17

Actividad 4

a

v1 <- c(tib.c$Conteo.de.hojas.desprendidas, tib.c$Conteo.de.flores.desprendidas)
c1 <- quantile(tib.c$Conteo.de.hojas.desprendidas, 0.75)
c2 <- quantile(tib.c$Conteo.de.flores.desprendidas, 0.25)
v2 <- c(c1,c2)
tib.c %>%
  filter((v1[[1]]>v2[[1]]),v1[[2]]>v2[[2]])
## [1] Gramos                         Conteo.de.flores.en.tres.ramas
## [3] Conteo.de.flores.desprendidas  Conteo.de.hojas.desprendidas  
## [5] Plaga                          Status                        
## [7] Fertilizacion                 
## <0 rows> (or 0-length row.names)

b

mean(tib.c$Gramos)
## [1] 229.5
sd(tib.c$Gramos)
## [1] 244.5
tib.c_zcore<-tib.c %>% 
  mutate(zscore = (Gramos - mean(Gramos))/sd(Gramos))
head(tib.c_zcore)
##   Gramos Conteo.de.flores.en.tres.ramas Conteo.de.flores.desprendidas
## 1  68.20                             18                             7
## 2 347.60                             18                             6
## 3 141.46                             14                            11
## 4 190.98                             18                            13
## 5  13.84                             16                            14
## 6 116.71                             18                             9
##   Conteo.de.hojas.desprendidas Plaga Status Fertilizacion  zscore
## 1                           32 FALSE      S        0.2162 -0.6597
## 2                          152 FALSE      S        0.1715  0.4832
## 3                           50  TRUE      S        1.0100 -0.3600
## 4                           62 FALSE      S        0.1603 -0.1575
## 5                          267  TRUE      S        0.5730 -0.8821
## 6                          172 FALSE      S        0.1455 -0.4613
min_max_norm <- function (x) {
    (x - min (x)) / (max (x) - min (x))
}
tib.c_norm<- (minmax= as.data.frame (lapply (tib.c [2:4], min_max_norm)))
head(tib.c_norm)
##   Conteo.de.flores.en.tres.ramas Conteo.de.flores.desprendidas
## 1                           0.75                        0.2000
## 2                           0.75                        0.1333
## 3                           0.25                        0.4667
## 4                           0.75                        0.6000
## 5                           0.50                        0.6667
## 6                           0.75                        0.3333
##   Conteo.de.hojas.desprendidas
## 1                       0.1010
## 2                       0.5051
## 3                       0.1616
## 4                       0.2020
## 5                       0.8923
## 6                       0.5724
tib.e <-data.frame(tib.c_zcore,tib.c_norm)
head(tib.e)
##   Gramos Conteo.de.flores.en.tres.ramas Conteo.de.flores.desprendidas
## 1  68.20                             18                             7
## 2 347.60                             18                             6
## 3 141.46                             14                            11
## 4 190.98                             18                            13
## 5  13.84                             16                            14
## 6 116.71                             18                             9
##   Conteo.de.hojas.desprendidas Plaga Status Fertilizacion  zscore
## 1                           32 FALSE      S        0.2162 -0.6597
## 2                          152 FALSE      S        0.1715  0.4832
## 3                           50  TRUE      S        1.0100 -0.3600
## 4                           62 FALSE      S        0.1603 -0.1575
## 5                          267  TRUE      S        0.5730 -0.8821
## 6                          172 FALSE      S        0.1455 -0.4613
##   Conteo.de.flores.en.tres.ramas.1 Conteo.de.flores.desprendidas.1
## 1                             0.75                          0.2000
## 2                             0.75                          0.1333
## 3                             0.25                          0.4667
## 4                             0.75                          0.6000
## 5                             0.50                          0.6667
## 6                             0.75                          0.3333
##   Conteo.de.hojas.desprendidas.1
## 1                         0.1010
## 2                         0.5051
## 3                         0.1616
## 4                         0.2020
## 5                         0.8923
## 6                         0.5724

c

tib.c_div<-tib.c %>% 
  mutate(div_conteo = conteodefloresentresramas/conteodefloresdesprendidas)
head(tib.c_div)
##   Gramos Conteo.de.flores.en.tres.ramas Conteo.de.flores.desprendidas
## 1  68.20                             18                             7
## 2 347.60                             18                             6
## 3 141.46                             14                            11
## 4 190.98                             18                            13
## 5  13.84                             16                            14
## 6 116.71                             18                             9
##   Conteo.de.hojas.desprendidas Plaga Status Fertilizacion div_conteo
## 1                           32 FALSE      S        0.2162      1.556
## 2                          152 FALSE      S        0.1715      1.417
## 3                           50  TRUE      S        1.0100      1.417
## 4                           62 FALSE      S        0.1603      1.750
## 5                          267  TRUE      S        0.5730      2.000
## 6                          172 FALSE      S        0.1455      1.000

d

tib.c_divrang<-tib.c_div %>%
group_by(Plaga)%>%
  mutate(rangogim=min_rank(div_conteo))
head(tib.c_divrang)
## # A tibble: 6 × 9
## # Groups:   Plaga [2]
##   Gramos Conteo.de.flores.e… Conteo.de.flores.d… Conteo.de.hojas.d… Plaga Status
##    <dbl>               <int>               <int>              <int> <lgl> <fct> 
## 1   68.2                  18                   7                 32 FALSE S     
## 2  348.                   18                   6                152 FALSE S     
## 3  141.                   14                  11                 50 TRUE  S     
## 4  191.                   18                  13                 62 FALSE S     
## 5   13.8                  16                  14                267 TRUE  S     
## 6  117.                   18                   9                172 FALSE S     
## # … with 3 more variables: Fertilizacion <dbl>, div_conteo <dbl>,
## #   rangogim <int>
names(tib.e)
##  [1] "Gramos"                           "Conteo.de.flores.en.tres.ramas"  
##  [3] "Conteo.de.flores.desprendidas"    "Conteo.de.hojas.desprendidas"    
##  [5] "Plaga"                            "Status"                          
##  [7] "Fertilizacion"                    "zscore"                          
##  [9] "Conteo.de.flores.en.tres.ramas.1" "Conteo.de.flores.desprendidas.1" 
## [11] "Conteo.de.hojas.desprendidas.1"

e

tib.e
##      Gramos Conteo.de.flores.en.tres.ramas Conteo.de.flores.desprendidas
## 1     68.20                             18                             7
## 2    347.60                             18                             6
## 3    141.46                             14                            11
## 4    190.98                             18                            13
## 5     13.84                             16                            14
## 6    116.71                             18                             9
## 7     77.56                             16                            19
## 8     82.91                             14                             9
## 9    202.76                             20                            14
## 10   173.39                             19                             7
## 11   102.81                             17                             9
## 12   116.82                             17                            13
## 13   463.24                             17                            14
## 14    68.73                             14                             7
## 15   575.75                             17                             8
## 16   197.11                             17                             6
## 17    70.42                             15                             9
## 18   359.60                             18                            12
## 19    81.73                             16                            11
## 20    81.96                             18                             7
## 21   103.93                             17                             9
## 22    85.07                             15                            10
## 23   112.60                             17                             5
## 24   246.18                             16                             7
## 25   172.90                             14                             7
## 26    63.25                             16                             5
## 27    85.64                             18                            14
## 28   466.56                             16                            15
## 29   388.19                             13                            12
## 30    59.46                             16                             5
## 31    63.79                             15                             5
## 32   138.09                             14                             7
## 33   422.20                             18                             9
## 34    41.41                             14                             8
## 35   155.29                             14                            10
## 36   468.85                             18                            12
## 37    72.77                             17                            12
## 38    74.83                             17                             6
## 39    97.31                             17                             4
## 40    41.80                             15                             7
## 41   139.03                             17                            16
## 42   220.22                             18                             6
## 43   114.00                             17                            15
## 44    87.24                             15                             6
## 45   312.49                             17                             8
## 46   116.98                             17                            12
## 47    50.18                             15                            12
## 48   958.23                             17                             8
## 49   302.29                             16                             6
## 50    34.78                             16                            14
## 51   129.69                             18                             9
## 52    69.67                             16                             6
## 53    17.50                             17                            10
## 54    56.95                             17                             7
## 55   169.50                             14                            11
## 56    37.27                             16                             4
## 57   595.25                             14                            11
## 58    51.61                             19                            11
## 59   111.70                             18                            12
## 60   105.89                             17                            10
## 61   270.38                             18                            10
## 62   263.52                             16                             9
## 63    93.08                             16                             6
## 64    91.89                             18                            12
## 65   222.64                             14                            12
## 66   482.58                             14                             7
## 67   118.35                             19                             4
## 68    57.50                             18                             8
## 69   106.00                             16                            10
## 70   300.29                             14                            11
## 71   335.77                             14                             8
## 72   199.82                             13                            12
## 73    29.22                             18                             6
## 74   144.80                             15                             6
## 75   143.79                             17                             8
## 76   294.42                             19                             9
## 77   179.98                             17                            18
## 78   317.87                             14                            12
## 79   146.86                             19                            11
## 80   108.44                             18                            12
## 81   234.35                             16                            10
## 82   231.80                             18                            10
## 83   235.32                             15                            11
## 84    73.88                             14                            13
## 85    41.88                             17                             8
## 86   809.09                             18                            19
## 87    92.11                             17                            11
## 88   262.39                             15                            14
## 89   118.37                             14                            10
## 90   176.91                             16                            18
## 91   466.61                             17                             9
## 92   245.16                             15                            11
## 93    54.16                             18                            16
## 94   278.23                             15                            10
## 95   109.60                             12                            12
## 96    90.34                             18                            16
## 97   170.51                             15                            15
## 98   115.71                             16                             6
## 99    21.42                             19                            13
## 100  421.25                             17                            10
## 101  253.31                             16                            11
## 102   48.54                             18                             7
## 103   62.11                             18                             4
## 104  546.92                             17                            14
## 105  195.69                             20                            14
## 106  343.63                             16                             8
## 107 1051.11                             18                            10
## 108 1395.43                             16                             9
## 109  176.88                             16                            10
## 110  411.21                             18                            10
## 111  162.91                             19                            12
## 112 1346.12                             15                            11
## 113  106.82                             13                            11
## 114  185.29                             14                             5
## 115  752.57                             18                            12
## 116  143.07                             16                             9
## 117  231.49                             17                            11
## 118  743.48                             17                            10
## 119  592.20                             17                            11
## 120   56.97                             12                             6
##     Conteo.de.hojas.desprendidas Plaga Status Fertilizacion    zscore
## 1                             32 FALSE      S      0.216196 -0.659672
## 2                            152 FALSE      S      0.171532  0.483237
## 3                             50  TRUE      S      1.009976 -0.359990
## 4                             62 FALSE      S      0.160290 -0.157455
## 5                            267  TRUE      S      0.573003 -0.882059
## 6                            172 FALSE      S      0.145510 -0.461255
## 7                            252  TRUE      S      0.739958 -0.621402
## 8                            104  TRUE      S      1.068657 -0.599511
## 9                            294 FALSE      S      0.003148 -0.109260
## 10                           175 FALSE      S      0.064151 -0.229389
## 11                           170  TRUE      S      0.466425 -0.518085
## 12                           150  TRUE      S      0.327544 -0.460798
## 13                           197 FALSE      S      0.267096  0.956254
## 14                           229  TRUE      S      1.051889 -0.657493
## 15                           190 FALSE      S      0.296003  1.416507
## 16                           187  TRUE      S      0.471945 -0.132365
## 17                            54  TRUE      S      0.771862 -0.650599
## 18                           179 FALSE      S      0.158156  0.532303
## 19                           242  TRUE      S      0.687120 -0.604336
## 20                            16 FALSE      S      0.106719 -0.603389
## 21                           113  TRUE      S      0.399510 -0.513518
## 22                           107  TRUE      S      0.822657 -0.590676
## 23                            98  TRUE      S      0.466944 -0.478056
## 24                            65  TRUE      S      0.672675  0.068350
## 25                            26  TRUE      S      1.091679 -0.231380
## 26                           103  TRUE      S      0.718872 -0.679941
## 27                            32 FALSE      S      0.219092 -0.588351
## 28                            68  TRUE      S      0.734665  0.969854
## 29                           251  TRUE      S      1.133562  0.649274
## 30                           167  TRUE      S      0.514379 -0.695437
## 31                            21  TRUE      S      0.756898 -0.677709
## 32                           296  TRUE      S      0.985346 -0.373790
## 33                           264 FALSE      S      0.228262  0.788385
## 34                            61  TRUE      S      1.054420 -0.769273
## 35                             3  TRUE      S      1.021319 -0.303420
## 36                             2 FALSE      S      0.177297  0.979212
## 37                           268 FALSE      S      0.289657 -0.641000
## 38                           272  TRUE      S      0.337147 -0.632547
## 39                           214 FALSE      S      0.290904 -0.540588
## 40                            72  TRUE      S      0.808313 -0.767685
## 41                            42  TRUE     PA      0.405067 -0.369941
## 42                           207 FALSE     PA      0.118848 -0.037846
## 43                            22  TRUE     PA      0.307576 -0.472325
## 44                            83  TRUE     PA      0.803764 -0.581789
## 45                           247  TRUE     PA      0.447160  0.339590
## 46                             6  TRUE     PA      0.329903 -0.460140
## 47                           100  TRUE     PA      0.869037 -0.733372
## 48                           119  TRUE     PA      0.374689  2.981045
## 49                           265  TRUE     PA      0.685562  0.297902
## 50                           124  TRUE     PA      0.581719 -0.796367
## 51                           299 FALSE     PA      0.189378 -0.408153
## 52                           101  TRUE     PA      0.497445 -0.653666
## 53                            72  TRUE     PA      0.310611 -0.867086
## 54                           234  TRUE     PA      0.448811 -0.705715
## 55                            19  TRUE     PA      1.093313 -0.245309
## 56                           122  TRUE     PA      0.597337 -0.786207
## 57                           122  TRUE     PA      1.045212  1.496240
## 58                            25 FALSE     PA      0.068677 -0.727535
## 59                           131 FALSE     PA      0.169117 -0.481759
## 60                            21  TRUE     PA      0.455406 -0.505514
## 61                            20 FALSE     PA      0.192317  0.167343
## 62                           163  TRUE     PA      0.601115  0.139283
## 63                           120  TRUE     PA      0.559443 -0.557909
## 64                           242 FALSE     PA      0.206288 -0.562770
## 65                           264  TRUE     PA      1.068777 -0.027926
## 66                           214  TRUE     PA      1.028963  1.035369
## 67                           288 FALSE     PA      0.079890 -0.454529
## 68                           154 FALSE     PA      0.111915 -0.703454
## 69                           117  TRUE     PA      0.625508 -0.505038
## 70                           215  TRUE     PA      1.054966  0.289704
## 71                           228  TRUE     PA      1.094420  0.434846
## 72                           262  TRUE     PA      1.132734 -0.121272
## 73                           295 FALSE     PA      0.241041 -0.819135
## 74                           297  TRUE     PA      0.824203 -0.346351
## 75                           266 FALSE     PA      0.252290 -0.350469
## 76                            57 FALSE     PA      0.078908  0.265687
## 77                            52  TRUE     PA      0.371706 -0.202435
## 78                            90  TRUE     PA      1.049651  0.361613
## 79                            52 FALSE     PA      0.081605 -0.337910
## 80                           141 FALSE     PA      0.198177 -0.495071
## 81                           250  TRUE     MA      0.563256  0.019976
## 82                           176 FALSE     MA      0.193644  0.009547
## 83                           157  TRUE     MA      0.814518  0.023936
## 84                           123  TRUE     MA      0.990864 -0.636444
## 85                           189  TRUE     MA      0.453781 -0.767329
## 86                           291 FALSE     MA      0.240157  2.370974
## 87                           158  TRUE     MA      0.319149 -0.561859
## 88                            92  TRUE     MA      0.755946  0.134670
## 89                           216  TRUE     MA      0.971367 -0.454469
## 90                            58  TRUE     MA      0.639018 -0.215007
## 91                           201  TRUE     MA      0.467689  0.970023
## 92                           184  TRUE     MA      0.867008  0.064189
## 93                           225 FALSE     MA      0.121250 -0.717121
## 94                            28  TRUE     MA      0.834471  0.199454
## 95                           264  TRUE     MA      1.183068 -0.490339
## 96                           209 FALSE     MA      0.118648 -0.569130
## 97                           292  TRUE     MA      0.958426 -0.241177
## 98                            32  TRUE     MA      0.633751 -0.465321
## 99                           244 FALSE     MA      0.052709 -0.851035
## 100                          150  TRUE     MA      0.429349  0.784510
## 101                          251  TRUE     MA      0.524363  0.097540
## 102                           41 FALSE     MA      0.211101 -0.740095
## 103                          297 FALSE     MA      0.224180 -0.684572
## 104                           17  TRUE     MA      0.377260  1.298569
## 105                           85 FALSE     MA      0.007136 -0.138167
## 106                          216  TRUE     MA      0.652337  0.467006
## 107                           47 FALSE     MA      0.155860  3.360972
## 108                          155  TRUE     MA      0.700789  4.769424
## 109                           52  TRUE     MA      0.674517 -0.215125
## 110                          133 FALSE     MA      0.114343  0.743419
## 111                          144 FALSE     MA      0.062406 -0.272254
## 112                          235  TRUE     MA      0.807558  4.567718
## 113                           38  TRUE     MA      1.138656 -0.501693
## 114                           62  TRUE     MA      1.047973 -0.180727
## 115                           98 FALSE     MA      0.128397  2.139792
## 116                           36  TRUE     MA      0.628470 -0.353436
## 117                          235  TRUE     MA      0.442854  0.008259
## 118                          283  TRUE     MA      0.382527  2.102604
## 119                          133  TRUE     MA      0.414732  1.483768
## 120                            3  TRUE     MA      1.162946 -0.705630
##     Conteo.de.flores.en.tres.ramas.1 Conteo.de.flores.desprendidas.1
## 1                              0.750                         0.20000
## 2                              0.750                         0.13333
## 3                              0.250                         0.46667
## 4                              0.750                         0.60000
## 5                              0.500                         0.66667
## 6                              0.750                         0.33333
## 7                              0.500                         1.00000
## 8                              0.250                         0.33333
## 9                              1.000                         0.66667
## 10                             0.875                         0.20000
## 11                             0.625                         0.33333
## 12                             0.625                         0.60000
## 13                             0.625                         0.66667
## 14                             0.250                         0.20000
## 15                             0.625                         0.26667
## 16                             0.625                         0.13333
## 17                             0.375                         0.33333
## 18                             0.750                         0.53333
## 19                             0.500                         0.46667
## 20                             0.750                         0.20000
## 21                             0.625                         0.33333
## 22                             0.375                         0.40000
## 23                             0.625                         0.06667
## 24                             0.500                         0.20000
## 25                             0.250                         0.20000
## 26                             0.500                         0.06667
## 27                             0.750                         0.66667
## 28                             0.500                         0.73333
## 29                             0.125                         0.53333
## 30                             0.500                         0.06667
## 31                             0.375                         0.06667
## 32                             0.250                         0.20000
## 33                             0.750                         0.33333
## 34                             0.250                         0.26667
## 35                             0.250                         0.40000
## 36                             0.750                         0.53333
## 37                             0.625                         0.53333
## 38                             0.625                         0.13333
## 39                             0.625                         0.00000
## 40                             0.375                         0.20000
## 41                             0.625                         0.80000
## 42                             0.750                         0.13333
## 43                             0.625                         0.73333
## 44                             0.375                         0.13333
## 45                             0.625                         0.26667
## 46                             0.625                         0.53333
## 47                             0.375                         0.53333
## 48                             0.625                         0.26667
## 49                             0.500                         0.13333
## 50                             0.500                         0.66667
## 51                             0.750                         0.33333
## 52                             0.500                         0.13333
## 53                             0.625                         0.40000
## 54                             0.625                         0.20000
## 55                             0.250                         0.46667
## 56                             0.500                         0.00000
## 57                             0.250                         0.46667
## 58                             0.875                         0.46667
## 59                             0.750                         0.53333
## 60                             0.625                         0.40000
## 61                             0.750                         0.40000
## 62                             0.500                         0.33333
## 63                             0.500                         0.13333
## 64                             0.750                         0.53333
## 65                             0.250                         0.53333
## 66                             0.250                         0.20000
## 67                             0.875                         0.00000
## 68                             0.750                         0.26667
## 69                             0.500                         0.40000
## 70                             0.250                         0.46667
## 71                             0.250                         0.26667
## 72                             0.125                         0.53333
## 73                             0.750                         0.13333
## 74                             0.375                         0.13333
## 75                             0.625                         0.26667
## 76                             0.875                         0.33333
## 77                             0.625                         0.93333
## 78                             0.250                         0.53333
## 79                             0.875                         0.46667
## 80                             0.750                         0.53333
## 81                             0.500                         0.40000
## 82                             0.750                         0.40000
## 83                             0.375                         0.46667
## 84                             0.250                         0.60000
## 85                             0.625                         0.26667
## 86                             0.750                         1.00000
## 87                             0.625                         0.46667
## 88                             0.375                         0.66667
## 89                             0.250                         0.40000
## 90                             0.500                         0.93333
## 91                             0.625                         0.33333
## 92                             0.375                         0.46667
## 93                             0.750                         0.80000
## 94                             0.375                         0.40000
## 95                             0.000                         0.53333
## 96                             0.750                         0.80000
## 97                             0.375                         0.73333
## 98                             0.500                         0.13333
## 99                             0.875                         0.60000
## 100                            0.625                         0.40000
## 101                            0.500                         0.46667
## 102                            0.750                         0.20000
## 103                            0.750                         0.00000
## 104                            0.625                         0.66667
## 105                            1.000                         0.66667
## 106                            0.500                         0.26667
## 107                            0.750                         0.40000
## 108                            0.500                         0.33333
## 109                            0.500                         0.40000
## 110                            0.750                         0.40000
## 111                            0.875                         0.53333
## 112                            0.375                         0.46667
## 113                            0.125                         0.46667
## 114                            0.250                         0.06667
## 115                            0.750                         0.53333
## 116                            0.500                         0.33333
## 117                            0.625                         0.46667
## 118                            0.625                         0.40000
## 119                            0.625                         0.46667
## 120                            0.000                         0.13333
##     Conteo.de.hojas.desprendidas.1
## 1                         0.101010
## 2                         0.505051
## 3                         0.161616
## 4                         0.202020
## 5                         0.892256
## 6                         0.572391
## 7                         0.841751
## 8                         0.343434
## 9                         0.983165
## 10                        0.582492
## 11                        0.565657
## 12                        0.498316
## 13                        0.656566
## 14                        0.764310
## 15                        0.632997
## 16                        0.622896
## 17                        0.175084
## 18                        0.595960
## 19                        0.808081
## 20                        0.047138
## 21                        0.373737
## 22                        0.353535
## 23                        0.323232
## 24                        0.212121
## 25                        0.080808
## 26                        0.340067
## 27                        0.101010
## 28                        0.222222
## 29                        0.838384
## 30                        0.555556
## 31                        0.063973
## 32                        0.989899
## 33                        0.882155
## 34                        0.198653
## 35                        0.003367
## 36                        0.000000
## 37                        0.895623
## 38                        0.909091
## 39                        0.713805
## 40                        0.235690
## 41                        0.134680
## 42                        0.690236
## 43                        0.067340
## 44                        0.272727
## 45                        0.824916
## 46                        0.013468
## 47                        0.329966
## 48                        0.393939
## 49                        0.885522
## 50                        0.410774
## 51                        1.000000
## 52                        0.333333
## 53                        0.235690
## 54                        0.781145
## 55                        0.057239
## 56                        0.404040
## 57                        0.404040
## 58                        0.077441
## 59                        0.434343
## 60                        0.063973
## 61                        0.060606
## 62                        0.542088
## 63                        0.397306
## 64                        0.808081
## 65                        0.882155
## 66                        0.713805
## 67                        0.962963
## 68                        0.511785
## 69                        0.387205
## 70                        0.717172
## 71                        0.760943
## 72                        0.875421
## 73                        0.986532
## 74                        0.993266
## 75                        0.888889
## 76                        0.185185
## 77                        0.168350
## 78                        0.296296
## 79                        0.168350
## 80                        0.468013
## 81                        0.835017
## 82                        0.585859
## 83                        0.521886
## 84                        0.407407
## 85                        0.629630
## 86                        0.973064
## 87                        0.525253
## 88                        0.303030
## 89                        0.720539
## 90                        0.188552
## 91                        0.670034
## 92                        0.612795
## 93                        0.750842
## 94                        0.087542
## 95                        0.882155
## 96                        0.696970
## 97                        0.976431
## 98                        0.101010
## 99                        0.814815
## 100                       0.498316
## 101                       0.838384
## 102                       0.131313
## 103                       0.993266
## 104                       0.050505
## 105                       0.279461
## 106                       0.720539
## 107                       0.151515
## 108                       0.515152
## 109                       0.168350
## 110                       0.441077
## 111                       0.478114
## 112                       0.784512
## 113                       0.121212
## 114                       0.202020
## 115                       0.323232
## 116                       0.114478
## 117                       0.784512
## 118                       0.946128
## 119                       0.441077
## 120                       0.003367
renamed.tib.e<-rename(tib.e,Rosas=Conteo.de.flores.en.tres.ramas,
                      Violetas=Conteo.de.hojas.desprendidas,
                      Margaritas=Conteo.de.flores.en.tres.ramas.1,
                      Girasoles=Conteo.de.flores.desprendidas.1)
names(renamed.tib.e)
##  [1] "Gramos"                         "Rosas"                         
##  [3] "Conteo.de.flores.desprendidas"  "Violetas"                      
##  [5] "Plaga"                          "Status"                        
##  [7] "Fertilizacion"                  "zscore"                        
##  [9] "Margaritas"                     "Girasoles"                     
## [11] "Conteo.de.hojas.desprendidas.1"

f

tib.e_MAYUS<-(rename_with(tib.e,toupper))
head(tib.e_MAYUS)
##   GRAMOS CONTEO.DE.FLORES.EN.TRES.RAMAS CONTEO.DE.FLORES.DESPRENDIDAS
## 1  68.20                             18                             7
## 2 347.60                             18                             6
## 3 141.46                             14                            11
## 4 190.98                             18                            13
## 5  13.84                             16                            14
## 6 116.71                             18                             9
##   CONTEO.DE.HOJAS.DESPRENDIDAS PLAGA STATUS FERTILIZACION  ZSCORE
## 1                           32 FALSE      S        0.2162 -0.6597
## 2                          152 FALSE      S        0.1715  0.4832
## 3                           50  TRUE      S        1.0100 -0.3600
## 4                           62 FALSE      S        0.1603 -0.1575
## 5                          267  TRUE      S        0.5730 -0.8821
## 6                          172 FALSE      S        0.1455 -0.4613
##   CONTEO.DE.FLORES.EN.TRES.RAMAS.1 CONTEO.DE.FLORES.DESPRENDIDAS.1
## 1                             0.75                          0.2000
## 2                             0.75                          0.1333
## 3                             0.25                          0.4667
## 4                             0.75                          0.6000
## 5                             0.50                          0.6667
## 6                             0.75                          0.3333
##   CONTEO.DE.HOJAS.DESPRENDIDAS.1
## 1                         0.1010
## 2                         0.5051
## 3                         0.1616
## 4                         0.2020
## 5                         0.8923
## 6                         0.5724

g

tib.e_raname_with<-rename_with(tib.e, ~ tolower(gsub(".", "_", .x, fixed = TRUE)))
head(tib.e_raname_with)
##   gramos conteo_de_flores_en_tres_ramas conteo_de_flores_desprendidas
## 1  68.20                             18                             7
## 2 347.60                             18                             6
## 3 141.46                             14                            11
## 4 190.98                             18                            13
## 5  13.84                             16                            14
## 6 116.71                             18                             9
##   conteo_de_hojas_desprendidas plaga status fertilizacion  zscore
## 1                           32 FALSE      S        0.2162 -0.6597
## 2                          152 FALSE      S        0.1715  0.4832
## 3                           50  TRUE      S        1.0100 -0.3600
## 4                           62 FALSE      S        0.1603 -0.1575
## 5                          267  TRUE      S        0.5730 -0.8821
## 6                          172 FALSE      S        0.1455 -0.4613
##   conteo_de_flores_en_tres_ramas_1 conteo_de_flores_desprendidas_1
## 1                             0.75                          0.2000
## 2                             0.75                          0.1333
## 3                             0.25                          0.4667
## 4                             0.75                          0.6000
## 5                             0.50                          0.6667
## 6                             0.75                          0.3333
##   conteo_de_hojas_desprendidas_1
## 1                         0.1010
## 2                         0.5051
## 3                         0.1616
## 4                         0.2020
## 5                         0.8923
## 6                         0.5724

Actividad 5

a

tib.i%>%
  summarise(mean(Gramos),N_datos=n())
##   mean(Gramos) N_datos
## 1        216.7      90

b

tib.i%>%
 group_by(Fertilizacion) %>%
 summarise(mean(Gramos),N_datos=n())
## # A tibble: 90 × 3
##    Fertilizacion `mean(Gramos)` N_datos
##            <dbl>          <dbl>   <int>
##  1       0.00315          203.        1
##  2       0.00714          196.        1
##  3       0.0527            21.4       1
##  4       0.0624           163.        1
##  5       0.0642           173.        1
##  6       0.0687            51.6       1
##  7       0.0789           294.        1
##  8       0.0816           147.        1
##  9       0.107             82.0       1
## 10       0.112             57.5       1
## # … with 80 more rows

c

tib.i%>%
 group_by(Fertilizacion) %>%
 summarise(Q.10=quantile(tib.i$Gramos,0.10),
           Q.20=quantile(tib.i$Gramos,0.20),
           Q.30=quantile(tib.i$Gramos,0.30),
           Q.40=quantile(tib.i$Gramos,0.40),
           Q.50=quantile(tib.i$Gramos,0.50))
## # A tibble: 90 × 6
##    Fertilizacion  Q.10  Q.20  Q.30  Q.40  Q.50
##            <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
##  1       0.00315  56.4  74.4  91.4  112.  141.
##  2       0.00714  56.4  74.4  91.4  112.  141.
##  3       0.0527   56.4  74.4  91.4  112.  141.
##  4       0.0624   56.4  74.4  91.4  112.  141.
##  5       0.0642   56.4  74.4  91.4  112.  141.
##  6       0.0687   56.4  74.4  91.4  112.  141.
##  7       0.0789   56.4  74.4  91.4  112.  141.
##  8       0.0816   56.4  74.4  91.4  112.  141.
##  9       0.107    56.4  74.4  91.4  112.  141.
## 10       0.112    56.4  74.4  91.4  112.  141.
## # … with 80 more rows

d

tib.i%>%
 group_by(Fertilizacion,Plaga) %>%
 summarise(meanbio=mean(Gramos),
           medbio=median(Gramos),
           maxbio=max(Gramos),
           minbio=min(Gramos),
           destipica=sd(Gramos),
           desmedia=mean(abs(Gramos-mean(Gramos))),
           medtru5=mean(Gramos,trim=5/100),
           medtru10=mean(Gramos,trim=10/100),
           varbio=var(Gramos))
## `summarise()` has grouped output by 'Fertilizacion'. You can override using the `.groups` argument.
## # A tibble: 90 × 11
## # Groups:   Fertilizacion [90]
##    Fertilizacion Plaga meanbio medbio maxbio minbio destipica desmedia medtru5
##            <dbl> <lgl>   <dbl>  <dbl>  <dbl>  <dbl>     <dbl>    <dbl>   <dbl>
##  1       0.00315 FALSE   203.   203.   203.   203.         NA        0   203. 
##  2       0.00714 FALSE   196.   196.   196.   196.         NA        0   196. 
##  3       0.0527  FALSE    21.4   21.4   21.4   21.4        NA        0    21.4
##  4       0.0624  FALSE   163.   163.   163.   163.         NA        0   163. 
##  5       0.0642  FALSE   173.   173.   173.   173.         NA        0   173. 
##  6       0.0687  FALSE    51.6   51.6   51.6   51.6        NA        0    51.6
##  7       0.0789  FALSE   294.   294.   294.   294.         NA        0   294. 
##  8       0.0816  FALSE   147.   147.   147.   147.         NA        0   147. 
##  9       0.107   FALSE    82.0   82.0   82.0   82.0        NA        0    82.0
## 10       0.112   FALSE    57.5   57.5   57.5   57.5        NA        0    57.5
## # … with 80 more rows, and 2 more variables: medtru10 <dbl>, varbio <dbl>

e

tib.i_planS<-tib.i%>%
group_by(Status) %>%
filter(Status=="S")%>%
select(Fertilizacion,Plaga)
## Adding missing grouping variables: `Status`
head(tib.i_planS)
## # A tibble: 6 × 3
## # Groups:   Status [1]
##   Status Fertilizacion Plaga
##   <fct>          <dbl> <lgl>
## 1 S            0.573   TRUE 
## 2 S            0.0642  FALSE
## 3 S            1.07    TRUE 
## 4 S            0.740   TRUE 
## 5 S            0.00315 FALSE
## 6 S            0.296   NA
tib.i_planS%>%
group_by(Fertilizacion,Plaga) %>%
 summarise(Ndatos=n(),
           meanbio=mean(gramos),
           medbio=median(gramos),
           maxbio=max(gramos),
           minbio=min(gramos),
           destipica=sd(gramos),
           desmedia=mean(abs(gramos-mean(gramos))),
           medtru5=mean(gramos,trim=5/100),
           medtru10=mean(gramos,trim=10/100),
           varbio=var(gramos))
## `summarise()` has grouped output by 'Fertilizacion'. You can override using the `.groups` argument.
## # A tibble: 31 × 12
## # Groups:   Fertilizacion [31]
##    Fertilizacion Plaga Ndatos meanbio medbio maxbio minbio destipica desmedia
##            <dbl> <lgl>  <int>   <dbl>  <dbl>  <dbl>  <dbl>     <dbl>    <dbl>
##  1       0.00315 FALSE      1    253.   177.  1779.   21.4      282.     173.
##  2       0.0642  FALSE      1    253.   177.  1779.   21.4      282.     173.
##  3       0.107   FALSE      1    253.   177.  1779.   21.4      282.     173.
##  4       0.146   FALSE      1    253.   177.  1779.   21.4      282.     173.
##  5       0.160   FALSE      1    253.   177.  1779.   21.4      282.     173.
##  6       0.172   FALSE      1    253.   177.  1779.   21.4      282.     173.
##  7       0.216   FALSE      1    253.   177.  1779.   21.4      282.     173.
##  8       0.219   FALSE      1    253.   177.  1779.   21.4      282.     173.
##  9       0.228   FALSE      1    253.   177.  1779.   21.4      282.     173.
## 10       0.290   FALSE      1    253.   177.  1779.   21.4      282.     173.
## # … with 21 more rows, and 3 more variables: medtru5 <dbl>, medtru10 <dbl>,
## #   varbio <dbl>

f

library(tidyr)
tib.i_sinNA <-drop_na(tib.i)
head(tib.i_sinNA)
##   Gramos Conteo.de.flores.en.tres.ramas Conteo.de.flores.desprendidas
## 1 222.64                             14                            12
## 2  13.84                             16                            14
## 3  69.67                             16                             6
## 4 173.39                             19                             7
## 5 411.21                             18                            10
## 6  82.91                             14                             9
##   Conteo.de.hojas.desprendidas Plaga Status Fertilizacion
## 1                          264  TRUE     PA       1.06878
## 2                          267  TRUE      S       0.57300
## 3                          101  TRUE     PA       0.49745
## 4                          175 FALSE      S       0.06415
## 5                          133 FALSE     MA       0.11434
## 6                          104  TRUE      S       1.06866
tib.i_planSsinNA<-tib.i_sinNA%>%
   group_by(Status) %>%
  filter(Status=="S")%>%
    select(Fertilizacion,Plaga)
## Adding missing grouping variables: `Status`
head(tib.i_planS)
## # A tibble: 6 × 3
## # Groups:   Status [1]
##   Status Fertilizacion Plaga
##   <fct>          <dbl> <lgl>
## 1 S            0.573   TRUE 
## 2 S            0.0642  FALSE
## 3 S            1.07    TRUE 
## 4 S            0.740   TRUE 
## 5 S            0.00315 FALSE
## 6 S            0.296   NA
tib.i_planSsinNA%>%
group_by(Fertilizacion,Plaga) %>%
  summarise(Ndatos=n(),
           meanbio=mean(gramos),
           medbio=median(gramos),
           maxbio=max(gramos),
           minbio=min(gramos),
           destipica=sd(gramos),
           desmedia=mean(abs(gramos-mean(gramos))),
           medtru5=mean(gramos,trim=5/100),
           medtru10=mean(gramos,trim=10/100),
           varbio=var(gramos))
## `summarise()` has grouped output by 'Fertilizacion'. You can override using the `.groups` argument.
## # A tibble: 30 × 12
## # Groups:   Fertilizacion [30]
##    Fertilizacion Plaga Ndatos meanbio medbio maxbio minbio destipica desmedia
##            <dbl> <lgl>  <int>   <dbl>  <dbl>  <dbl>  <dbl>     <dbl>    <dbl>
##  1       0.00315 FALSE      1    253.   177.  1779.   21.4      282.     173.
##  2       0.0642  FALSE      1    253.   177.  1779.   21.4      282.     173.
##  3       0.107   FALSE      1    253.   177.  1779.   21.4      282.     173.
##  4       0.146   FALSE      1    253.   177.  1779.   21.4      282.     173.
##  5       0.160   FALSE      1    253.   177.  1779.   21.4      282.     173.
##  6       0.172   FALSE      1    253.   177.  1779.   21.4      282.     173.
##  7       0.216   FALSE      1    253.   177.  1779.   21.4      282.     173.
##  8       0.219   FALSE      1    253.   177.  1779.   21.4      282.     173.
##  9       0.228   FALSE      1    253.   177.  1779.   21.4      282.     173.
## 10       0.290   FALSE      1    253.   177.  1779.   21.4      282.     173.
## # … with 20 more rows, and 3 more variables: medtru5 <dbl>, medtru10 <dbl>,
## #   varbio <dbl>

g

plantas_PA_MA <- filter(tib.i,Status %in% c("PA", "MA"))
head(plantas_PA_MA)
##   Gramos Conteo.de.flores.en.tres.ramas Conteo.de.flores.desprendidas
## 1 222.64                             14                            12
## 2  69.67                             16                             6
## 3 411.21                             18                            10
## 4  92.11                             17                            11
## 5 546.92                             17                            14
## 6  17.50                             NA                            10
##   Conteo.de.hojas.desprendidas Plaga Status Fertilizacion
## 1                          264  TRUE     PA        1.0688
## 2                          101  TRUE     PA        0.4974
## 3                          133 FALSE     MA        0.1143
## 4                          158  TRUE     MA        0.3191
## 5                           17  TRUE     MA        0.3773
## 6                           72  TRUE     PA        0.3106

h

SinNA_complet.cases<-filter(tib.i[1:90,],complete.cases(tib.i[1:90,]))
head(SinNA_complet.cases)
##   Gramos Conteo.de.flores.en.tres.ramas Conteo.de.flores.desprendidas
## 1 222.64                             14                            12
## 2  13.84                             16                            14
## 3  69.67                             16                             6
## 4 173.39                             19                             7
## 5 411.21                             18                            10
## 6  82.91                             14                             9
##   Conteo.de.hojas.desprendidas Plaga Status Fertilizacion
## 1                          264  TRUE     PA       1.06878
## 2                          267  TRUE      S       0.57300
## 3                          101  TRUE     PA       0.49745
## 4                          175 FALSE      S       0.06415
## 5                          133 FALSE     MA       0.11434
## 6                          104  TRUE      S       1.06866

i

remove_tib.i<-mutate(tib.i,flores.r=NULL,flores.d=NULL)
head(remove_tib.i)
##   Gramos Conteo.de.flores.en.tres.ramas Conteo.de.flores.desprendidas
## 1 222.64                             14                            12
## 2  13.84                             16                            14
## 3  69.67                             16                             6
## 4 173.39                             19                             7
## 5 411.21                             18                            10
## 6  82.91                             14                             9
##   Conteo.de.hojas.desprendidas Plaga Status Fertilizacion
## 1                          264  TRUE     PA       1.06878
## 2                          267  TRUE      S       0.57300
## 3                          101  TRUE     PA       0.49745
## 4                          175 FALSE      S       0.06415
## 5                          133 FALSE     MA       0.11434
## 6                          104  TRUE      S       1.06866

j

d_contain<-tib.i%>%
select(contains("d"))
head(d_contain)
##   Conteo.de.flores.en.tres.ramas Conteo.de.flores.desprendidas
## 1                             14                            12
## 2                             16                            14
## 3                             16                             6
## 4                             19                             7
## 5                             18                            10
## 6                             14                             9
##   Conteo.de.hojas.desprendidas
## 1                          264
## 2                          267
## 3                          101
## 4                          175
## 5                          133
## 6                          104

k