I have a dataset in which I want regarding to one of the num_values add new value from the other dataframe.
Here's an example, create some df1
First.Name <- c("John", "Edgar", "Walt", "Jane")
Second.Name <- c("Doe", "Poe", "Whitman", "Austen")
num_value <- runif(4,0,1.2)
df1 <- data.frame(First.Name, Second.Name, num_value)
which has this output
First.Name Second.Name num_value
1 John Doe 0.08137931
2 Edgar Poe 0.30245512
3 Walt Whitman 0.62542554
4 Jane Austen 0.40573224
df2 is defined as
upper_boundary <- seq(0,1.6,0.2)
class_value <- c(1:9)
df2 <- data.frame(upper_boundary, class_value)
and has it's output as
upper_boundary class_value
1 0.0 1
2 0.2 2
3 0.4 3
4 0.6 4
5 0.8 5
6 1.0 6
7 1.2 7
8 1.4 8
9 1.6 9
What I'd like to do is to add at the end of the first data frame class value from df2. Output should be something like
First.Name Second.Name num_value class_value
1 John Doe 0.08137931 2
2 Edgar Poe 0.30245512 3
3 Walt Whitman 0.62542554 5
4 Jane Austen 0.40573224 4
Thanks in advance