# Recent content by trinker

1. ### [R Graphics] Beautiful graphics thread

https://github.com/GuangchuangYu/yyplot 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()
2. ### 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...
3. ### 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...
4. ### Do you use return

@Dason Yihui uses return like I do : https://yihui.name/en/2018/01/stop-early/
5. ### 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?
6. ### How's the new look?

@quark I dig it...one 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
7. ### 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.
8. ### Do you use return

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

I use it in an if statement to keep it one line rather than an else
10. ### 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: http://scrumage.com/blog/2015/09/agile-project-forecasting-the-monte-carlo-method/ 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...
11. ### How do I read github csv into R?

Let's say I got a csv on GitHub how do I read it into R?
12. ### Math notation break set into n length groups

I have a vector of length 26 and want to split it into groups of length 5. I can write it in code but what's the math notation for breaking a set up into n length groups keeping the elements consecutively ordered? Using what Bryan Goodrich wrote here...
13. ### Confidence intervals for proportions: approximating a discrete distribution with a co

I saw on this website http://onlinestatbook.com/2/estimation/proportion_ci.html The following quote about calculating a CI for a proportion: Giving: p \pm Z_{.95}\sqrt{\frac{p(1-p)}{N}} \pm \frac{.5}{N} Where (it appears) N is the sample size. Another website...
14. ### Python nested list compared to R's

Are these two things equivalent in R and Python respectively? r <- list(list(c("a", "b"), c("d", "e")), list(c("f", "g"), c("h", "i"))) python = [[("a", "b"), ("d", "e")], [("f", "g"), ("h", "i")]]
15. ### Determine distribution and parameters

I have a question but maybe it's the wrong question so I'll state the task first... I want to make data that looks like the data I'm working with without actually being the data itself. So I want to maintain structure as much as possible and generate an n row data set with similar...