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

2019-05-18 Thread Michael Boulineau
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; and then there were still three *** on the same line where the  was apparently deleted. > a <- readLines ("h

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

2019-05-18 Thread Boris Steipe
This works for me: # sample data c <- character() c[1] <- "2016-01-27 09:14:40 started a video chat" c[2] <- "2016-01-27 09:15:20 https://lh3.googleusercontent.com/"; c[3] <- "2016-01-27 09:15:20 Hey " c[4] <- "2016-01-27 09:15:22 ended a video chat" c[5] <- "2016-01-27 21:07:11 started a v

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

2019-05-18 Thread Michael Boulineau
Going back and thinking through what Boris and William were saying (also Ivan), I tried this: a <- readLines ("hangouts-conversation-6.csv.txt") b <- "^([0-9-]{10} [0-9:]{8} )[*]{3} (\\w+ \\w+)" c <- gsub(b, "\\1<\\2> ", a) > head (c) [1] "2016-01-27 09:14:40 *** Jane Doe started a video chat"

Re: [R] Nested structure data simulation

2019-05-18 Thread Daniel Nordlund
On 5/18/2019 1:03 PM, varin sacha via R-help wrote: Dear Boris, Yes, top-down, no problem. Many thanks, but in your code did you not forget "teacher" ? As a reminder teacher has to be nested with classes. I mean the 50 pupils belonging to C1 must be with (teacher 1) T1, the 50 pupils belongi

Re: [R] Nested structure data simulation

2019-05-18 Thread varin sacha via R-help
Dear Boris, Yes, top-down, no problem. Many thanks, but in your code did you not forget "teacher" ? As a reminder teacher has to be nested with classes. I mean the 50 pupils belonging to C1 must be with (teacher 1) T1, the 50 pupils belonging to C2 with T2, the 50 pupils belonging to C3 with T3

Re: [R] Nested structure data simulation

2019-05-18 Thread Boris Steipe
Can you build your data top-down? schools <- paste("s", 1:6, sep="") classes <- character() for (school in schools) { classes <- c(classes, paste(school, paste("c", 1:5, sep=""), sep = ".")) } pupils <- character() for (class in classes) { pupils <- c(pupils, paste(class, paste("p", 1:10,

Re: [R] Nested structure data simulation

2019-05-18 Thread varin sacha via R-help
Many thanks Jeff and Linus, Yes to Jeff, OK with Linus but classroom <- rep(c("C1","C2","C3","C4","C5","C6"), 50) [sample(1:300)] how can I include the nested structure, I mean the teacher. Now, I would like the 50 pupils belonging to C1 with T1, the 50 pupils belonging to C2 with T2, th

Re: [R] Nested structure data simulation

2019-05-18 Thread Jeff Newmiller
Wouldn't the students/teachers/schools be enumerated and the properties you are studying be random/correlated according to the enumerated values? On May 18, 2019 6:57:06 AM PDT, varin sacha via R-help wrote: >Dear R-Experts, > >In a data simulation, I would like a balanced distribution with a >

[R] Nested structure data simulation

2019-05-18 Thread varin sacha via R-help
Dear R-Experts, In a data simulation, I would like a balanced distribution with a nested structure for classroom and teacher (not for school). I mean 50 pupils belonging to C1, 50 other pupils belonging to C2, 50 other pupils belonging to C3 and so on. Then I want the 50 pupils belonging to C1

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

2019-05-18 Thread peter dalgaard
Actually, you might go for 3.6.0-patched. There was a somewhat annoying bug affecting the package installation menu in 3.6.0. -pd > On 17 May 2019, at 20:32 , Bill Poling wrote: > > I fixed it by removing previous versions as suggested. > >> sessionInfo() > R version 3.6.0 RC (2019-04-24 r764