[R] non alphabetical strings

Jeff Newmiller jdnewm|| @end|ng |rom dcn@d@v|@@c@@u@
Sun Apr 28 22:26:40 CEST 2019


Use pattern "[^[:alpha]]" with grepl.

On April 28, 2019 12:50:37 PM PDT, Bert Gunter <bgunter.4567 using gmail.com> wrote:
>?grepl
>
>gives you a logical vector for indexing.
>
>
>Bert Gunter
>
>"The trouble with having an open mind is that people keep coming along
>and
>sticking things into it."
>-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
>
>
>On Sun, Apr 28, 2019 at 11:54 AM Graeme Davidson <
>graeme.r.davidson using gmail.com> wrote:
>
>> Hello All,
>>
>> I can’t find the answer for this so I thought I would ask you lovely
>> people.
>>
>> I have a data frame with a column of names, some of which have
>> non-alphabetical letters.
>>
>> How, do I extract the row indexes which do not meat the criteria of
>> alphabetical [[:alpha:]].
>>
>> Thanks in advance
>>
>> All the best
>>
>> Graeme
>>
>>
>> library(dplyr)
>> my_df <- data.frame(name1 = c("david", "mo", "ma4tilda856", "steph",
>> "hadley", "574383"),
>>                     name2 = c("craig", "salah", "dahl", "paris",
>"wick",
>> "turing"), sex = c("m", "m", "f", "f", "m", "m”))
>> my_df %>%
>>   mutate_all(as.character)
>>         [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> R-help using 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.
>>
>
>	[[alternative HTML version deleted]]
>
>______________________________________________
>R-help using 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.

-- 
Sent from my phone. Please excuse my brevity.



More information about the R-help mailing list