Entering edit mode
Trying to build a qPCRset, and found example code here and more recently here:
mat <- matrix(rnorm(6*96), ncol = 6, nrow = 96, byrow = FALSE)
raw <- new("qPCRset", exprs = mat, featureCategory =
as.data.frame(array("OK", dim=dim(mat))))
sampleNames(raw) <- paste("S", 1:6, sep = "")
featureNames(raw) <- paste("A", 1:96, sep = "")
This code does not work.
> mat <- matrix(rnorm(6*96), ncol = 6, nrow = 96, byrow = FALSE)
> raw <- new("qPCRset", exprs = mat, featureCategory =
+ as.data.frame(array("OK", dim=dim(mat))))
> sampleNames(raw) <- paste("S", 1:6, sep = "")
Error in (function (od, vd) :
object and replacement value dimnames differ
> featureNames(raw) <- paste("A", 1:96, sep = "")
I did correct the typo in the matrix() call, but this had no effects on assigning sampleNames(). The error appears to be incorrect. Both the object and replacement dimnames are NULL.
> dimnames(sampleNames(raw))
NULL
> dimnames(paste("S", 1:6, sep = ""))
NULL
>
Does anyone have working code to manually create a qPCRset?
Thanks! This works for me.
How do we feed in the data from a data frame containing our Ct values into this object? That's the part I am stuck on, sorry if that's an obvious question (I am new to R and using this package).
The answer I provided above explains exactly how to do that, with the exception of needing to coerce a
data.frame
to amatrix
.Ah sorry yes, my question was not specific enough (again, new to R and programming in general), but what you have said makes sense,
"coerce a data.frame to a matrix." I'll look into how to do that, thanks.