On Feb 23, 2010, at 10:23 PM, RagingJim wrote:


To the R experts,

I am currently playing with a program which was designed so that the outputs are to be read in "Surfer". I do not have the program, but the files, can but put into excel and graphed. I figured i could do the same thing with R.

If I open the file with excel, and put the text into columns,

Generally lines are read in as rows, but if you have all all numerics, then it would be a fairly simple matter to make a data.matrix and transpose.

and separate them by spaces,

No need to "separate by spaces" since any white space will be considered as a separation.

I can then graph it. But how do I do this in R?

It would help if you would be more precise and especially if you would attach a text file.

Once I have
done all that in excel and saved it, I can then open it and do a 3d suface
plot in R, but I would like to skip the excel step.

Each line looks like this:

0.2100209E+03 0.2109997E+03 0.2111866E+03 0.2095219E+03 0.2079958E+03 0.2088303E+03 0.2095171E+03 0.2104975E+03 0.2124125E+03 0.2132827E+03 0.2125371E+03 0.2119912E+03 0.2119215E+03 0.2127108E+03 0.2147589E+03 0.2167924E+03 0.2157783E+03 0.2144353E+03 0.2127579E+03 0.2085133E+03 0.2065096E+03 0.2037935E+03 0.1973606E+03 0.1945031E+03 0.2076126E+03 0.2131146E+03 0.2014675E+03 0.1999074E+03 0.1994730E+03 0.2003694E+03 0.2003093E+03 0.2017771E+03 0.2070309E+03 0.1945123E+03 0.1892468E+03 0.1857383E+03 0.1817865E+03 0.1791424E+03 0.1785881E+03 0.1791883E+03 0.1803020E+03 0.1797575E+03 0.1807816E+03 0.1835612E+03 0.1866963E+03 0.1882194E+03 0.1919594E+03 0.1940257E+03 0.1977790E+03 0.1970629E+03 0.1983556E+03 0.1990551E+03 0.1999159E+03 0.2016027E+03 0.2029541E+03 0.2049124E+03 0.2077511E+03 0.2081407E+03 0.2074211E+03 0.2082496E+03
0.2088355E+03  0.2089197E+03  0.2106171E+03  0.2125163E+03

The first thing I have to do is remove the first 4 lines (which are just
file information),

The read.table function has a skip argument:

?read.table

Perhaps:

dta <- read.table(file="/wherever/whatever.txt", skip=4)

and then separate each value

"Each value into its own column" would be the default action ... if there were no line feeds. which is not possible to determine from what you presented..

--
David.


into its own column. How do
I go about doing that?

Cheers lads.
--
View this message in context: 
http://n4.nabble.com/reading-surfer-files-tp1566943p1566943.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to