Re: [R] how to separate string from numbers in a large txt file

2019-05-19 Thread Boris Steipe
Inline > On 2019-05-19, at 18:11, Michael Boulineau > wrote: > > For context: > >> In gsub(b, "\\1<\\2> ", a) the work is done by the backreferences \\1 and >> \\2. The expression says: >> Substitute ALL of the match with the first captured expression, then " <", >> then the second capture

Re: [R] how to separate string from numbers in a large txt file

2019-05-19 Thread Michael Boulineau
For context: > In gsub(b, "\\1<\\2> ", a) the work is done by the backreferences \\1 and > \\2. The expression says: > Substitute ALL of the match with the first captured expression, then " <", > then the second captured expression, then "> ". The rest of the line is >not > substituted and appe

Re: [R] how to separate string from numbers in a large txt file

2019-05-19 Thread Boris Steipe
Inline ... > On 2019-05-19, at 13:56, Michael Boulineau > wrote: > >> b <- "^([0-9-]{10} [0-9:]{8} )[*]{3} (\\w+ \\w+)" > > so the ^ signals that the regex BEGINS with a number (that could be > any number, 0-9) that is only 10 characters long (then there's the > dash in there, too, with the 0-

Re: [R] Nested structure data simulation

2019-05-19 Thread Boris Steipe
My mental model for such a simulation is that you create data from a known distribution, then use your model to check that you can recover the known parameters from the data. Thus how the marks are created depends on what influences them. Here is a toy model to illustrate this - expanding on my

Re: [R] how to separate string from numbers in a large txt file

2019-05-19 Thread Michael Boulineau
> b <- "^([0-9-]{10} [0-9:]{8} )[*]{3} (\\w+ \\w+)" so the ^ signals that the regex BEGINS with a number (that could be any number, 0-9) that is only 10 characters long (then there's the dash in there, too, with the 0-9-, which I assume enabled the regex to grab the - that's between the numbers in

Re: [R] Nested structure data simulation

2019-05-19 Thread varin sacha via R-help
Dear Boris, Great But what about Mark in your R code ? Don't we have to precise in the R code that mark ranges between 1 to 6 (1 ; 1.5 ; 2 ; 2.5 ; 3 ; 3.5 ; 4 ; 4.5 ; 5 ; 5.5 ; 6) ? By the way, to fit a linear mixed model, I use lme4 package and then the lmer function works with the varia

Re: [R] Nested structure data simulation

2019-05-19 Thread Boris Steipe
Fair enough - there are additional assumptions needed, which I make as follows: - each class has the same size - each teacher teaches the same number of classes - the number of boys and girls is random within a class - there are 60% girls (just for illustration that it does not have to be

Re: [R] Nested structure data simulation

2019-05-19 Thread varin sacha via R-help
Many thanks to all of you for your responses. So, I will try to be clearer with a larger example. Te end of my mail is the more important to understand what I am trying to do. I am trying to simulate data to fit a linear mixed model (nested not crossed). More precisely, I would love to get at t

Re: [R] how to separate string from numbers in a large txt file

2019-05-19 Thread Boris Steipe
Inline > On 2019-05-18, at 20:34, Michael Boulineau > wrote: > > It appears to have worked, although there were three little quirks. > The ; close(con); rm(con) didn't work for me; the first row of the > data.frame was all NAs, when all was said and done; You will get NAs for lines that can'

Re: [R] Help understanding the relationship between R-3.6.0 and RStudio

2019-05-19 Thread Bill Poling
Good morning, I will head your advice, good to know, thank you Peter. WHP From: peter dalgaard Sent: Saturday, May 18, 2019 4:44 AM To: Bill Poling Cc: Marc Schwartz ; R-help Subject: Re: [R] Help understanding the relationship between R-3.6.0 and RStudio Actually, you might go for 3.6.0-pat