For/While Loops

Hello,
Please I need help. I am trying to write a loop to see if these tech skills are present in the keyskills required for a job. If there are, I want a new column beside it saying true or false.

I tried writing a loop but it keeps giving me error in data.frame.
Here is the code I wrote:

Here is a sample dataset:
tech_skills <- c('Oracle', 'Java', 'Javascript', 'Linux', 'HTML', 'Python', 'SQL', 'C', 'C++', 'CSS', 'Excel', 'MS Excel', 'UI/UX', 'UI', 'UX',
'Scrum', 'Git', 'Unix', 'C#', 'Perl', 'Swift', 'Azure', 'Ruby', 'Go', 'PHP', 'R', 'AWS', '.NET','Scala', 'Salesforce', 'CRM', 'Docker')

structure(list( vacancy_id = c(73688520L, 73455146L, 73581201L,
72416537L, 71763066L, 73194477L), key_skills = c("['Adobe After Effect', 'Adobe Photoshop', 'Houdini', 'Cinema 4D', 'Blender 3D']",
"['Рерайтинг', 'Копирайтинг', 'Написание текстов', 'SEO-копирайтинг', 'Редактирование', 'Журналистика', 'Написание статей', 'Написание рекламных статей', 'Редактирование текстов', 'Литературное редактирование', 'Редакторская деятельность', 'Копирайт']",
"", "['Adobe Illustrator', 'Adobe Photoshop', 'Adobe InDesign', 'Графический дизайн', 'Креативность']",
"['Figma', 'Креативность', 'Adobe Photoshop', 'Иллюстрирование', 'Проведение презентаций', 'Tilda']",
"['Adobe Photoshop', 'Adobe Illustrator', 'Adobe After Effect', 'Креативность', 'Графический дизайн', 'Арабский язык']"
))

Try this:

library(tidyverse)

tech_skills <- c('Oracle','Java','Javascript','Linux','HTML','Python','SQL','C','C++','CSS','Excel','MSExcel','UI/UX','UI','UX',
'Scrum','Git','Unix','C#','Perl','Swift','Azure','Ruby','Go','PHP','R','AWS','.NET','Scala','Salesforce','CRM','Docker')


keyskills <- data.frame(myexample = c('a', 'n', 'HTML', 'Go'))


for (i in tech_skills) {
  
  if(
  keyskills %>% 
    filter(myexample %in% i) %>% 
    count() > 0 
  ) print(i)
    
    
}

This topic was automatically closed 42 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.