Trying to convert .txt ASCII file into something useable for excel. R noob please help!

Grad student here trying to figure out how to create R code that will let me export my data to Excel so I don't have to copy and paste every single number. I've been trying to google data conversion and I'm finding a lot of how to convert to ASCII, but not out of it. I need to figure out how to be able to separate one column from the rest.
Here is a sample of what it looks like:
Sweep, Ampl3V, peakinit, endinit
1, -8.0000E-02, -1.7193E-10, -3.9777E-11
2, -7.5000E-02, -1.3867E-10, -4.7202E-11
3, -7.0000E-02, -1.1867E-10, 1.8771E-11
4, -6.5000E-02, -9.6131E-11, -2.8952E-11
5, -6.0000E-02, -5.4482E-11, 5.2756E-11
6, -5.5000E-02, -1.3670E-10, 4.9615E-11
7, -5.0000E-02, -1.8206E-10, 3.3798E-12
8, -4.5000E-02, -3.8146E-10, -5.5168E-11
9, -4.0000E-02, -6.8466E-10, -6.0867E-11
10, -3.5000E-02, -1.3203E-09, -1.1715E-10
11, -3.0000E-02, -2.2321E-09, -1.4820E-10
12, -2.5000E-02, -3.5487E-09, -2.3324E-10
13, -2.0000E-02, -4.4782E-09, -1.5906E-10
14, -1.5000E-02, -5.2740E-09, -2.3212E-10
15, -1.0000E-02, -6.3717E-09, -2.3147E-10
16, -5.0000E-03, -6.5802E-09, -2.6352E-10
17, 0.0000E+00, -6.4984E-09, -2.8782E-10
18, 5.0000E-03, -6.4073E-09, -2.5161E-10
19, 1.0000E-02, -6.4999E-09, -2.4702E-10
20, 1.5000E-02, -6.5489E-09, -2.5131E-10
21, 2.0000E-02, -6.4892E-09, -2.1675E-10
22, 2.5000E-02, -6.2739E-09, -2.0612E-10
23, 3.0000E-02, -5.8342E-09, -2.2171E-10
24, 3.5000E-02, -5.5533E-09, -1.3433E-10
25, 4.0000E-02, -5.1072E-09, -9.9001E-11
26, 4.5000E-02, -4.7549E-09, -9.3053E-11

I have managed to put it in a matrix, but I'm not sure if that's the correct direction I need to be going. When I use [ , 2] it gives me all the data.

(an_example_matrix <- as.matrix(warpbreaks[1:10,]))

write.csv(x = an_example_matrix,
          file = "testmat.csv")

Thank you SOOOO much!!!!

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.