Comparing two items from two different datasets and mutate variable accordingly
summary
Dear Stackoverflow-Community,
I'm trying to compare a column/variable (item1) from one dataset (data1) with a column/variable (item1) from a different dataset (data2). I would like to mutate
the compared column/variable (item1) in dataset1 to a third variable (letter) of dataset data2.
Unfortunately I'm receiving the ereror message "Error in UseMethod("mutate_") : inapplicable method for 'mutate_' applied to object of class "logical"." with my code.
I've created two data example sets and a dataset showing the output that I'm trying to generate with R you will find in the dropbox link below.
download to example dataset (+ visualization of desired output)
https://www.dropbox.com/sh/eido04eiocuw06l/AABiCr2EpRf4PPsb1HYLLGFna?dl=0
My Code
data1 <- read.csv2("data 1.csv")
data2 <- read.csv2("data 2.csv")
attach(data1)
attach(data2)
data1 <- as.data.frame(data1)
data2 <- as.data.frame(data2)
if(data1$item.1 = data2$item.1) %>%
mutate(data1$item.1 == data2$letter)
Background
I downloaded a big dataset from moodle and I need to transform the dataset in order to do my analyses. This afternoon I've been trying this for way too long with my colleague and now we hope for some advice (as we just started with R).
Thanks in advance and have a great day!
Karla