Recent content by trinker

  1. trinker

    Bookclub: ISLR

    Not a book but a text of sorts: Wanted to get people's thoughts...
  2. trinker

    Today I Learned: ____

    @jamesmartinn What are you thoughts on the interface for writing the functions? Did you like/dislike it? Was the approach simple? Could you generalize it to new situations?
  3. trinker

    Today I Learned: ____

    @jamesmartinn Nice. Do you have the source code for this available that you'd be willing to share?
  4. trinker

    quantile-quantile plot (qqplot) in R by hand-ish

    Thanks @Dason myppoints <- function(x, a = if(length(x) <= 10) 3/8 else 1/2) ((1:length(x)) - a)/(length(x) + (1-a)-a) par(mfrow = c(2, 1)) plot(qnorm(myppoints(x)), sort(x), xlim = c(-1.5, 1.5)) lines(qnorm(.25), ) qqnorm(x) qqline(x) Not sure yet why the adjustments but the paper...
  5. trinker

    quantile-quantile plot (qqplot) in R by hand-ish

    My understanding of a qqplot was it was the sorted values for a variable on the y against the theoretical values from a normal (or whatever distribution) distribution on the x. We can get the y values from our sample and the x values from looking up the p value in a given distribution and...
  6. trinker

    [R Graphics] Beautiful graphics thread Not beautiful but clever: if (!require("pacman")) install.packages("pacman") pacman::p_load_current_gh('GuangchuangYu/yyplot') ggplot(mtcars, aes(x = mpg, y = hp)) + geom_cake()
  7. trinker

    Creating or editing Matrix

    Another approach if it's a diagonal matrix (off-diagonals are all zero): vv <- matrix(0, nrow=6, ncol=6, dimnames = lapply(1:2, function(i) c("EPA1", "EPA2", "EPA3", "EPA4", "EPA5", "EPA6")) ) diag(vv) <- c(2, 1, 5, 6, 9, 7) vv ## EPA1 EPA2 EPA3 EPA4 EPA5 EPA6 ## EPA1 2 0...
  8. trinker

    How to create a simple list

    What you have is a nested list of lists. So yes that's one way to make a list. ## Your data a <-list(name = "James", Courses = c("Math", "Physics", "Chemistry")) b <- list (name = "Peter", Courses = c("English", "History", "Sociology")) Student_Data = list(a,b) You can access your Courses...
  9. trinker

    Do you use `return`

    @Dason Yihui uses return like I do :
  10. trinker

    Replacing all instances of -99 to NA

    You can also set the missing values to NA when you read the data in. How did you get the data into R?
  11. trinker

    How's the new look?

    @quark I dig small thing...when I hover over icons to figure out what they are the text comes up where the cursor is, making the text that pops up unreadable ....Though it's not the same for all computers I use
  12. trinker

    Do you use `return`

    Yeah but to me the return is more readable. Plus they can get nested. There may be 3-5 of these if() return() lines in there. It helps to avoid a bunch of nested if/elses.
  13. trinker

    Do you use `return`

    fun <- function(x, ...){ if (x < 5) return('Low') 'High' } fun(3) ## [1] "Low" fun(8) ## [1] "High"
  14. trinker

    Do you use `return`

    I use it in an if statement to keep it one line rather than an else
  15. trinker

    Monte Carlo Simulation for Predicting Agile Stories Completed

    A team at work saw this post on using MC for predicting a forcast of stories completed: I have a series of questions as I know of Monte Carlo Simulation but have not used them. 1. Is the basic gist: Get mean and...