RE: How to read mixed-type data from external files?
- To: mathgroup at smc.vnet.net
- Subject: [mg37675] RE: [mg37636] How to read mixed-type data from external files?
- From: "DrBob" <majort at cox-internet.com>
- Date: Fri, 8 Nov 2002 02:15:10 -0500 (EST)
- Reply-to: <me at example.com>
- Sender: owner-wri-mathgroup at wolfram.com
data = Import["data.csv", "CSV"] DrBob drbob at bigfoot.com -----Original Message----- From: Wen-Feng Hsiao [mailto:wfhsiao at libra.seed.net.tw] To: mathgroup at smc.vnet.net Subject: [mg37675] [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