Re: [R] using mutate to remove all white space

2020-03-01 Thread Rui Barradas
Hello, Here are 2 examples, one with stringr::str_remove_all and the other with base gsub. I am assuming that you want to remove the spaces from column 'servicer'. dat <- data.frame(x = rnorm(2), servicer = c("a b c", " d efg"), fctrdt = 1:2) dat library

Re: [R] Isolating Distinct Dates between two data frames

2020-03-01 Thread Ogbos Okike
Dear Sarah, Thank you for your contribution. I have tried to use merge function as suggested. But the function seems to work with data frame. And the file cannot be in the form of data frame as they have different lengths. I also tried whether I can use the function without data frame. It didn't w

Re: [R] Isolating Distinct Dates between two data frames

2020-03-01 Thread Ogbos Okike
Dear Jim, Many thanks for sparing your time to assist me. I have tried your codes. It worked very well to some extent for me. At least it produced the indices you mentioned. But I got stuck when I think of how to use it in further calculations as you indicated. I tried including the indices as th

[R] A new Paper on automatic selection of Turning Point

2020-03-01 Thread Ogbos Okike
Dear Experts, I asked about a turning identification last few weeks. I got much help from the list and was really really happy. When part of the work was published, I was happy to show you and further thank the contributors. Unfortunately, the moderator didn't allow the pdf to go. A link was rathe

Re: [R] using mutate to remove all white space

2020-03-01 Thread Bert Gunter
I don't use dplyr, but it's trivial with gsub, assuming I understand correctly: > x <- "a b\t c\n e" > cat(x) a b c e > gsub("[[:space:]]", "",x) [1] "abce" See ?regex for details (of course!), especially the section on character classes. Bert Gunter "The trouble with having an open mind is

Re: [R] Isolating Distinct Dates between two data frames

2020-03-01 Thread Ogbos Okike
Dear Jeff, I had initially set to plain text. I didn't know when it reverted to HTML. It has been corrected. Thanks for informing me. I have checked ?setdiff. The examples are well explained, so it was not hard for me to use. However, it did not seem to tackle my problem. I have two columns but it

[R] using mutate to remove all white space

2020-03-01 Thread Glenn Schultz via R-help
All, This may not be the proper place to ask as the question is dplyr and removing white space using mutate.  My code is below: ```{r, echo = FALSE, message = FALSE conn <- myconnection ```{r, echo = FALSE, message=FALSE} fhlloanbalance <- tbl(conn, "fhlloan_balance_view") colnames(fhlloa

Re: [R] Isolating Distinct Dates between two data frames

2020-03-01 Thread Jim Lemon
Hi Ogbos, One way to get all combinations of common and different dates is: THULinINVK<-which(THUL1$V1 %in% INVK1$V1) THULnotinINVK<-which(!(THUL1$V1 %in% INVK1$V1)) INVKinTHUL<-which(INVK1$V1 %in% THUL1$V1) INVKnotinTHUL<-which(!(INVK1$V1 %in% THUL1$V1)) This produces vectors of indices that can

Re: [R] Isolating Distinct Dates between two data frames

2020-03-01 Thread Jeff Newmiller
a) Your use of HTML is corrupting your data. Post using plain text, and use dput output instead of trying to insert tables. b) You should read about ?setdiff. On March 1, 2020 1:12:04 PM PST, Ogbos Okike wrote: >Dear Friends, >I have two data frame of the form: >1997-11-2219 -2.54910135429339 >

Re: [R] Isolating Distinct Dates between two data frames

2020-03-01 Thread Sarah Goslee
Look at the all arguments to merge() - you can keep the non-matching dates, and look for NA values in the data. Sarah On Sun, Mar 1, 2020 at 4:12 PM Ogbos Okike wrote: > > Dear Friends, > I have two data frame of the form: > 1997-11-2219 -2.54910135429339 > 1997-11- -2.66865640466636 > 1997-

[R] Isolating Distinct Dates between two data frames

2020-03-01 Thread Ogbos Okike
Dear Friends, I have two data frame of the form: 1997-11-2219 -2.54910135429339 1997-11- -2.66865640466636 1997-11-2305 -2.60761691358946 1997-12-1104 -2.5323738405159 1997-12-1106 -2.6020470080341 1998-05-0204 -4.49745020062937 1998-05-0209 -4.9462725263541 1998-05-0213 -4.60533021405541 1998-