I have a dataframe in R of data look likes this:
and I want to transform the table to this
What is the fastest way to do it in R?
Here is how I did it, but I admit that it's very long
method_vec <- c(rep("PCA", 6), rep("Specter", 6),rep("Seurat", 6),rep("Geometric sketching", 6),rep("dropClust", 6),rep("RtsneKmeans", 6),rep("TSCAN", 6))
memory_vec <- c(memory_data$Specter, memory_data$Seurat, memory_data$Geometric.sketching, memory_data$dropClust, memory_data$TSCAN, memory_data$PCA, memory_data$RtsneKmeans)
df <- data.frame("Cells" = rep(memory_data$N, 7), "Method" = method_vec, "Memory" = memory_vec)
Thanks!