Rename non-numeric values in column

Hello!

I want to rename non-numeric values Web-Mobile, Web, App, STB in column "device" to web-mobile, desktop, mobile, connected_tv. Script is below:

SVOD_TVOD <-
read.csv('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\SVOD_TVOD.csv', sep = ";", encoding = 'UTF-8') %>%
dplyr::select(Дата, g_campaign, X.U.FEFF.g_source, Measure.Names, Платформа, Measure.Values) %>%
dplyr::rename(date = Дата, campaign = g_campaign, sourceMedium = X.U.FEFF.g_source,
measure_names = Measure.Names, measure_values = Measure.Values, device = Платформа) %>%
mutate(date = as.Date(date, format="%d.%m.%Y", tryFormats = c("%d.%m.%Y", "%Y/%m/%d")),
sourceMedium_v1 = paste(sourceMedium, " / cpc", sep = "")) %>%
case_when(SVOD_TVOD %in% "Web" == "desktop")

Can i use function "case_when"?
I guess that i have a mistake in fuction "case_when" , but i don`t understand where.

case_when is a good choice, but has its own (simple) syntax to learn.
you can read about it and practice with the examples here : A general vectorised if — case_when • dplyr (tidyverse.org)

@nirgrahamuk Thanks.

For very long tables or when you have to check lot of reg-exp, I found that join verbs are much faster.

@mfcava Hello,
What do you mean below "that join verbs"?

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.