setwd("C:/Users/jaya/downloads")

dean.df<-read.csv(paste("Data - Deans Dilemma.csv",sep=""))
View(dean.df)

#2 Summary Statistics of the data
summary(dean.df)
##       SlNo       Gender     Gender.B       Percent_SSC     Board_SSC  
##  Min.   :  1.0   F:127   Min.   :0.0000   Min.   :37.00   CBSE  :113  
##  1st Qu.: 98.5   M:264   1st Qu.:0.0000   1st Qu.:56.00   ICSE  : 77  
##  Median :196.0           Median :0.0000   Median :64.50   Others:201  
##  Mean   :196.0           Mean   :0.3248   Mean   :64.65               
##  3rd Qu.:293.5           3rd Qu.:1.0000   3rd Qu.:74.00               
##  Max.   :391.0           Max.   :1.0000   Max.   :87.20               
##                                                                       
##    Board_CBSE      Board_ICSE      Percent_HSC    Board_HSC  
##  Min.   :0.000   Min.   :0.0000   Min.   :40.0   CBSE  : 96  
##  1st Qu.:0.000   1st Qu.:0.0000   1st Qu.:54.0   ISC   : 48  
##  Median :0.000   Median :0.0000   Median :63.0   Others:247  
##  Mean   :0.289   Mean   :0.1969   Mean   :63.8               
##  3rd Qu.:1.000   3rd Qu.:0.0000   3rd Qu.:72.0               
##  Max.   :1.000   Max.   :1.0000   Max.   :94.7               
##                                                              
##     Stream_HSC  Percent_Degree                Course_Degree
##  Arts    : 18   Min.   :35.00   Arts                 : 13  
##  Commerce:222   1st Qu.:57.52   Commerce             :117  
##  Science :151   Median :63.00   Computer Applications: 32  
##                 Mean   :62.98   Engineering          : 37  
##                 3rd Qu.:69.00   Management           :163  
##                 Max.   :89.00   Others               :  5  
##                                 Science              : 24  
##   Degree_Engg      Experience_Yrs   Entrance_Test     S.TEST      
##  Min.   :0.00000   Min.   :0.0000   MAT    :265   Min.   :0.0000  
##  1st Qu.:0.00000   1st Qu.:0.0000   None   : 67   1st Qu.:1.0000  
##  Median :0.00000   Median :0.0000   K-MAT  : 24   Median :1.0000  
##  Mean   :0.09463   Mean   :0.4783   CAT    : 22   Mean   :0.8286  
##  3rd Qu.:0.00000   3rd Qu.:1.0000   PGCET  :  8   3rd Qu.:1.0000  
##  Max.   :1.00000   Max.   :3.0000   GCET   :  2   Max.   :1.0000  
##                                     (Other):  3                   
##  Percentile_ET    S.TEST.SCORE    Percent_MBA   
##  Min.   : 0.00   Min.   : 0.00   Min.   :50.83  
##  1st Qu.:41.19   1st Qu.:41.19   1st Qu.:57.20  
##  Median :62.00   Median :62.00   Median :61.01  
##  Mean   :54.93   Mean   :54.93   Mean   :61.67  
##  3rd Qu.:78.00   3rd Qu.:78.00   3rd Qu.:66.02  
##  Max.   :98.69   Max.   :98.69   Max.   :77.89  
##                                                 
##            Specialization_MBA Marks_Communication Marks_Projectwork
##  Marketing & Finance:222      Min.   :50.00       Min.   :50.00    
##  Marketing & HR     :156      1st Qu.:53.00       1st Qu.:64.00    
##  Marketing & IB     : 13      Median :58.00       Median :69.00    
##                               Mean   :60.54       Mean   :68.36    
##                               3rd Qu.:67.00       3rd Qu.:74.00    
##                               Max.   :88.00       Max.   :87.00    
##                                                                    
##    Marks_BOCA         Placement    Placement_B        Salary      
##  Min.   :50.00   Not Placed: 79   Min.   :0.000   Min.   :     0  
##  1st Qu.:57.00   Placed    :312   1st Qu.:1.000   1st Qu.:172800  
##  Median :63.00                    Median :1.000   Median :240000  
##  Mean   :64.38                    Mean   :0.798   Mean   :219078  
##  3rd Qu.:72.50                    3rd Qu.:1.000   3rd Qu.:300000  
##  Max.   :96.00                    Max.   :1.000   Max.   :940000  
## 
library(psych)
describe(dean.df)
##                     vars   n      mean        sd    median   trimmed
## SlNo                   1 391    196.00    113.02    196.00    196.00
## Gender*                2 391      1.68      0.47      2.00      1.72
## Gender.B               3 391      0.32      0.47      0.00      0.28
## Percent_SSC            4 391     64.65     10.96     64.50     64.76
## Board_SSC*             5 391      2.23      0.87      3.00      2.28
## Board_CBSE             6 391      0.29      0.45      0.00      0.24
## Board_ICSE             7 391      0.20      0.40      0.00      0.12
## Percent_HSC            8 391     63.80     11.42     63.00     63.34
## Board_HSC*             9 391      2.39      0.85      3.00      2.48
## Stream_HSC*           10 391      2.34      0.56      2.00      2.36
## Percent_Degree        11 391     62.98      8.92     63.00     62.91
## Course_Degree*        12 391      3.85      1.61      4.00      3.81
## Degree_Engg           13 391      0.09      0.29      0.00      0.00
## Experience_Yrs        14 391      0.48      0.67      0.00      0.36
## Entrance_Test*        15 391      5.85      1.35      6.00      6.08
## S.TEST                16 391      0.83      0.38      1.00      0.91
## Percentile_ET         17 391     54.93     31.17     62.00     56.87
## S.TEST.SCORE          18 391     54.93     31.17     62.00     56.87
## Percent_MBA           19 391     61.67      5.85     61.01     61.45
## Specialization_MBA*   20 391      1.47      0.56      1.00      1.42
## Marks_Communication   21 391     60.54      8.82     58.00     59.68
## Marks_Projectwork     22 391     68.36      7.15     69.00     68.60
## Marks_BOCA            23 391     64.38      9.58     63.00     64.08
## Placement*            24 391      1.80      0.40      2.00      1.87
## Placement_B           25 391      0.80      0.40      1.00      0.87
## Salary                26 391 219078.26 138311.65 240000.00 217011.50
##                          mad   min       max     range  skew kurtosis
## SlNo                  145.29  1.00    391.00    390.00  0.00    -1.21
## Gender*                 0.00  1.00      2.00      1.00 -0.75    -1.45
## Gender.B                0.00  0.00      1.00      1.00  0.75    -1.45
## Percent_SSC            12.60 37.00     87.20     50.20 -0.06    -0.72
## Board_SSC*              0.00  1.00      3.00      2.00 -0.45    -1.53
## Board_CBSE              0.00  0.00      1.00      1.00  0.93    -1.14
## Board_ICSE              0.00  0.00      1.00      1.00  1.52     0.31
## Percent_HSC            13.34 40.00     94.70     54.70  0.29    -0.67
## Board_HSC*              0.00  1.00      3.00      2.00 -0.83    -1.13
## Stream_HSC*             0.00  1.00      3.00      2.00 -0.12    -0.72
## Percent_Degree          8.90 35.00     89.00     54.00  0.05     0.24
## Course_Degree*          1.48  1.00      7.00      6.00  0.00    -1.08
## Degree_Engg             0.00  0.00      1.00      1.00  2.76     5.63
## Experience_Yrs          0.00  0.00      3.00      3.00  1.27     1.17
## Entrance_Test*          0.00  1.00      9.00      8.00 -2.52     7.04
## S.TEST                  0.00  0.00      1.00      1.00 -1.74     1.02
## Percentile_ET          25.20  0.00     98.69     98.69 -0.74    -0.69
## S.TEST.SCORE           25.20  0.00     98.69     98.69 -0.74    -0.69
## Percent_MBA             6.39 50.83     77.89     27.06  0.34    -0.52
## Specialization_MBA*     0.00  1.00      3.00      2.00  0.70    -0.56
## Marks_Communication     8.90 50.00     88.00     38.00  0.74    -0.25
## Marks_Projectwork       7.41 50.00     87.00     37.00 -0.26    -0.27
## Marks_BOCA             11.86 50.00     96.00     46.00  0.29    -0.85
## Placement*              0.00  1.00      2.00      1.00 -1.48     0.19
## Placement_B             0.00  0.00      1.00      1.00 -1.48     0.19
## Salary              88956.00  0.00 940000.00 940000.00  0.24     1.74
##                          se
## SlNo                   5.72
## Gender*                0.02
## Gender.B               0.02
## Percent_SSC            0.55
## Board_SSC*             0.04
## Board_CBSE             0.02
## Board_ICSE             0.02
## Percent_HSC            0.58
## Board_HSC*             0.04
## Stream_HSC*            0.03
## Percent_Degree         0.45
## Course_Degree*         0.08
## Degree_Engg            0.01
## Experience_Yrs         0.03
## Entrance_Test*         0.07
## S.TEST                 0.02
## Percentile_ET          1.58
## S.TEST.SCORE           1.58
## Percent_MBA            0.30
## Specialization_MBA*    0.03
## Marks_Communication    0.45
## Marks_Projectwork      0.36
## Marks_BOCA             0.48
## Placement*             0.02
## Placement_B            0.02
## Salary              6994.72
# 3a.  calculate the median salary of all the students in the data sample
library(psych)

