Hello everyone, I have a question and I need your precious kind help. I am working on matching two string. However, the length of the two strings is different. For example, one is "example" (nchar=7), the other one is "example " (nchar=10). The R considers them as different strings but they will be the same if I could make the first string has 10 characters, "example" followed by 3 spaces. However, I could not find a way to do it. Is there anyone able to provide some suggestions? I appreciate your precious time!!!! Best, Yen [[alternative HTML version deleted]]
http://stackoverflow.com/questions/2261079/how-to-trim-leading-and-trailing-whitespace-in-r -- Sent from my phone. Please excuse my brevity. On May 18, 2017 8:57:51 PM PDT, Yen Lee <b88207001 at ntu.edu.tw> wrote:>Hello everyone, > > > >I have a question and I need your precious kind help. > > > >I am working on matching two string. However, the length of the two >strings >is different. For example, one is "example" (nchar=7), the other one is >"example " (nchar=10). The R considers them as different strings but >they >will be the same if I could make the first string has 10 characters, >"example" followed by 3 spaces. However, I could not find a way to do >it. Is >there anyone able to provide some suggestions? > > > >I appreciate your precious time!!!! > > > >Best, > >Yen > > > > > [[alternative HTML version deleted]] > >______________________________________________ >R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see >https://stat.ethz.ch/mailman/listinfo/r-help >PLEASE do read the posting guide >http://www.R-project.org/posting-guide.html >and provide commented, minimal, self-contained, reproducible code.
Hi Jeff, Thank you a lot!!!!! Best, Yen -----Original Message----- From: Jeff Newmiller [mailto:jdnewmil at dcn.davis.ca.us] Sent: Thursday, May 18, 2017 11:11 PM To: r-help at r-project.org; Yen Lee <b88207001 at ntu.edu.tw> Subject: Re: [R] Question about change the length of a string. http://stackoverflow.com/questions/2261079/how-to-trim-leading-and-trailing-whitespace-in-r -- Sent from my phone. Please excuse my brevity. On May 18, 2017 8:57:51 PM PDT, Yen Lee <b88207001 at ntu.edu.tw> wrote:>Hello everyone, > > > >I have a question and I need your precious kind help. > > > >I am working on matching two string. However, the length of the two >strings is different. For example, one is "example" (nchar=7), the >other one is >"example " (nchar=10). The R considers them as different strings but >they >will be the same if I could make the first string has 10 characters, >"example" followed by 3 spaces. However, I could not find a way to do >it. Is there anyone able to provide some suggestions? > > > >I appreciate your precious time!!!! > > > >Best, > >Yen > > > > > [[alternative HTML version deleted]] > >______________________________________________ >R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see >https://stat.ethz.ch/mailman/listinfo/r-help >PLEASE do read the posting guide >http://www.R-project.org/posting-guide.html >and provide commented, minimal, self-contained, reproducible code.