Video games under development with grants

Data source: ’https://www.sbir.gov/sbirsearch/award/all/video%2520game?firm=&topic=’

Document-Term Matrix was projected onto 3D space and the target population “child|teen|school” and “military” was colored.

suppressMessages(library(tidyverse));suppressMessages(library(foreach))
## Warning: package 'ggplot2' was built under R version 3.4.4
## Warning: package 'tibble' was built under R version 3.4.4
## Warning: package 'tidyr' was built under R version 3.4.4
## Warning: package 'readr' was built under R version 3.4.4
## Warning: package 'purrr' was built under R version 3.4.4
## Warning: package 'dplyr' was built under R version 3.4.4
## Warning: package 'stringr' was built under R version 3.4.4
## Warning: package 'forcats' was built under R version 3.4.4
suppressMessages(library(RJSONIO))
## Warning: package 'RJSONIO' was built under R version 3.4.4
df <- fromJSON("sbir-search-results.json")
df <- foreach(i=seq_along(df), .combine = rbind) %do% {
        data.frame(df[[i]]) %>% t
  }
df <- as_tibble(df)
df$abstract <- str_replace_all(df$abstract, "\\\n", " ") %>% 
  str_remove_all("\\(|\\)")

Video Game for Health or Education

suppressMessages(library(tm));suppressMessages(library(Rtsne))
## Warning: package 'tm' was built under R version 3.4.4
## Warning: package 'NLP' was built under R version 3.4.4
## Warning: package 'Rtsne' was built under R version 3.4.4
corpus <- VCorpus(VectorSource(df$abstract))
corpus <- tm_map(corpus, content_transformer(tolower))
corpus <- tm_map(corpus, removeWords, stopwords("en"))
corpus <- tm_map(corpus, removeNumbers)
corpus <- tm_map(corpus, removePunctuation)
corpus <- tm_map(corpus, stemDocument)
dtm <- DocumentTermMatrix(corpus)
dtm <- as.matrix(dtm) %>% as.data.frame()

tsne <- Rtsne(dtm, dims=3, pca=TRUE, perplexity=10, check_duplicates=F)
tsneY <- data.frame(tsne$Y)
tsneY$label <- NA

child <- which(str_detect(df$abstract, regex("child|teen|school", ignore_case = T)))
military <- which(str_detect(df$abstract, regex("military", ignore_case = T)))
tsneY$label[child] <- "Child"
tsneY$label[military] <- "Military"

suppressMessages(library(canvasXpress))
## Warning: package 'canvasXpress' was built under R version 3.4.4
z <- data.frame(label=tsneY$label)
row.names(z) <- paste0(1:nrow(df), "_", df$award_title)
row.names(tsneY) <- paste0(1:nrow(df), "_", df$award_title)
canvasXpress(data = tsneY[,-4],
             varAnnot  = z,
             colorBy   = "label",
             #ellipseBy = "label",
             graphType = "Scatter3D",
             title     = "SBIR Video Game",
             xAxis     = tsneY$X1,
             yAxis     = tsneY$X2,
             zAxis     = tsneY$X3
     )
## Grant-awarded Pproject with a term of either “child|teen|school” or military