SHARE
TWEET

getdataframe.R

ansakoy Oct 26th, 2013 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # This function was written to create a general data frame for the output
  2. # of this function: http://pastebin.com/eTJHsS6A
  3.  
  4. getdataframe <- function (data) {
  5.   data <- readLines("homicides.txt")
  6.   causes <- c("asphyxiation", "blunt force", "shooting",
  7.               "stabbing", "other", "unknown")
  8.   df <- data.frame(Cause = character(),
  9.                    Gender = character(),
  10.                    stringsAsFactors=FALSE)
  11.   for (i in causes) {
  12.     cause <- i
  13.     result <- gendercause(data, cause)
  14.     df <- rbind(result, df)
  15.   }
  16.   return(df)
  17. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top