[R] non alphabetical strings

Bert Gunter bgunter@4567 @end|ng |rom gm@||@com
Sun Apr 28 21:50:37 CEST 2019


?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]]



More information about the R-help mailing list