Creating network data for a particular department

  • R scripts needed - superBatch.r, individualLevelBatch.r, commonUtils.r put them all together in the basePath directory.
  • Download and install R from one of the sites listed at (get the precompiled binary version for Windows or Mac)
  • Start R and install the following packages - sna, network, RMySQL (case sensitive names).
  • To Install a package go to the menu bar "Packages" -> "Install Package(s).."
  • Select any mirror site, this just affects the download speed. Mostly the USA (CA) mirrors give best download speeds.
  • A list of packages will be shown, select name of the package and select "Okay". This will download and install the selected package.
  • In the file commonUtils.r edit the first three lines to match the current MySQL settings - something like:
    # Database Parameters <- "" <- "minerva"
    db.user <- "minerva_r2"
  • In the file superBatch.r, update the variable basePath to point to the directory where all the scripts are and output will be placed. For example -
    basePath <-"C:\\Users\\nikhil\\Desktop\\Stanford\\Work\\Mimir\\ed-graph-4-28-2010";
    (on Mac use the Mac way of defining directory paths)
    All the scripts need to be put together in the basePath directory.
  • The script superBatch.r calls the main batch creation module, once for any department. If it is needed to create the network data for any one particular department, only two lines are needed. For example, for the education department -

    #Education = 606
    nodeQuery1 <- "select person_id, primary_department_id from faculty_years where primary_department_id = 606 group by person_id order by person_id";


    • For any department, just change the SQL query parameter primary_department_id to match that department's department_id.
    • output_dir is the name of the directory inside basePath where all the network files will be output.
    • db_password is the password for the MySQL username.


  • To execute a script go to menu "Edit" -> "Run All"
  • Finding a departments ID - launch MySQL query client and run the query - select * from departments_aliases where alias like '%NAME%'
    Replace NAME with part of the departments name, like COMPUTER, EDUCATION etc. The % need to be maintained for generality - for example the query -
    select * from departments_aliases where alias like '%computer%'

    id Alias Department_id
    25 CCRMA - Computer Mus 98
    26 CCRMA - Computer Music 98
    60 Computer Science 160