@ -202,7 +202,7 @@ chronoamp2df <- function(datafilename, wearea = 1) {
## $ InitE : num
## $ InitE : num
## $ HighE : num
## $ HighE : num
## $ LowE : num
## $ LowE : num
## $ InitPN : num
## $ InitPN : chr
## $ Step : num
## $ Step : num
## $ Pulse width : num
## $ Pulse width : num
## $ Sample interval : num
## $ Sample interval : num
@ -248,12 +248,12 @@ chronoamp2df <- function(datafilename, wearea = 1) {
for ( s in 1 : length ( starts ) ) {
for ( s in 1 : length ( starts ) ) {
zz <- textConnection ( chifile [starts [s ] : ends [s ] ] , " r" )
zz <- textConnection ( chifile [starts [s ] : ends [s ] ] , " r" )
ff <- rbind ( ff ,
ff <- rbind ( ff ,
data.frame ( sampleid , step = factor ( s ) ,
data.frame ( sampleid , step .current = s ,
matrix ( scan ( zz , what = numeric ( ) , sep = " ," ) ,
matrix ( scan ( zz , what = numeric ( ) , sep = " ," ) ,
ncol = 2 , byrow = T ) ) )
ncol = 2 , byrow = T ) ) )
close ( zz )
close ( zz )
}
}
names ( ff ) <- c ( " sampleid" , " step ", " time" , " current" )
names ( ff ) <- c ( " sampleid" , " step .current ", " time" , " current" )
# Calculate current density
# Calculate current density
currentdensity <- ff $ current / wearea
currentdensity <- ff $ current / wearea
ff <- cbind ( ff , currentdensity = currentdensity )
ff <- cbind ( ff , currentdensity = currentdensity )
@ -274,12 +274,12 @@ chronoamp2df <- function(datafilename, wearea = 1) {
ff $ LowE <- LowE
ff $ LowE <- LowE
# InitPN
# InitPN
position.InitPN <- regexpr ( " ^Init\\sP/N" , chifile )
position.InitPN <- regexpr ( " ^Init\\sP/N" , chifile )
InitPN <- as.numeric( strsplit( chifile [which ( position.InitPN == 1 ) ] , " \\s=\\s" ) [ [1 ] ] [2 ] )
InitPN <- strsplit( chifile [which ( position.InitPN == 1 ) ] , " \\s=\\s" ) [ [1 ] ] [2 ]
ff $ InitPN <- InitPN
ff $ InitPN <- InitPN
# Step
# Step s (total number of steps)
position.Step <- regexpr ( " ^Step\\s" , chifile )
position.Step s <- regexpr ( " ^Step\\s" , chifile )
Step <- as.numeric ( strsplit ( chifile [which ( position.Step == 1 ) ] , " \\s=\\s" ) [ [1 ] ] [2 ] )
Step s <- as.numeric ( strsplit ( chifile [which ( position.Step s == 1 ) ] , " \\s=\\s" ) [ [1 ] ] [2 ] )
ff $ Step <- Step
ff $ Step s <- Step s
# Pulse width (s)
# Pulse width (s)
position.PulseWidth <- regexpr ( " ^Pulse\\sWidth\\s\\(sec\\)" , chifile )
position.PulseWidth <- regexpr ( " ^Pulse\\sWidth\\s\\(sec\\)" , chifile )
PulseWidth <- as.numeric ( strsplit ( chifile [which ( position.PulseWidth == 1 ) ] , " \\s=\\s" ) [ [1 ] ] [2 ] )
PulseWidth <- as.numeric ( strsplit ( chifile [which ( position.PulseWidth == 1 ) ] , " \\s=\\s" ) [ [1 ] ] [2 ] )