Hi, I am a little bit new at R and trying to analyze scRNA seq using R. I want to calculate the mean of expression of each gene by two factors- the cell type tissue and the time the data was collected. The problem is that these two factors are in metadata table and I am struggling to join the expression table and the metadata. the cell id is the joining link between them. Does anyone has done such a join between this kind of tables before in R ? The raw data which is from single cell experiment is like that each row represents a gene and each column represents a cell id. The metadata is different - each row is cell id and columns are information such as time and cells tissues with values of TRUE/FALSE. I tried to join with merge in R but didn't succeed. I transposed one of the df before.
Here is my code :
metadata<-read.csv("Metadata/metadata.csv") metadata<- data.frame(metadata) //transpose data expression data<-read.delim("Maternal_Expression.txt", header = TRUE, sep="\t") tr_data = data.frame(t(data[,-1])) library(dplyr) // join - from metadata we want only stage, from tr_data united <- merge(metadata[,(1:3)],tr_data)
ps. I am new to R :(
thanks :)