Displaying 2 results from an estimated 2 matches for "expressed_genes".
2012 Nov 08
1
Extract cell of many values from dataframe cells and sample from them.
...the dataframe, to "Ind_Effectors" object.
Ind_Effectors <- strsplit(as.character(inds[1,4]),",")
Randomly dictate how many values (effectors) will be sampled
n<-round(runif(1, min=10, max=50))
Sample n values (effector genes) from "Ind_Effectors", not replacing
Expressed_Genes <- sample(Ind_Effectors,n,replace=F)
If I run this I receive the error:
Error in sample(Ind_Effectors, n, replace = F) :
cannot take a sample larger than the population when 'replace = FALSE'
What I think this means is rather than picking out n values from the whole set of values in...
2012 Nov 06
1
sample from list
...nes,replace=TRUE))
(This was later written to a dataframe as well as kept as the list object: inds2 <- data.frame(inds,Genes=I(Genes)))
I also have a vector of how many of those genes are expressed in the individuals, this can also kept as a vector object or written to a data frame:
inds2$No_Expressed_Genes <- round(as.numeric(lapply(1:nrow(inds2),function(x) runif(1, min=10, max=50))))
I want to create another list which consists of each individuals expressed genes - essentially a subset of the total genes the individuals have in the "Genes" list, by sampling from the Genes list for eac...