I have two different dataframes as shown in figures attached. Dataframe1 and Dataframe2.
This is what I tried.
#First dataframe
structure(list(Label = c("Gene 1", "Gene 2", "Gene 3", "Gene 4",
"Gene 5", "Gene 6", "Gene 7", "Gene 8", "Gene 9", "Gene 10",
"Gene 11", "Gene 12", "Gene 13", "Gene 14", "Gene 15", "Gene 16",
"Gene 17", "Gene 18", "Gene 19", "Gene 20", "Gene 21", "Gene 22",
"Gene 23", "Gene 24", "Gene 25", "Gene 26", "Gene 27", "Gene 28",
"Gene 29", "Gene 30"), Count = c(1500, 1600, 1700, 1800, 1900,
2000, 2100, 2200, 2300, 2400, 2500, 2600, 2700, 2800, 2900, 3000,
3100, 3200, 3300, 3400, 3500, 3600, 3700, 3800, 3900, 4000, 4100,
4200, 4300, 4400)), class = c("tbl_df", "tbl", "data.frame"), row.names = c(NA,
-30L))
df_1 <- read_excel("Demo_data.xlsx", sheet = "Dataframe1")
str(df_1)
View(df_1)
df_1.1 <- column_to_rownames(df_1, 'Label')
View(df_1.1)
df_1.2 <- t(df_1.1)
View(df_1.2)
df_1.2 <- as.data.frame(df_1.2)
str(df_1.2)
typeof(dff1)
str(dff1)
#Second dataframe
structure(list(Label = c("Control1", "Control2", "Control3",
"Control4", "Control5", "Control6", "Control7", "Control8", "Control9",
"Control10", "Control11", "Control12", "Control13", "Control14",
"Control15", "Control16", "Control17", "Control18", "Control19",
"Control20", "Control21", "Control22", "Control23", "Control24"
), Count = c(1800, 1400, 1110, 1900, 2500, 2900, 2100, 900, 5000,
2300, 700, 1400, 3400, 2310, 3322, 2200, 4400, 2100, 1000, 6700,
4300, 2120, 4800, 4300)), class = c("tbl_df", "tbl", "data.frame"
), row.names = c(NA, -24L))
df_2 <- read_excel("Demo_data.xlsx", sheet = "Dataframe2")
df_2.1 <- column_to_rownames(df_2, 'Label')
View(df_2.1)
df_2.1 <- t(df_2.1)
View(df_2.1)
df_2.1 <- as.data.frame(df_2.1)
str(df_2.1)
correlation <- cor(df_1.2, df_2.1)
View(correlation)
This is my desired output but I am getting NA for every correlation. Any help is highly appreciated.