Search results

  1. J

    Visualising hierarchical multiple regression

    No problem. It sounds like you might be from a behavioral science background (from where I also hail) and I know the terminology can be different. For example if you were to say mixed model, you might mean one between factor and one within factor, where as in other areas, people might interpret...
  2. J

    Visualising hierarchical multiple regression

    When you say hierarchical multiple regression do you mean: (1) You've added independent variables into the final model in stages (e.g. model with 1 IV, model with 1IV and another, etc, etc) or (2) A regression model with random effects (which can be viewed as a Multilevel Model) I believe...
  3. J

    ANOVA or Poisson Regression

    Hi j58, Many thanks for your reply and valuable insights. I'll definitely look into the assumptions of the ANOVA more closely when I get back into the office. I like the idea of a random intercept model in the logit approach to capture variability - will bring these back to the group. Best,
  4. J

    ANOVA or Poisson Regression

    Hi all, I want to get some feedback on the approaches I've considered for an analysis. Here is the setup Unit of analysis: Physician Variables: Physician Specialty, Number of Total Patients they take care of, Number of patients who are diabetic. A typical line of data looks like this...
  5. J

    right join with dplyr make rows columns

    my_output = data1 %>% group_by(ProductCode) %>% mutate(n_promo=n()) %>% right_join(data2) %>% distinct(ProductCode, region, Period, promosales, n_promo) %>% spread(Period, promosales, fill=0) Will get the desired output. Looks like the distinct() function changed from the...
  6. J

    right join with dplyr make rows columns

    I've updated the previous post with that bit. cheers, I'm not sure why it's throwing that error. Can you check that your variable names are correctly named and of proper case? I'm using R 3.1.2 (Pumpkin Helmet) with dplyr 0.4.1 and tidyr 0.2.0 and it works fine. Granted my system here at...
  7. J

    right join with dplyr make rows columns

    This can work. library(tidyr) library(dplyr) my_output = data1 %>% group_by(productcode) %>% mutate(n_promo=n()) %>% right_join(data2) %>% distinct(productcode, region, period) %>%...
  8. J

    R package development

    Thanks Dason! I think I have it up and running, perhaps you can try it out. I have a small R script (attached) that calls the package from github, loads it, and executes an example. Development with github has been a bit difficult for me - I think I understand the concept of it but using it...
  9. J

    R package development

    Thanks for the reply Dason! I have it working now but I'm still a bit unsure how (the answer is confounded) I noticed I had an error in one of my #' @param statements in the program header, so I fixed this. I also made a file called globals.R and stuck the...
  10. J

    R package development

    Hi! I'm attempting to write an R package based on some functions I wrote. I think I have everything down but I've ran into a road block I'm hoping you can help with. I'm using R-Studio, R 3.4.4 and roxygen to do my bidding. I'm trying to run a check (--as-cran) and both of my functions (dsr.R...
  11. J

    Today I Learned: ____

    TIL a little about standard and non-standard evaluation when attempting to create a function using dplyr. library(dplyr) #Make some data dats <- data.frame(type=rep(c("a","b"),c(4,5)), category=rep(c("apples","oranges"),c(5,4))...
  12. J

    R markdown embed googlevis plot into wordpress

    Likely a google issue. I recognize your code as the example code in the googleVis package, so it should work. I get the same result on my end after running it, with the latest googleVis installed. I believe this package works by sending your data to a google server and returns a rendered...
  13. J

    Today I Learned: ____

    Hey guys, Here is a bare bones example that will work both locally and on shinyapps.io. Just a few things: -The g-mail settings work as is. The only thing you need to change is the actual account and password for the test account you setup. -On the g-mail website, you may first need to...
  14. J

    Today I Learned: ____

    For sure! I will post an example using that exact html template and give an overview/annotation of what I did. I will upload the entire app as a zip later today. I have it working using google's g-mail service. It would be helpful if you can register a g-mail account to test out the app...
  15. J

    Today I Learned: ____

    TIL Today is 2 fold: (1) integrate an e-mail submission form in R-Shiny using the sendmailR package. (2) modify and manipulate existing html objects from an html template (which relies on js/css) in shiny. Example: https://html5up.net/prologue I've essentially brought to life the 'contact...
  16. J

    Algorithms for Spawning in Multiplayer games

    Thanks for the reply! I'm still unsure how they actually do it after researching. So far, I've taken your approach on an objective function and started to program something really crude. -I have a grid from 0 to 10 (on X, and Y) which serves as the multiplayer map. -I uniformly generate 3...
  17. J

    Algorithms for Spawning in Multiplayer games

    Hi! I've been thinking a lot about how video games such as Call of Duty or (any multiplayer game) might determine where to re-spawn you if you are killed in a match. I'm not sure what statistical or machine learning techniques could be applied. This is all very crude, but let me give you a...
  18. J

    Today I Learned: ____

    TIL How to use the htmltemplate() function in Shiny to build an app on an existing html page. Very basic and overlooked, but super useful.
  19. J

    Today I Learned: ____

    TIL I finally started to learn (and use) Rmarkdown. Powerful stuff....
  20. J

    R function parameter question

    Thanks Dason! This definitely worked and pointed me in the right direction for other searches. I see that quite a lot has been written about writing functions that use ggplot2 now :) Cheers!