Next, complete the following warmup exercises as a team.
// TODO: replace with code that computes the actual result
return _.compact(_.uniq(_.pluck(data, 'Subject')))
They are 113 unique subject codes.
// TODO: replace with code that computes the actual result
var size = _.size(_.filter(data,'Subject','CSCI'));
return size
They are 63 computer science courses.
var groups = _.groupBy(data, 'Subject');
var subjCount = _.mapValues(groups, function(d){
return d.length;
})
return subjCount
| HIST | 78 |
| HONR | 20 |
| HUMN | 17 |
| IAFS | 20 |
| IPHY | 134 |
| LING | 33 |
| MATH | 232 |
| MCDB | 117 |
| BAKR | 3 |
| PHIL | 160 |
| PHYS | 76 |
| PSCI | 117 |
| NRSC | 17 |
| PSYC | 123 |
| WRTG | 402 |
| RLST | 24 |
| SLHS | 70 |
| SOCY | 136 |
| ARAB | 10 |
| PORT | 7 |
| SPAN | 162 |
| COMR | 12 |
| FARR | 20 |
| GSAP | 3 |
| INVS | 11 |
| PACS | 4 |
| SEWL | 8 |
| DNCE | 62 |
| THTR | 66 |
| WMST | 29 |
| ACCT | 45 |
| BADM | 31 |
| BCOR | 53 |
| BSLW | 3 |
| BUSM | 3 |
| CESR | 7 |
| ESBM | 24 |
| FNCE | 44 |
| INBU | 7 |
| MBAC | 20 |
| MBAX | 34 |
| MGMT | 57 |
| MKTG | 37 |
| REAL | 12 |
| EDUC | 139 |
| ASEN | 48 |
| CHEN | 49 |
| CSCI | 63 |
| AREN | 23 |
| CVEN | 77 |
| ECEN | 67 |
| EMEN | 23 |
| EHON | 5 |
| GEEN | 65 |
| EVEN | 2 |
| HUEN | 37 |
| MCEN | 90 |
| TLEN | 24 |
| ATLS | 44 |
| MUSM | 5 |
| RSEI | 2 |
| JOUR | 96 |
| LAWS | 176 |
| CONV | 2 |
| EMUS | 42 |
| MUEL | 44 |
| MUSC | 95 |
| PMUS | 56 |
| TMUS | 2 |
| AIRR | 12 |
| MILR | 9 |
| NAVR | 9 |
| CSVC | 1 |
| LDSP | 14 |
| NRLN | 1 |
| PRLC | 3 |
| ARCH | 1 |
| ENVD | 59 |
| ARTH | 13 |
| ARTS | 52 |
| CAMW | 2 |
| CWCV | 1 |
| LGBT | 1 |
| LIBB | 6 |
| CHIN | 10 |
| FRSI | 1 |
| HIND | 1 |
| JPNS | 16 |
| KREN | 3 |
| ANTH | 53 |
| APPM | 52 |
| ASTR | 23 |
| ARSC | 24 |
| ATOC | 25 |
| CHEM | 139 |
| CLAS | 27 |
| COMM | 78 |
| EBIO | 113 |
| ECON | 61 |
| ENGL | 125 |
| ENVS | 20 |
| ETHN | 22 |
| FILM | 33 |
| FREN | 30 |
| ITAL | 16 |
| GEOG | 28 |
| GEOL | 37 |
| GRMN | 26 |
| HEBR | 5 |
| RUSS | 16 |
| SCAN | 4 |
| SWED | 1 |
| LEAD | 1 |
var groups = _.groupBy(data, 'Subject');
var subjCount = _.mapValues(groups, function(d){
return d.length;
});
var subj100 = _.pick(subjCount, function(d){
return d > 100;
});
return subj100;
| IPHY | 134 |
| MATH | 232 |
| MCDB | 117 |
| PHIL | 160 |
| PSCI | 117 |
| PSYC | 123 |
| WRTG | 402 |
| SOCY | 136 |
| SPAN | 162 |
| EDUC | 139 |
| LAWS | 176 |
| CHEM | 139 |
| EBIO | 113 |
| ENGL | 125 |
var groups = _.groupBy(data, 'Subject');
var subjCount = _.mapValues(groups, function(d){
var enrollNumbers = _.pluck(d, 'N.ENROLL')
return _.sum(enrollNumbers)
})
var subj5000 = _.pick(subjCount, function(d){
return d > 5000;
});
return subj5000;
// TODO: replace with code that computes the actual result
return {"IPHY": 5507,"MATH": 8725,"PHIL": 5672,"PHYS": 8099,"PSCI": 5491}
| IPHY | 5507 |
| MATH | 8725 |
| PHIL | 5672 |
| PHYS | 8099 |
| PSCI | 5491 |
| PSYC | 8477 |
| WRTG | 7185 |
| SOCY | 7932 |
| BCOR | 6852 |
| LAWS | 5166 |
// TODO: replace with code that computes the actual result
var tomClass = _.filter(data,function(d){
x = _.where(d['Instructors'], { 'name': "YEH, PEI HSIU" });
//if (_.size(x) >0) {console.log(x)}
return _.size(x);
});
//console.log (tomClass)
return _.pluck(tomClass,'Course')
They are 4830,4830.