I have the following list of named vectors:
lof <- list(PP1 = c(A = -0.96, R = 0.8, N = 0.82, D = 1, C = -0.55,
E = 0.94, Q = 0.78, G = -0.88, H = 0.67, I = -0.94, L = -0.9,
K = 0.6, M = -0.82, F = -0.85, P = -0.81, S = 0.41, T = 0.4,
W = 0.06, Y = 0.31, V = -1), PP2 = c(A = -0.76, R = 0.63, N = -0.57,
D = -0.89, C = -0.47, E = -0.54, Q = -0.3, G = -1, H = -0.11,
I = -0.05, L = 0.03, K = 0.1, M = 0.03, F = 0.48, P = -0.4, S = -0.82,
T = -0.64, W = 1, Y = 0.42, V = -0.43), PP3 = c(A = 0.31, R = 0.99,
N = 0.02, D = -1, C = 0.19, E = -0.99, Q = -0.38, G = 0.49, H = 0.37,
I = -0.18, L = -0.24, K = 1, M = -0.08, F = -0.58, P = -0.07,
S = 0.57, T = 0.37, W = -0.47, Y = -0.2, V = -0.14))
What I want to do is to convert it to tibble and keeping the name of the vector as a column in a tibble.
With this:
library(tidyverse)
as_tibble(lof)
I get this:
# A tibble: 20 × 3
PP1 PP2 PP3
<dbl> <dbl> <dbl>
1 -0.96 -0.76 0.31
2 0.8 0.63 0.99
.. etc ...
What I want to get is this:
PP1 PP2 PP3. residue
1 -0.96 -0.76 0.31 A
2 0.8 0.63 0.99 R
.. etc ...
How can I achieve that?