Re: [R] Plot math symbol with string and number

2020-08-17 Thread cpolwart
On 2020-08-17 03:13, Rasmus Liland wrote: On Sun, Aug 16, 2020 at 3:18 PM Bert wrote: | On Sun, Aug 16, 2020, 14:53 John wrote: | | | | I would like to make plots with | | titles for different data sets and | | different parameters. The first | | title doesn't show sigma as a math | | symbol,

Re: [R] Removing a space from a string

2020-07-28 Thread cpolwart
This RegEx would do it I think: \s(?=.*\s\d*\.) Looks for space - \s Before any strings followed by space, numbers, period text <- "STR ING 01. Remainder of the string" stringr::str_replace_all(text, "\\s(?=.*\\s\\d*\\.)", "") Should do it I think! On 2020-07-28 21:34, Dennis Fisher wrote:

Re: [R] Removing a space from a string

2020-07-28 Thread cpolwart
On 2020-07-28 21:31, Dennis Fisher wrote: Only the spaces in STRING. However, if I inadvertently delete the space between STRING and NN, I can add it back in. Can there only be one space in STR ING or is ST RI NG possible? Dennis Fisher MD P < (The "P Less Than" Company) Phone / Fax:

Re: [R] Removing a space from a string

2020-07-28 Thread cpolwart
On 2020-07-28 21:20, Dennis Fisher wrote: R 4.0.2 OS X Colleagues I have strings that contain a space in an unexpected location. The intended string is: “STRING 01. Remainder of the string" However, variants are: “STR ING 01. Remainder of the string" “STRIN G 01.

Re: [R] How to loop over two files ...

2020-06-19 Thread cpolwart
Sorry - its been a long week! there is a foreach package but I try to avoid extras make your for statements: for ( a in rownames(f1) ) { # a will now be a row number rather than the value, so replace ' a ' in the paste0 with: f1[ a, 1] so ext <- paste0( "/ld/human/pairwise/",

Re: [R] How to loop over two files ...

2020-06-19 Thread cpolwart
Oh - read.text isn't in base! Not sure where is came from (my head mostly!) You may have something that adds it but better to use something that works. So try using: library(readr) f1 <- read_tsv("1g.txt", col.names=F) This will give you a tibble with f1$X1 with the file in it then loop

Re: [R] How to loop over two files ...

2020-06-19 Thread cpolwart
so (untested) if you did something like f1 <- read.text("1g.txt") f2 <- read.text("1n.txt") for ( a in as.list(f1) ) { for ( b in as.list(f2) ) { ext <- paste0( "/ld/human/pairwise/", a, "/", b,

Re: [R] How to stack two Stack manhattan plots?

2020-06-11 Thread cpolwart
On 2020-06-11 15:59, Ana Marija wrote: yes all in one plot. So I want key (and therefore color)to be "Pold" and "Pnew" as those I am comparing per CHR so I used facet_wrap(~CHR) to create a graph per chromosome (on x-axis) On the end x-axis would have two strikes of Pold and Pnew (different

Re: [R] How to stack two Stack manhattan plots?

2020-06-11 Thread cpolwart
On 2020-06-11 14:54, Ana Marija wrote: Hello, I expected it to look like this: https://imgur.com/a/pj40c Ah - so all on the one plot? - so you don't want a facet. It puts two plots side by side (or 22) where x-axis would be CHR, there is 22 of them unique(tmp.tidy$CHR) [1] 1 2 3 4

Re: [R] How to stack two Stack manhattan plots?

2020-06-10 Thread cpolwart
What did you expect? I'm assuming two plots (based on the subject) and side by side based on the code (nrow =1) But you are getting several graphs (facets) on the row and only expected 2? What is in CHR? i.e. summary(tmp1$CHR) I'm assuming its not a factor with 2 elements...? > Hello,

Re: [R] how to extract strings in any column and in any row that start with

2020-05-15 Thread cpolwart
This is almost certainly not the most efficient way: tot <- data.frame(v1 = paste0(LETTERS[seq(1:5)],seq(1:10)), v2 = paste0(LETTERS[seq(1:5)],seq(from = 101, to=110, by = 1)), v3 = paste0(LETTERS[seq(1:5)],seq(from = 111, to=120, by = 1)), v4 =

Re: [R] How to use pakcage R0

2020-05-05 Thread cpolwart
R0 = estimate.R(germany_vect, mGT, begin=germany_vect[1], end=germany_vect[length(germany_vect)], methods="EG", pop.size=pop_de, nsim=100) Error in begin.nb:end.nb : argument of length 0 germany_vect[1] 1 184 germany_vect[length(germany_vect)] 57 488 ``` What might be the problem

Re: [R] Survival analysis

2020-04-26 Thread cpolwart
On 2020-04-26 10:48, Medic wrote: Very grateful for the all comments! My data contains: • left censored • right censored • events (interval censored does not contain!) (P.S. I understood, that the code with "type = 'left'" is not suitable, because is ONLY for left-censored.) I wanted to get

Re: [R] Survival analysis

2020-04-17 Thread cpolwart
On 2020-04-17 20:06, Medic wrote: I can't understand how to do a survival analysis (?Surv ()) when some event occurred before the start of observation (left censored). If I understand correctly, there are two methods. I chose a method with: 1) time from the start of treatment to the event and 2)

[R] Graph digitisation / tracing

2012-01-28 Thread cpolwart
I want to take some published graphs and digitise them to allow me to run some analysis on them. Is this possible using any of R's plugins. I don't think it is but I never cease to be amazed at what R can do and it'd be great if it was as it would almost certainly be more powerful than doing