I am trying to solve a system of equations to do some error correction for mass spec data. The current situation is that I am solving a system of equations based on 12 unknown values. I have figured out how to use the solve(A, b) function in R to calculate one set of data but I have a data frame with thousands of entries. What I would like to do is be able to pull a row out of the table and use it as the solution vector for the solve function. A function to solve row by row with the solve function. Each row is a set of solution values for a solution vector. I have a coefficient vector set up that does not change and is static. This is what I have so far...
A <- read.csv("CE.csv", header = FALSE) #This is the vector used to store the coefficient values for the solve function b <- read.csv("sVar.csv", header = TRUE) #These are the solution values for the solve function in a data frame from a csv b1 <- array(c(13636.62207,12347.89844,14152.16211,17058.18555,12346.5498,14762.48438,13288.41699,14217.6377,17344.58008,15957.02148,12569.34473,13400.34277), c(12,1)) #b1 serves as how I am currently pulling the values to calculate solve. Its an example of an entry pull from one row of b solve(A, b1)
[,1] V1 1496.373 V2 12808.015 V3 12899.654 V4 17130.850 V5 13366.542 V6 16365.098 V7 14541.283 V8 14313.790 V9 17844.002 V10 16568.546 V11 13071.996 V12 13969.200
So in all I am looking to pull a row of data from a data frame, enter it into a solution vector then use it to calculate a set of 12 unknown variables for each entry and enter them into either a new data frame or as a new column of b.