Re: [R] Help with simulation of unbalanced clustered data

2020-12-16 Thread Abby Spurdle
Hi Chao Liu, I'm having difficulty following your question, and examples. And also, I don't see the motivation for increasing, then decreasing the sample sizes. Intuitively, one would compute the correct sample sizes, first time round... But I thought I'd add some comments, just in case they're u

Re: [R] How to specify year-month-day for a plot

2020-12-16 Thread Jeff Newmiller
Don't set the header argument to TRUE if your data does not have a header? On December 16, 2020 11:09:18 AM PST, Gregory Coats via R-help wrote: >I would like to be able to draw and label a vertical line, representing >the date of some arbitrary event. The date of the first non-zero entry >is 20

[R] Fw: space between bars of a group in ggplot2

2020-12-16 Thread azam jaafari via R-help
- Forwarded Message - From: PIKAL Petr To: azam jaafari Cc: r-help mailing list Sent: Wednesday, December 16, 2020, 3:39:06 PM GMT+3:30Subject: RE: [R] space between bars of a group in ggplot2 Hi, Keep your emails on the list, please. here are some artificial data dput(dat) str

Re: [R] How to specify year-month-day for a plot

2020-12-16 Thread Gregory Coats via R-help
I would like to be able to draw and label a vertical line, representing the date of some arbitrary event. The date of the first non-zero entry is 2013-11-29. How would I draw and label a red vertical line at 2019-04-06? Greg gcdf<-read.table(text="2013-11-29 00.000 2013-12-29 19.175 2014-01-20 1

Re: [R] How to specify year-month-day for a plot

2020-12-16 Thread Bill Dunlap
You didn't show the entire call to read.table. If it included the argument header=TRUE then it would make the first entry in each column the name of the column. Use header=FALSE (or omit the header argument) if you don't want the first entry to be considered the column name. -Bill On Wed, Dec 1

Re: [R] How to specify year-month-day for a plot

2020-12-16 Thread Gregory Coats via R-help
I added a zero initial entry to the data set. Greg gcdf<-read.table(text="2013-11-29 00.000 2013-12-29 19.175 2014-01-20 10.072 2014-02-12 10.241 2014-03-02 05.916 > On Dec 16, 2020, at 12:32 PM, Gregory Coats via R-help > wrote: > > Jim, Thank you! > The data set begins > gcdf<-read.table(text

Re: [R] Help with simulation of unbalanced clustered data

2020-12-16 Thread Jeff Newmiller
Sigh. You still haven't read the Posting Guide? HTML email causes problems with this mailing list so do send email using your mail client's plain text option. You assert that >The probability of excluding an observation within each cluster was not uniform but having a different number excluded

Re: [R] How to specify year-month-day for a plot

2020-12-16 Thread Gregory Coats via R-help
Jim, Thank you! The data set begins gcdf<-read.table(text="2013-12-29 19.175 2014-01-20 10.072 2014-02-12 10.241 I note that data begins in 2013. But the plot command does not show this first entry in 2013, and instead shows the second data pair as the first data pair. As a consequence, plot does

Re: [R] Help with simulation of unbalanced clustered data

2020-12-16 Thread Chao Liu
Thank you for the reminder, Jeff. I am new to R-help and so please bear with my ignorance. This is not homework and here is a reproducible example. The number of observations per cluster doesn't follow the condition specified above though, I just used this to convey my idea. > y <- rnorm(20) >

Re: [R] making code (loop) more efficient

2020-12-16 Thread Ana Marija
Indeed it was the issue with data.table. I converted it to data.frame and it worked like a charm. Thank you so much for your insight! This is the code that worked: library(parallel) library(data.table) library(doSNOW) n <- parallel::detectCores() cl <- parallel::makeCluster(n, type = "SOCK") do

Re: [R] making code (loop) more efficient

2020-12-16 Thread Ana Marija
HI Jim, this is what I as running: library(parallel) library(data.table) library(foreach) library(doSNOW) n <- parallel::detectCores() cl <- parallel::makeCluster(n, type = "SOCK") doSNOW::registerDoSNOW(cl) files <- list.files("/WEIGHTS1/Retina", pattern=".RDat", ignore.case=T) lst_out <- for

Re: [R] ggplot complicated ylab

2020-12-16 Thread tring
Thanks a lot! exp <- expression(atop("Cumulative Na-Cl balance and",paste("(red) ",Delta,HCO[3]^"-"," (mmol)"))) did the trick All best Troels -Oprindelig meddelelse- Fra: R-help På vegne af Jeff Newmiller Sendt: 16. december 2020 14:17 Til: r-help@r-project.org; tr...@gvdnet.dk; r

Re: [R] Help with simulation of unbalanced clustered data

2020-12-16 Thread Jeff Newmiller
This is R-help, not R-do-my-work-for-me. It is also not a homework help line. The Posting Guide is required reading. Assuming this is not homework, since each step in your problem definition can be mapped to a fairly basic operation in R (the sample function and indexing being key tools), you sh

Re: [R] ggplot complicated ylab

2020-12-16 Thread Jeff Newmiller
Perhaps [1] has some useful ideas? [1] https://stackoverflow.com/questions/13223846/ggplot2-two-line-label-with-expression On December 16, 2020 5:02:59 AM PST, tr...@gvdnet.dk wrote: >Dear friends - I need an ylab on 2 lines - > >Here is what I want: > >exp <- expression(paste("Cumulative Na-Cl

[R] ggplot complicated ylab

2020-12-16 Thread tring
Dear friends - I need an ylab on 2 lines - Here is what I want: exp <- expression(paste("Cumulative Na-Cl balance ","\n", "and (red) ",Delta,HCO[3]^"-"," mmol")) So if exp was OK ylab(exp) would work - but the "\n" doesn't seem to do anything and it all comes on one lin

Re: [R] space between bars of a group in ggplot2

2020-12-16 Thread PIKAL Petr
Hi, Keep your emails on the list, please. here are some artificial data dput(dat) structure(list(x = c("a", "a", "a", "b", "b", "b"), y = c(1, 1, 1, 3, 3, 3), cond = c("x1", "x2", "x3", "y1", "y2", "y3")), row.names = c(NA, 6L), class = "data.frame") And possible result hist <- ggplot(dat, aes(

[R] Help with simulation of unbalanced clustered data

2020-12-16 Thread Chao Liu
Dear R experts, I want to simulate some unbalanced clustered data. The number of clusters is 20 and the average number of observations is 30. However, I would like to create an unbalanced clustered data per cluster where there are 10% more observations than specified (i.e., 33 rather than 30). I t