Re: [R] trim NA from concatenate result

2021-06-02 Thread Kai Yang via R-help
Hi Rui, I use the code to fix my problem: try$newcol <- gsub(" NA", "", try$newcol) But, I'll try your solution later. Thank you for your help. Kai On Wednesday, June 2, 2021, 02:08:18 PM PDT, Kai Yang via R-help wrote: Hi List, I use paste function to concatenate  3 character columns tog

Re: [R] trim NA from concatenate result

2021-06-02 Thread Rui Barradas
Hello, Something like this? df1 <- read.table(text = " NA NA NA NA NA Adenocarcinoma NA Other NA") df1 apply(df1, 1, function(x){ if(all(is.na(x))){ NA_character_ }else{ paste(x[!is.na(x)], collapse = "") } }) And please configure your e-mail client not to post in HTML format.

[R] trim NA from concatenate result

2021-06-02 Thread Kai Yang via R-help
Hi List, I use paste function to concatenate  3 character columns together. when I run table to see that, I found 3 categories. How can I write script to trim NA in 2nd and 3rd group and set the first one as NA? Thanks, Kai NA NA NA  NA NA Adenocarcinoma NA Other NA [[alternative HTML ver

Re: [R] Trim and fill procedure

2015-04-07 Thread Viechtbauer Wolfgang (STAT)
elp-boun...@r-project.org] On Behalf Of Michael > Dewey > Sent: Monday, April 06, 2015 14:55 > To: Carlijn Wibbelink; r-help@r-project.org > Subject: Re: [R] Trim and fill procedure > > Hello Carlijn > > Well the documentation for trimfill says they are added. > &g

Re: [R] Trim and fill procedure

2015-04-06 Thread Michael Dewey
Hello Carlijn Well the documentation for trimfill says they are added. library(metafor) example(trimfill) This now leaves you with res res.tf By looking at these and seeing which vectors have grown you should be able to extract the yi and vi which you want. Wolfgang will doubtless be on the

[R] Trim and fill procedure

2015-04-05 Thread Carlijn Wibbelink
Hi all, I have a question concerning the trim and fill procedure in metafor. In STATA it is possible to obtain the values of the added estimated effect sizes. I was wondering if this is also possible in R and if so, how I can obtain the new data with the added values. I would really appreciate

Re: [R] Trim

2012-12-05 Thread Berend Hasselman
On 05-12-2012, at 11:46, Vasilchenko Aleksander wrote: > Hello, > I have a dataframe > > 1 2006-11 NaN > 2 2006-12 NaN > 3 2006-10 0.1577647 > 4 2006-11 NaN > 5 2006-12 NaN > 6 2007-01 NaN > 7 2007-02 NaN > 8 2007-03 0.2956429 > 9 2007-01 NaN > 10 2007-0

Re: [R] Trim

2012-12-05 Thread arun
nal Message - From: Rui Barradas To: Vasilchenko Aleksander Cc: r-help@r-project.org Sent: Wednesday, December 5, 2012 7:59 AM Subject: Re: [R] Trim Hello, Try the following. dat <- structure(list(V1 = structure(c(2L, 3L, 1L, 2L, 3L, 4L, 5L, 6L, 4L, 5L), .Label = c("2006-10", &qu

Re: [R] Trim

2012-12-05 Thread arun
om: Vasilchenko Aleksander To: r-help@r-project.org Cc: Sent: Wednesday, December 5, 2012 5:46 AM Subject: [R] Trim Hello, I have a dataframe 1 2006-11      NaN 2 2006-12      NaN 3 2006-10 0.1577647 4 2006-11      NaN 5 2006-12      NaN 6 2007-01      NaN 7 2007-02      NaN 8 2007-03 0.2

Re: [R] Trim

2012-12-05 Thread Rui Barradas
Hello, Try the following. dat <- structure(list(V1 = structure(c(2L, 3L, 1L, 2L, 3L, 4L, 5L, 6L, 4L, 5L), .Label = c("2006-10", "2006-11", "2006-12", "2007-01", "2007-02", "2007-03"), class = "factor"), V2 = c(NaN, NaN, 0.1577647, NaN, NaN, NaN, NaN, 0.2956429, NaN, NaN)), .Names = c("V1", "V2"

[R] Trim

2012-12-05 Thread Vasilchenko Aleksander
Hello, I have a dataframe 1 2006-11 NaN 2 2006-12 NaN 3 2006-10 0.1577647 4 2006-11 NaN 5 2006-12 NaN 6 2007-01 NaN 7 2007-02 NaN 8 2007-03 0.2956429 9 2007-01 NaN 10 2007-02 NaN I need to trim first and last NaN rows Result - 1 2006-10 0.1577647 2 2