Re: [Jprogramming] file read

2012-11-11 Thread Björn Helgason
This here looks even better grid >TAB cut &.> (<;._2) fd6 2012/11/11 Björn Helgason > I copied the contents of this script into the scratch window of JHS and > ran it and the grid works just fine there as well as in GTK > > fd=: 0 : 0 > NB. a \t 1 \t 2 \t 3 > NB. b \t \t 5 \t 6 > NB. c \t 7 \t

Re: [Jprogramming] file read

2012-11-11 Thread Björn Helgason
I copied the contents of this script into the scratch window of JHS and ran it and the grid works just fine there as well as in GTK fd=: 0 : 0 NB. a \t 1 \t 2 \t 3 NB. b \t \t 5 \t 6 NB. c \t 7 \t \t 9 NB. d \t 10 \t 11 \t 12 NB. \t 13 \t 14 \t 15 ) [fd2=:fd rplc '\t \t';'\t NA \t' [fd3=:fd2 rpl

Re: [Jprogramming] file read

2012-11-11 Thread Björn Helgason
fd=:'mytestfile.txt' NB. TAB text file NB. a \t 1 \t 2 \t 3 NB. b \t \t 5 \t 6 NB. c \t 7 \t \t 9 NB. d \t 10 \t 11 \t 12 NB. \t 13 \t 14 \t 15 1a 1 2 3 2b NA 5 6 3c 7 NA 9 4d 10 11 12 5 13 14 15 fd=: 0 : 0 NB. a \t 1 \t 2 \t 3 NB. b \t \t 5 \t 6 NB. c \t 7 \t \t 9 NB. d

Re: [Jprogramming] file read

2012-11-09 Thread kamakura
Thanks for everything. The utility function readdsv is functionally enough for my purpose. But I noticed that high functionality results in less speed. It takes much time for reading more than 400 million lines with each line of a hundred variables. Thanks again. Toshinari On 2012/11/10,

Re: [Jprogramming] file read

2012-11-09 Thread Devon McCormick
Note that "readdsv" takes an optional left argument to specify the delimiter and quotes character, with a default of (TAB;'"'), e.g. readdsv 'testTAB.txt' ++-+-+ |This is entry |1|... more stuff | ++-+-+

Re: [Jprogramming] file read

2012-11-09 Thread Ric Sherlock
You might want to look at the 'tables/dsv' and 'tables/csv' addons. http://www.jsoftware.com/jwiki/Addons/tables/dsv http://www.jsoftware.com/jwiki/Addons/tables/csv The 'tables/csv' addon is basically a special case of the more general 'tables/dsv', where the delimiter is set to ',' and the quote

Re: [Jprogramming] file read

2012-11-09 Thread Devon McCormick
We did a "Beginner's Regatta" at NYCJUG earlier this year in which we explored importing tabular data into J from delimited files: http://www.jsoftware.com/jwiki/NYCJUG/2012-05-08#Beginner.27s_regatta with a follow-up the following month: http://www.jsoftware.com/jwiki/NYCJUG/2012-06-12#Follow-up_t

Re: [Jprogramming] file read

2012-11-08 Thread Ric Sherlock
Purely a convenience thing, but using the verb freads rather than fread will take care of the line-ending issue, by converting to the J standard of LF-delimited lines. The verb fwrites will convert J line-endings to the conventional line-ending for your current platform. On Nov 8, 2012 12:34 PM, "R

Re: [Jprogramming] file read

2012-11-08 Thread Raul Miller
(responding inline because that makes sense to me, here.) On Wed, Nov 7, 2012 at 11:53 PM, Toshinari Kamakura wrote: > Thank you for quick responding to my mail. That was pure luck -- I just happened to be checking my email shortly after your previous post arrived. > My desire is just to handle

Re: [Jprogramming] file read

2012-11-08 Thread Brian Schott
J has no explicit NA value. It is not simple to produce results like you want because even with all numeric data that include missing values, the missing values of "NA" are not numeric and complicate the production of results. Numeric NA values can be represented with J _. but this is very tricky a

Re: [Jprogramming] file read

2012-11-07 Thread Toshinari Kamakura
Thank you for quick responding to my mail. My desire is just to handle the missing values as R language can do. > u=read.table("mytestfile.txt",header=F,na.strings="",sep="\t") > u V1 V2 V3 V4 1a 1 2 3 2b NA 5 6 3c 7 NA 9 4d 10 11 12 5 13 14 15 The R system inputs NA v

Re: [Jprogramming] file read

2012-11-07 Thread Raul Miller
I am not sure what your line ends look like. A general implementation might be: <;._2@,&TAB;._2 -.&CR ,&LF fread 'mytestfile.txt' This will have an extra blank row at the bottom if your file is newline terminated, in which case you might want: <;._2@,&TAB;._2 -.&CR fread 'mytestfile.txt'

[Jprogramming] file read

2012-11-07 Thread kamakura
Hi I would like to know J's manipulation for reading text file. fd=:'mytestfile.txt' NB. TAB text file NB. a \t 1 \t 2 \t 3 NB. b \t \t 5 \t 6 NB. c \t 7 \t \t 9 NB. d \t 10 \t 11 \t 12 NB. \t 13 \t 14 \t 15 fd2=:'mytestfile.csv' NB. CSV test file load'files misc' freads fd2 a,1,2,3 b,,5,6 c