I am not sure how to condense this question for a good title, so my apologies for the vagueness of the title. My problem is more complex (I think).
I am trying to write a code so that all I need to do is input my raw data, and R does all my statistical analysis for me with little effort from my part once I have written the code.
It will have to be done in stages, and at them moment I am just trying to create a function to create a standard curve for me.
My first obstacle is a for loop that I am using to prompt me to input my lines of data in order of replicates. I would like the code to return:
rep1 = c(1,2,3,4)
rep2 = c(1,2,3,4)
rep3 = c(1,2,3,4) (as an example)
For this I have used the following code which returns a non-numeric list of data that it prompted me to input:
for(x in c(1:3)){
assign(paste("rep", x, sep = ""),readline("Enter Dataset"))
}
To correct this, I tried the as.numeric() command to obtain numeric vectors, as follows:
for(x in c(1:3)){
as.numeric(unlist(strsplit(assign(paste("rep", x, sep = ""),
readline("Enter Dataset")), ",")))
}
However this code just returns the same response as the first code when I input my data.
Would anyone be able to offer an alternative method, or be able to get the second code to return numeric vectors as named above.
As a purely aesthetic addition, I would also like the code to request the data as follows:
Enter Dataset 1
Enter Dataset 2
Enter Dataset 3
depending on which iteration in the for loop is being requested.
This is a simplified version of my code, in reality I have many more replicates, and these vary with each experiment; I am able to code to take this into account, but it is not as neat as this simplified version.
Many thanks.