I edited your question to include the data you put in your comment. Using a textConnection
is very similar to accessing a file, but you may need to use the skip option if you first usereadLines
and then use read.table
, since I'm not sure that the file connection will always be kept open with those two functions on a file. I do not think you will be able to convert the sub-millisecond data to R time classes, since the precision of time data is consumed by the need to represent decades on a millisecond resolution and there just are not enough extra digits in the mantissa of an eight byte number. The zoo package does not require time as the index so you are free to use either sequence number or a "numeric" time scale rather than a 'time" time scale.
txt <- textConnection("ATF v1.00 Date=23-01-2012;
Time=10:38:56.421000;
TracePoints=16384;
TSamp=0.100000;
TimeUnits=1.00000e-006;
AmpToVolts=1.0000;
TraceMaxVolts=0.10000;
PTime=0.00000;
STime=0.00000;
[TraceData]
4.82178e-004
-1.37329e-003
2.19116e-003
4.38843e-003
1.65405e-003
3.36304e-003
5.95093e-003
2.19116e-003")
headers <- readLines(txt, n=9)
tracedat <- read.table(txt, header=TRUE)
closeAllConnections()
headers
#-----------------
[1] "ATF v1.00 Date=23-01-2012; " "Time=10:38:56.421000; "
[3] "TracePoints=16384; " "TSamp=0.100000; "
[5] "TimeUnits=1.00000e-006; " "AmpToVolts=1.0000;"
[7] "TraceMaxVolts=0.10000; " "PTime=0.00000; "
[9] "STime=0.00000; "
# ----------
tracedat
#-----------------
X.TraceData.
1 0.000482178
2 -0.001373290
3 0.002191160
4 0.004388430
5 0.001654050
6 0.003363040
7 0.005950930
8 0.002191160