median(dean.df$Salary)
## [1] 240000
# 3b.  the percentage of students who were placed, correct to 2 decimal places.
placedTable <- table(dean.df$Placement)
placedTable
## 
## Not Placed     Placed 
##         79        312
prop.table(placedTable)*100
## 
## Not Placed     Placed 
##    20.2046    79.7954
# 3c.  to create a dataframe called placed. 
subset(dean.df,Placement_B==1,select =c("Placement", "SlNo"))
##     Placement SlNo
## 1      Placed    1
## 2      Placed    2
## 3      Placed    3
## 4      Placed    4
## 5      Placed    5
## 6      Placed    6
## 7      Placed    7
## 8      Placed    8
## 9      Placed    9
## 10     Placed   10
## 12     Placed   12
## 13     Placed   13
## 14     Placed   14
## 15     Placed   15
## 17     Placed   17
## 18     Placed   18
## 19     Placed   19
## 21     Placed   21
## 22     Placed   22
## 23     Placed   23
## 24     Placed   24
## 25     Placed   25
## 26     Placed   26
## 27     Placed   27
## 28     Placed   28
## 29     Placed   29
## 30     Placed   30
## 31     Placed   31
## 32     Placed   32
## 33     Placed   33
## 34     Placed   34
## 35     Placed   35
## 36     Placed   36
## 37     Placed   37
## 38     Placed   38
## 39     Placed   39
## 41     Placed   41
## 44     Placed   44
## 45     Placed   45
## 46     Placed   46
## 47     Placed   47
## 48     Placed   48
## 49     Placed   49
## 50     Placed   50
## 51     Placed   51
## 52     Placed   52
## 53     Placed   53
## 54     Placed   54
## 55     Placed   55
## 56     Placed   56
## 57     Placed   57
## 58     Placed   58
## 60     Placed   60
## 61     Placed   61
## 62     Placed   62
## 63     Placed   63
## 65     Placed   65
## 66     Placed   66
## 67     Placed   67
## 69     Placed   69
## 70     Placed   70
## 71     Placed   71
## 72     Placed   72
## 73     Placed   73
## 74     Placed   74
## 76     Placed   76
## 77     Placed   77
## 78     Placed   78
## 80     Placed   80
## 81     Placed   81
## 83     Placed   83
## 84     Placed   84
## 85     Placed   85
## 86     Placed   86
## 87     Placed   87
## 90     Placed   90
## 91     Placed   91
## 92     Placed   92
## 93     Placed   93
## 95     Placed   95
## 96     Placed   96
## 97     Placed   97
## 99     Placed   99
## 101    Placed  101
## 102    Placed  102
## 103    Placed  103
## 104    Placed  104
## 105    Placed  105
## 106    Placed  106
## 107    Placed  107
## 108    Placed  108
## 110    Placed  110
## 111    Placed  111
## 113    Placed  113
## 114    Placed  114
## 115    Placed  115
## 116    Placed  116
## 117    Placed  117
## 118    Placed  118
## 119    Placed  119
## 120    Placed  120
## 121    Placed  121
## 122    Placed  122
## 123    Placed  123
## 124    Placed  124
## 125    Placed  125
## 126    Placed  126
## 127    Placed  127
## 129    Placed  129
## 130    Placed  130
## 131    Placed  131
## 132    Placed  132
## 133    Placed  133
## 134    Placed  134
## 135    Placed  135
## 136    Placed  136
## 137    Placed  137
## 138    Placed  138
## 139    Placed  139
## 140    Placed  140
## 141    Placed  141
## 142    Placed  142
## 143    Placed  143
## 145    Placed  145
## 146    Placed  146
## 147    Placed  147
## 148    Placed  148
## 150    Placed  150
## 151    Placed  151
## 152    Placed  152
## 153    Placed  153
## 154    Placed  154
## 155    Placed  155
## 156    Placed  156
## 157    Placed  157
## 158    Placed  158
## 159    Placed  159
## 160    Placed  160
## 161    Placed  161
## 163    Placed  163
## 164    Placed  164
## 165    Placed  165
## 167    Placed  167
## 168    Placed  168
## 169    Placed  169
## 170    Placed  170
## 171    Placed  171
## 172    Placed  172
## 173    Placed  173
## 174    Placed  174
## 177    Placed  177
## 178    Placed  178
## 179    Placed  179
## 180    Placed  180
## 181    Placed  181
## 182    Placed  182
## 183    Placed  183
## 185    Placed  185
## 186    Placed  186
## 187    Placed  187
## 188    Placed  188
## 189    Placed  189
## 190    Placed  190
## 192    Placed  192
## 193    Placed  193
## 195    Placed  195
## 196    Placed  196
## 197    Placed  197
## 198    Placed  198
## 199    Placed  199
## 200    Placed  200
## 201    Placed  201
## 202    Placed  202
## 203    Placed  203
## 205    Placed  205
## 206    Placed  206
## 207    Placed  207
## 208    Placed  208
## 209    Placed  209
## 210    Placed  210
## 211    Placed  211
## 212    Placed  212
## 213    Placed  213
## 214    Placed  214
## 215    Placed  215
## 216    Placed  216
## 217    Placed  217
## 218    Placed  218
## 219    Placed  219
## 221    Placed  221
## 222    Placed  222
## 223    Placed  223
## 224    Placed  224
## 225    Placed  225
## 227    Placed  227
## 228    Placed  228
## 229    Placed  229
## 230    Placed  230
## 232    Placed  232
## 233    Placed  233
## 234    Placed  234
## 235    Placed  235
## 237    Placed  237
## 238    Placed  238
## 239    Placed  239
## 242    Placed  242
## 243    Placed  243
## 244    Placed  244
## 245    Placed  245
## 246    Placed  246
## 247    Placed  247
## 249    Placed  249
## 250    Placed  250
## 251    Placed  251
## 253    Placed  253
## 254    Placed  254
## 255    Placed  255
## 256    Placed  256
## 257    Placed  257
## 259    Placed  259
## 260    Placed  260
## 261    Placed  261
## 262    Placed  262
## 263    Placed  263
## 264    Placed  264
## 265    Placed  265
## 267    Placed  267
## 268    Placed  268
## 270    Placed  270
## 271    Placed  271
## 273    Placed  273
## 274    Placed  274
## 275    Placed  275
## 276    Placed  276
## 277    Placed  277
## 278    Placed  278
## 279    Placed  279
## 280    Placed  280
## 281    Placed  281
## 282    Placed  282
## 283    Placed  283
## 286    Placed  286
## 292    Placed  292
## 293    Placed  293
## 294    Placed  294
## 295    Placed  295
## 296    Placed  296
## 297    Placed  297
## 299    Placed  299
## 300    Placed  300
## 302    Placed  302
## 303    Placed  303
## 304    Placed  304
## 305    Placed  305
## 306    Placed  306
## 308    Placed  308
## 309    Placed  309
## 311    Placed  311
## 312    Placed  312
## 313    Placed  313
## 314    Placed  314
## 316    Placed  316
## 319    Placed  319
## 320    Placed  320
## 321    Placed  321
## 323    Placed  323
## 325    Placed  325
## 327    Placed  327
## 331    Placed  331
## 333    Placed  333
## 334    Placed  334
## 335    Placed  335
## 337    Placed  337
## 339    Placed  339
## 340    Placed  340
## 341    Placed  341
## 342    Placed  342
## 343    Placed  343
## 345    Placed  345
## 346    Placed  346
## 347    Placed  347
## 348    Placed  348
## 349    Placed  349
## 351    Placed  351
## 353    Placed  353
## 354    Placed  354
## 356    Placed  356
## 357    Placed  357
## 358    Placed  358
## 359    Placed  359
## 360    Placed  360
## 361    Placed  361
## 362    Placed  362
## 363    Placed  363
## 365    Placed  365
## 366    Placed  366
## 367    Placed  367
## 368    Placed  368
## 369    Placed  369
## 370    Placed  370
## 371    Placed  371
## 372    Placed  372
## 373    Placed  373
## 374    Placed  374
## 378    Placed  378
## 380    Placed  380
## 381    Placed  381
## 385    Placed  385
## 387    Placed  387
## 388    Placed  388
## 389    Placed  389
## 390    Placed  390
placed<-subset(dean.df,Placement_B==1,select =c("Placement", "SlNo"))

