I have the following script:
myfunctionSD2 <- function(mydata) { return(sd(mydata,na.rm=TRUE))}
SDmeas <- tapply(datIn$Measurement,list(as.factor(datIn$Measurement.location),as.factor(datIn$Tube.number)),myfunctionSD2)
SDMeasurement <- SDmeas[order(as.numeric(rownames(SDmeas))), ]
dput(SDMeasurement)
structure(c(0.6555264303958, 0.605687762634627, NA, 0.683435292388886, 
NA, 0.615207645374612, NA, 0.739018717912613, NA, 0.79341715750565, 
NA, 0.769473075819677, NA, NA, NA, NA, NA, 0.6555264303958, 0.605687762634627, 
0.576875822240553, NA, 0.502849025908516, NA, 0.516028792109233, 
NA, 0.486023134629369, NA, 0.489281948774758, NA, 0.464851913610455, 
NA, 0.499546896146173, NA, NA, 0.6555264303958, 0.605687762634627, 
NA, 0.683435292388886, NA, 0.615207645374612, NA, 0.739018717912613, 
NA, 0.79341715750565, NA, 0.769473075819677, NA, NA, NA, NA, 
NA, 0.6555264303958, 0.605687762634627, NA, 0.683435292388886, 
NA, 0.615207645374612, NA, 0.739018717912613, NA, 0.79341715750565, 
NA, 0.769473075819677, NA, 0.773437871034822, NA, NA, NA, 0.6555264303958, 
0.605687762634627, NA, 0.683435292388886, NA, 0.615207645374612, 
NA, 0.739018717912613, NA, 0.79341715750565, NA, 0.769473075819677, 
NA, 0.773437871034822, NA, 0.760395526989779, 0.607323723612999, 
0.6555264303958, 0.605687762634627, NA, 0.683435292388886, NA, 
0.615207645374612, NA, 0.739018717912613, NA, 0.79341715750565, 
NA, 0.769473075819677, NA, 0.773437871034822, NA, 0.760395526989779, 
NA), .Dim = c(17L, 6L), .Dimnames = list(c("1", "3", "4", "5", 
"6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", 
"17", "19"), c("1", "2", "3", "4", "5", "6")))
Which in clear format the table looks like this:
           1         2         3         4         5         6
1  0.6555264 0.6555264 0.6555264 0.6555264 0.6555264 0.6555264
3  0.6056878 0.6056878 0.6056878 0.6056878 0.6056878 0.6056878
4         NA 0.5768758        NA        NA        NA        NA
5  0.6834353        NA 0.6834353 0.6834353 0.6834353 0.6834353
6         NA 0.5028490        NA        NA        NA        NA
7  0.6152076        NA 0.6152076 0.6152076 0.6152076 0.6152076
8         NA 0.5160288        NA        NA        NA        NA
9  0.7390187        NA 0.7390187 0.7390187 0.7390187 0.7390187
10        NA 0.4860231        NA        NA        NA        NA
11 0.7934172        NA 0.7934172 0.7934172 0.7934172 0.7934172
12        NA 0.4892819        NA        NA        NA        NA
13 0.7694731        NA 0.7694731 0.7694731 0.7694731 0.7694731
14        NA 0.4648519        NA        NA        NA        NA
15        NA        NA        NA 0.7734379 0.7734379 0.7734379
16        NA 0.4995469        NA        NA        NA        NA
17        NA        NA        NA        NA 0.7603955 0.7603955
19        NA        NA        NA        NA 0.6073237        NA
Here the column heads are the Tube.numbers and the row titels are the Measurement.locations.
I would like to plot each tube number (so 6 lines) into one graph with on the x axis the Measurement locations and the y axis the Standard deviation (The calculated values in the table)
I tried with matplot but I dont seem to be able to go around the necessity of having to have equal number of rows and columns. I would prefer to do it in a loop.
Can anybody help me?
Much appreciated!
 
     
    
 
    
