Posts by Pedro Cavalcante • 151 points
3 posts
-
0
votes0
answers42
viewsQ: How to multiply the number of votes in the R?
This piece of code is inside a function I’m writing. In the last two lines is my problem. firm1 = quote(q0_1 + c1 * q1 + c1_2 * q1) ## firm 1's cost curve firm2 = quote(q0_2 + c2 * q2 + c2_2 * q2)…
rasked Pedro Cavalcante 151 -
3
votes2
answers52
viewsA: How does a forloop generate random values, then "appenda" the next set of generated values?
Well, I was able to solve it before Mr Fernandes replied. Here is a solution: datalist = list() ## Util depois para aglutinar os dados for (i in 1:k){ x <- rnorm(mean = i, sd = .1, n=m) y <-…
-
2
votes2
answers52
viewsQ: How does a forloop generate random values, then "appenda" the next set of generated values?
k <- 8 m = 100 for (i in 1:k){ x <- rnorm(mean = i, sd = .5, n=m) y <- rnorm(mean = (8-i), sd = .5, n=m) amostra2 <- data.frame(x,y) } This is the code I have. Given k and m, I give…