I am currently trying to write a program that minimises the amount of work
required for “auditable” qPCR data. At the moment I am using an Excel (.csv)
spreadsheet as source data that has been transposed to the column format
required for R to read. Unfortunately, this means I have* *to manually
confirm the whole data set prior to doing any analysis, which is taking a
considerable amount of time! My idea now is to read the raw data in directly
and get R to do the transformation prior to analysis. The problem I now have
is that, upon transposition, the data are converted to “character” in a
matrix, rather than “factor” and “numeric” in a dataframe. I have succeeded
in changing the matrix to a dataframe (via as.data.frame(object)), but this
then converts all the data to “factor” which I can’t use for my analysis
since, other than the column headings, I need the data to be numeric. I have
tried coercing the data to numeric using the as() and as.numeric() commands,
but this has no effect on the data format. I have no experience in
programming and so am at a loss as to what to do: am I making a basic error
in my programming or missing something essential (or both!)?



I am using R version 2.9.0 at the moment, but this will change as soon as I
have sorted this issue out. Below is the code I have put together, as you
can see it is VERY brief but essential to allow my analysis to proceed:



pcrdata<-read.csv("File_path",header=FALSE)

pcrdata<-as.data.frame(t(pcrdata))

pcrdata[2:51]<-as.numeric(as.character(pcrdata))



Any help would be gratefully appreciated,



Mike Glanville

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to