Re: [R] What don't I understand about sample()?

2025-03-13 Thread Ebert,Timothy Aaron
This is fun. In a stats class you are trying to deal with data. There is the underlying distribution. This is the random number generator. I have a population that is following the underlying distribution. In this case my population is 10,000 individuals with a true population mean of 40 and a s

Re: [R] R GUI randomly resizes. Is this a known bug?

2025-03-13 Thread Ivan Krylov via R-help
В Mon, 10 Mar 2025 17:04:52 +0700 ora...@quantbo.com пишет: > From time to time when I run a lengthy program the GUI will > spontaneously shrink to about 2/3 of its size, with the fonts also > shrunk, then jump back to full size. Back and forth, back and forth. It looks like the kind of resizing

Re: [R] What don't I understand about sample()?

2025-03-13 Thread Bert Gunter
Bravo for your unrequired R efforts. You misunderstand the nested call. sample() is called only once, producing 1 sample of 10 with replacement. Since your matrix call needs 50 values, ?matrix tells you (in details): "If there are too few elements in data to fill the matrix, then the elements in d

Re: [R] What don't I understand about sample()?

2025-03-13 Thread avi.e.gross
Kevin, It is simple. Your matrix has fifty entries and you supplied just 10. R tends to quietly assume you want the sample repeated as often as needed as long as it can be used in whole amounts. So, you get five copies. If you interchanged rows and columns with byrow=FALSE then every two rows woul

Re: [R] What don't I understand about sample()?

2025-03-13 Thread Greg Snow
Your call to `sample` does not specify the `size` or the number of values to return, so it defaults to the same number in `x`, in this case 10. The `matrix` function then repeats the vector of 10 enough times to fill in the matrix. To do what you want you just need to specify the `size` as the to

Re: [R] What don't I understand about sample()?

2025-03-13 Thread Iris Simmons
The textbook uses an extra argument 'size'. If you do the same, it should work. matrix(sample(1:10, size = 5 * 10, replace=TRUE), 5, 10, byrow=TRUE) On Thu, Mar 13, 2025, 17:23 Kevin Zembower via R-help wrote: > Hello, all, > > I'm learning to do randomized distributions in my Stats 101 class*.

[R] What don't I understand about sample()?

2025-03-13 Thread Kevin Zembower via R-help
Hello, all, I'm learning to do randomized distributions in my Stats 101 class*. I thought I could do it with a call to sample() inside a matrix(), like: > matrix(sample(1:10, replace=TRUE), 5, 10, byrow=TRUE) [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,]82318

Re: [R] How to customize legend labels in ggplot2?

2025-03-13 Thread Luigi Marongiu
Thank you, that is exactly was I was looking for. On Thu, Mar 13, 2025 at 8:16 AM Rui Barradas wrote: > > Hello, > > Inline. > > Às 05:19 de 13/03/2025, Luigi Marongiu escreveu: > > Thank you, but then I will have long labels also on the axis, > > > I am not getting the same legend labels and axi