Re: How to read mixed-type data from external files?
- To: mathgroup at smc.vnet.net
- Subject: [mg37683] Re: [mg37636] How to read mixed-type data from external files?
- From: Tomas Garza <tgarza01 at prodigy.net.mx>
- Date: Fri, 8 Nov 2002 02:15:56 -0500 (EST)
- References: <200211071141.GAA00782@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
I suggest you use
In[1]:=
Import["data.csv", "CSV"]
This will do the job.
Tomas Garza
Mexico City
----- Original Message -----
From: "Wen-Feng Hsiao" <wfhsiao at libra.seed.net.tw>
To: mathgroup at smc.vnet.net
Subject: [mg37683] [mg37636] How to read mixed-type data from external files?
> Hello,
>
> Suppose the type of the second column is String, the others are numbers.
>
> In[1]:=!! data.csv
> 1,WEIGHT,97.5,1123,371,50,25,0.1,2.2046223
> 2,STATURE,797.5,1944,1385,50,25,0.1,0.3937008
> 3,VERTICAL GRIP RCH,957.5,2332,1674,50,30,0.1,0.3937008
> 4,FRONTAL GRIP REACH,337.5,831,580,20,10,0.1,0.3937008
> 5,LATERAL GRIP REACH,462.5,1108,773,25,15,0.1,0.3937008
> 6,STEP HEIGHT,207.5,942,572,25,15,0.1,0.3937008
> 7,SUPINE STATURE,897.5,1925,1441,50,25,0.1,0.3937008
> 8,STANDING CG F FEET,507.5,1075,810,20,15,0.1,0.3937008
> ...
>
> I tried the following code, but in vain. Could someone help me this out?
>
> snum = OpenRead["data.csv"]
> data = ReadList[
> snum, {Number, String, Number, Number, Number, Number, Number, Number,
> Number}]
> Close[snum]
>
> Thanks a lot!
>
> Wen-Feng Hsiao
>
>
- References:
- How to read mixed-type data from external files?
- From: wfhsiao@libra.seed.net.tw (Wen-Feng Hsiao)
- How to read mixed-type data from external files?