View(placed)

# 3d.  median salary of students who were placed.
placedsalary<-subset(dean.df,Placement_B==1,select =c("Placement", "SlNo", "Salary"))
View(placedsalary)

median(placedsalary$Salary)
## [1] 260000
# 3e.  mean salary of males and females, who were placed.
new.df<-subset(dean.df,Placement_B==1,select =c("Placement", "SlNo", "Salary", "Gender"))
new.df
##     Placement SlNo Salary Gender
## 1      Placed    1 270000      M
## 2      Placed    2 200000      M
## 3      Placed    3 240000      M
## 4      Placed    4 250000      M
## 5      Placed    5 180000      M
## 6      Placed    6 300000      M
## 7      Placed    7 260000      F
## 8      Placed    8 235000      M
## 9      Placed    9 425000      M
## 10     Placed   10 240000      F
## 12     Placed   12 250000      M
## 13     Placed   13 180000      M
## 14     Placed   14 428000      M
## 15     Placed   15 450000      M
## 17     Placed   17 300000      M
## 18     Placed   18 240000      M
## 19     Placed   19 252000      M
## 21     Placed   21 280000      M
## 22     Placed   22 231000      M
## 23     Placed   23 224000      M
## 24     Placed   24 120000      M
## 25     Placed   25 260000      M
## 26     Placed   26 300000      M
## 27     Placed   27 120000      M
## 28     Placed   28 120000      M
## 29     Placed   29 250000      M
## 30     Placed   30 180000      F
## 31     Placed   31 218000      F
## 32     Placed   32 360000      M
## 33     Placed   33 150000      M
## 34     Placed   34 250000      F
## 35     Placed   35 200000      F
## 36     Placed   36 300000      M
## 37     Placed   37 330000      M
## 38     Placed   38 265000      M
## 39     Placed   39 340000      M
## 41     Placed   41 177600      F
## 44     Placed   44 236000      M
## 45     Placed   45 265000      M
## 46     Placed   46 200000      M
## 47     Placed   47 393000      F
## 48     Placed   48 360000      F
## 49     Placed   49 300000      F
## 50     Placed   50 250000      M
## 51     Placed   51 360000      M
## 52     Placed   52 180000      F
## 53     Placed   53 180000      F
## 54     Placed   54 270000      M
## 55     Placed   55 240000      M
## 56     Placed   56 300000      M
## 57     Placed   57 265000      M
## 58     Placed   58 350000      M
## 60     Placed   60 250000      F
## 61     Placed   61 180000      F
## 62     Placed   62 278000      F
## 63     Placed   63 150000      M
## 65     Placed   65 260000      F
## 66     Placed   66 180000      M
## 67     Placed   67 300000      F
## 69     Placed   69 400000      M
## 70     Placed   70 320000      F
## 71     Placed   71 240000      F
## 72     Placed   72 411000      M
## 73     Placed   73 287000      F
## 74     Placed   74 198000      F
## 76     Placed   76 300000      M
## 77     Placed   77 200000      F
## 78     Placed   78 180000      F
## 80     Placed   80 204000      M
## 81     Placed   81 250000      M
## 83     Placed   83 200000      F
## 84     Placed   84 275000      M
## 85     Placed   85 192000      M
## 86     Placed   86 240000      F
## 87     Placed   87 300000      F
## 90     Placed   90 450000      M
## 91     Placed   91 216000      F
## 92     Placed   92 220000      M
## 93     Placed   93 216000      M
## 95     Placed   95 300000      M
## 96     Placed   96 240000      M
## 97     Placed   97 360000      M
## 99     Placed   99 268000      M
## 101    Placed  101 265000      M
## 102    Placed  102 260000      M
## 103    Placed  103 240000      M
## 104    Placed  104 300000      M
## 105    Placed  105 240000      F
## 106    Placed  106 180000      M
## 107    Placed  107 240000      M
## 108    Placed  108 400000      M
## 110    Placed  110 180000      M
## 111    Placed  111 250000      M
## 113    Placed  113 295000      F
## 114    Placed  114 180000      M
## 115    Placed  115 300000      F
## 116    Placed  116 240000      M
## 117    Placed  117 120000      M
## 118    Placed  118 250000      M
## 119    Placed  119 275000      M
## 120    Placed  120 275000      M
## 121    Placed  121 150000      F
## 122    Placed  122 275000      M
## 123    Placed  123 300000      M
## 124    Placed  124 240000      M
## 125    Placed  125 336000      M
## 126    Placed  126 360000      M
## 127    Placed  127 280000      M
## 129    Placed  129 325000      M
## 130    Placed  130 204000      M
## 131    Placed  131 240000      M
## 132    Placed  132 240000      M
## 133    Placed  133 336000      F
## 134    Placed  134 218000      M
## 135    Placed  135 216000      M
## 136    Placed  136 336000      M
## 137    Placed  137 190000      F
## 138    Placed  138 230000      F
## 139    Placed  139 390000      M
## 140    Placed  140 500000      M
## 141    Placed  141 270000      M
## 142    Placed  142 150000      F
## 143    Placed  143 240000      F
## 145    Placed  145 276000      F
## 146    Placed  146 300000      M
## 147    Placed  147 168000      M
## 148    Placed  148 300000      M
## 150    Placed  150 270000      M
## 151    Placed  151 360000      M
## 152    Placed  152 300000      M
## 153    Placed  153 400000      F
## 154    Placed  154 220000      M
## 155    Placed  155 180000      M
## 156    Placed  156 180000      M
## 157    Placed  157 210000      F
## 158    Placed  158 210000      F
## 159    Placed  159 300000      F
## 160    Placed  160 290000      F
## 161    Placed  161 180000      M
## 163    Placed  163 230000      F
## 164    Placed  164 282000      M
## 165    Placed  165 260000      M
## 167    Placed  167 180000      M
## 168    Placed  168 260000      M
## 169    Placed  169 400000      M
## 170    Placed  170 420000      M
## 171    Placed  171 144000      M
## 172    Placed  172 300000      F
## 173    Placed  173 150000      F
## 174    Placed  174 220000      F
## 177    Placed  177 380000      M
## 178    Placed  178 290000      M
## 179    Placed  179 300000      F
## 180    Placed  180 252000      F
## 181    Placed  181 280000      M
## 182    Placed  182 240000      M
## 183    Placed  183 360000      M
## 185    Placed  185 180000      M
## 186    Placed  186 450000      F
## 187    Placed  187 200000      M
## 188    Placed  188 300000      M
## 189    Placed  189 350000      M
## 190    Placed  190 550000      M
## 192    Placed  192 250000      M
## 193    Placed  193 250000      F
## 195    Placed  195 250000      M
## 196    Placed  196 280000      F
## 197    Placed  197 250000      M
## 198    Placed  198 216000      F
## 199    Placed  199 204000      M
## 200    Placed  200 300000      M
## 201    Placed  201 240000      M
## 202    Placed  202 276000      M
## 203    Placed  203 940000      M
## 205    Placed  205 250000      F
## 206    Placed  206 300000      M
## 207    Placed  207 180000      F
## 208    Placed  208 236000      F
## 209    Placed  209 240000      M
## 210    Placed  210 250000      M
## 211    Placed  211 350000      F
## 212    Placed  212 210000      M
## 213    Placed  213 210000      F
## 214    Placed  214 250000      F
## 215    Placed  215 400000      M
## 216    Placed  216 300000      M
## 217    Placed  217 480000      M
## 218    Placed  218 250000      M
## 219    Placed  219 320000      M
## 221    Placed  221 385000      M
## 222    Placed  222 360000      F
## 223    Placed  223 300000      M
## 224    Placed  224 375000      F
## 225    Placed  225 250000      M
## 227    Placed  227 250000      F
## 228    Placed  228 275000      F
## 229    Placed  229 200000      F
## 230    Placed  230 150000      F
## 232    Placed  232 300000      M
## 233    Placed  233 225000      M
## 234    Placed  234 120000      F
## 235    Placed  235 250000      F
## 237    Placed  237 220000      M
## 238    Placed  238 265000      M
## 239    Placed  239 265000      M
## 242    Placed  242 260000      M
## 243    Placed  243 300000      M
## 244    Placed  244 180000      M
## 245    Placed  245 530000      M
## 246    Placed  246 156000      M
## 247    Placed  247 263000      M
## 249    Placed  249 400000      M
## 250    Placed  250 233000      M
## 251    Placed  251 300000      M
## 253    Placed  253 240000      F
## 254    Placed  254 180000      M
## 255    Placed  255 350000      M
## 256    Placed  256 198000      M
## 257    Placed  257 250000      F
## 259    Placed  259 690000      M
## 260    Placed  260 270000      M
## 261    Placed  261 240000      F
## 262    Placed  262 300000      M
## 263    Placed  263 340000      M
## 264    Placed  264 250000      M
## 265    Placed  265 390000      M
## 267    Placed  267 255000      M
## 268    Placed  268 300000      M
## 270    Placed  270 150000      M
## 271    Placed  271 300000      M
## 273    Placed  273 270000      M
## 274    Placed  274 240000      F
## 275    Placed  275 180000      M
## 276    Placed  276 285000      M
## 277    Placed  277 400000      M
## 278    Placed  278 500000      M
## 279    Placed  279 250000      F
## 280    Placed  280 300000      M
## 281    Placed  281 240000      F
## 282    Placed  282 300000      M
## 283    Placed  283 240000      M
## 286    Placed  286 240000      M
## 292    Placed  292 476000      M
## 293    Placed  293 290000      M
## 294    Placed  294 690000      M
## 295    Placed  295 300000      M
## 296    Placed  296 250000      M
## 297    Placed  297 162000      F
## 299    Placed  299 260000      F
## 300    Placed  300 500000      M
## 302    Placed  302 220000      F
## 303    Placed  303 270000      M
## 304    Placed  304 650000      F
## 305    Placed  305 350000      M
## 306    Placed  306 300000      M
## 308    Placed  308 265000      M
## 309    Placed  309 180000      M
## 311    Placed  311 300000      F
## 312    Placed  312 300000      F
## 313    Placed  313 300000      F
## 314    Placed  314 220000      F
## 316    Placed  316 240000      M
## 319    Placed  319 276000      M
## 320    Placed  320 250000      M
## 321    Placed  321 180000      F
## 323    Placed  323 252000      F
## 325    Placed  325 280000      M
## 327    Placed  327 350000      F
## 331    Placed  331 216000      F
## 333    Placed  333 264000      M
## 334    Placed  334 270000      M
## 335    Placed  335 300000      F
## 337    Placed  337 275000      M
## 339    Placed  339 300000      M
## 340    Placed  340 250000      M
## 341    Placed  341 260000      F
## 342    Placed  342 185000      F
## 343    Placed  343 216000      F
## 345    Placed  345 265000      M
## 346    Placed  346 300000      M
## 347    Placed  347 325000      M
## 348    Placed  348 267000      M
## 349    Placed  349 264000      F
## 351    Placed  351 240000      M
## 353    Placed  353 260000      M
## 354    Placed  354 240000      F
## 356    Placed  356 250000      M
## 357    Placed  357 180000      F
## 358    Placed  358 366000      F
## 359    Placed  359 210000      F
## 360    Placed  360 250000      M
## 361    Placed  361 250000      M
## 362    Placed  362 426000      M
## 363    Placed  363 270000      M
## 365    Placed  365 300000      M
## 366    Placed  366 132000      M
## 367    Placed  367 144000      F
## 368    Placed  368 220000      M
## 369    Placed  369 216000      M
## 370    Placed  370 400000      M
## 371    Placed  371 275000      M
## 372    Placed  372 295000      M
## 373    Placed  373 360000      M
## 374    Placed  374 204000      F
## 378    Placed  378 350000      M
## 380    Placed  380 300000      F
## 381    Placed  381 180000      M
## 385    Placed  385 252000      M
## 387    Placed  387 162000      M
## 388    Placed  388 450000      M
## 389    Placed  389 240000      M
## 390    Placed  390 300000      F
surviversByClass <- xtabs(~ Salary+Gender, data=new.df)
surviversByClass
##         Gender
## Salary    F  M
##   120000  1  4
##   132000  0  1
##   144000  1  1
##   150000  4  3
##   156000  0  1
##   162000  1  1
##   168000  0  1
##   177600  1  0
##   180000  8 16
##   185000  1  0
##   190000  1  0
##   192000  0  1
##   198000  1  1
##   200000  4  3
##   204000  1  3
##   210000  4  1
##   216000  4  3
##   218000  1  1
##   220000  3  4
##   224000  0  1
##   225000  0  1
##   230000  2  0
##   231000  0  1
##   233000  0  1
##   235000  0  1
##   236000  1  1
##   240000 10 18
##   250000  9 20
##   252000  2  2
##   255000  0  1
##   260000  4  6
##   263000  0  1
##   264000  1  1
##   265000  0  8
##   267000  0  1
##   268000  0  1
##   270000  0  9
##   275000  1  6
##   276000  1  2
##   278000  1  0
##   280000  1  4
##   282000  0  1
##   285000  0  1
##   287000  1  0
##   290000  1  2
##   295000  1  1
##   300000 13 30
##   320000  1  1
##   325000  0  2
##   330000  0  1
##   336000  1  2
##   340000  0  2
##   350000  2  5
##   360000  2  7
##   366000  1  0
##   375000  1  0
##   380000  0  1
##   385000  0  1
##   390000  0  2
##   393000  1  0
##   400000  1  7
##   411000  0  1
##   420000  0  1
##   425000  0  1
##   426000  0  1
##   428000  0  1
##   450000  1  3
##   476000  0  1
##   480000  0  1
##   500000  0  3
##   530000  0  1
##   550000  0  1
##   650000  1  0
##   690000  0  2
##   940000  0  1
mean(surviversByClass)
## [1] 2.08
# 3f.  histogram showing a breakup of the MBA performance of the students who were placed
library(lattice)

