Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.math.mathematica

Topic: Mathematica v8: import a space-delimited table of numbers?
Replies: 1   Last Post: Jan 22, 2011 3:25 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Gordon Robertson

Posts: 18
Registered: 11/15/07
Mathematica v8: import a space-delimited table of numbers?
Posted: Jan 21, 2011 4:30 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply


I routinely use Import[] for "CSV" and "TSV" files, but now need to
import a space-delimited file in which each line has a string as the
first element, and then thousands of (space-delimited) decimal numbers.

After looking at the help documentation, and previous posts on
MathGroup, I don't see a simple way to Import while specifying that the
separator is a space (in R's read.table, I'd use sep=" ").

I expect that I could read in the file as a table, split lines on
spaces, then map ToExpression across the numbers in each row. Have I'd
missed something in the documentation?

Thanks for your help.

Gordon
--
Gordon Robertson
BC Cancer Agency Genome Sciences Centre
Vancouver BC Canada
604-707-5800
www.bcgsc.ca


--------------080102060502060908060009
Content-Type: text/html; charset="ISO-8859-1"
X-Sun-Content-Length: 1332

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>

<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body bgcolor="#ffffff" text="#000000">
I routinely use Import[] for "CSV" and "TSV" files, but now need to
import a space-delimited file in which each line has a string as the
first element, and then thousands of (space-delimited) decimal
numbers. <br>
<br>
After looking at the help documentation, and previous posts on
MathGroup, I don't see a simple way to Import while specifying that
the separator is a space (in R's read.table, I'd use sep=" "). <br>
<br>
I expect that I could read in the file as a table, split lines on
spaces, then map ToExpression across the numbers in each row. Have
I'd missed something in the documentation?<br>
<br>
Thanks for your help.<br>
<br>
Gordon<br>
<div class="moz-signature">-- <br>
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1">
<title></title>
Gordon Robertson<br>
BC Cancer Agency Genome Sciences Centre<br>
Vancouver BC Canada<br>
604-707-5800<br>
<a class="moz-txt-link-abbreviated" href="http://www.bcgsc.ca">www.bcgsc.ca</a><br>
<br>
</div>
</body>
</html>

--------------080102060502060908060009--




Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.