This is my code
first_df<-tibble(y_1 = seq(0,1*3.14, length.out = 1000),
y_2 = seq(0,2*3.14, length.out = 1000),
y_3 = seq(0,3*3.14, length.out = 1000),
y_4 = seq(0,.2*3.14, length.out = 1000),
y_5 = seq(0,1*3.14, length.out = 1000),
flower_1 = sin(y_1)-2.5,
flower_2 = cos(y_2),
flower_3 = sin(y_3)+2.5,
flower_4 = cos(y_4)+5,
flower_5 = sin(y_5)+7)
I want to do a pivot_longer with my output being 4 columns: x, y, values_flowers and values_y
The output should be something like this:
flowers y value...2 value...4
<chr> <chr> <dbl> <dbl>
1 flower_1 y_1 -2.5 0
2 flower_1 y_1 -2.50 0.00314
3 flower_1 y_1 -2.49 0.00629
4 flower_1 y_1 -2.49 0.00943
... ... ... ... ...