I need help with working with two different datasets for my research project.
I have two different data frames, they have different number of columns and rows. I need to gather values from one dataset that satisfy a specific condition that involves both datasets. The condition to be satisfied: that the combination of two values (in the same row but different columns) are the same.
For example, in my dataset, the values in 'data$Regular_response' should be the same as 'swow$response', and data$Test_word should be the same as swow$cue.
data$Regular_response = swow$response data$Test_word = swow$cue
In other words, I am looking for equal word pairs in both datasets.
When this condition is satisfied, I need the value of swow$R123.Strength to be printed in a new column in data$strength
How do I do that??
> head(swow)
# A tibble: 6 x 5
cue response R123 N R123.Strength
<chr> <chr> <chr> <chr> <chr>
1 a one 31 257 0.120622568093385
2 a the 26 257 0.101167315175097
3 a an 17 257 0.066147859922179
4 a b 14 257 0.0544747081712062
5 a single 9 257 0.0350194552529183
6 a article 6 257 0.0233463035019455
> head(data)
Regular_response Test_word Pyramids_and_Palms_Test
1: princess queen 92
2: shoes slippers 92
3: flowerpot vase 92
4: horse zebra 92
5: cup bowl 85
6: nun church 85
> filter(data, Test_word == 'queen', Regular_response == 'princess')
Regular_response Test_word Pyramids_and_Palms_Test
1 princess queen 92
2 princess queen 87
> filter(swow, cue == 'queen', response == 'princess')
# A tibble: 1 x 5
cue response R123 N R123.Strength
<chr> <chr> <chr> <chr> <chr>
1 queen princess 3 292 0.0102739726027397
I appreciate those who can help me with this code!