histogram(~SlNo | Placement, data=placed)

# 3g.  dataframe called notplaced, that contains a subset of only those students who were NOT placed after their MBA.
notplaced<-subset(dean.df,Placement_B==0,select =c("Placement", "SlNo"))

View(notplaced) 

# 3h. histograms side-by-side, of Placed and Not Placed students, as follows:
library(lattice)

histogram(~SlNo | Placement, data=dean.df, layout=c(2,1))

# 3i. two boxplots comparing salaries of males and females who were placed, as follows:
library(lattice)

bwplot(Gender ~ Salary, data=new.df, xlab = "salary" )

# 3j. dataframe called placedET, students in the MBA and gave some MBA entrance test  

ET<-subset(dean.df,S.TEST==1, select =c("Placement", "SlNo", "Entrance_Test","Salary", "Percent_MBA", "Percentile_ET", "Placement_B"))
placedET<-subset(ET,Placement_B==1, select =c("Placement", "SlNo", "Entrance_Test","Salary", "Percent_MBA", "Percentile_ET"))

View(placedET)

# 3k  Scatter Plot Matrix for Salary, Percent_MBA, Percentile_ET


####i was getting error by using scatterplotMatix###
#library(car)
#scatterplotMatrix(formula= ~ Salary + Percent_MBA + Percentile_ET, cex=0.6, data(placedET), diagonal="hisogram")
plot(placedET[4:6]) #so solved it this way.