Embarrassing mis-statement: I wrote: "I am not trying to learn Jd"
I meant: I am *now* trying to learn Jd -- Raul On Thu, Feb 10, 2022 at 1:58 PM Raul Miller <rauldmil...@gmail.com> wrote: > > http://rosettacode.org/wiki/Merge_and_aggregate_datasets > > After looking at this rosettacode task, I decided that Jd is probably > best suited for the J task implementation. So, I am not trying to > learn Jd (I had not had occasion to use it, previously). > > After a few minor mishaps, I've stumbled on an issue which I do not > know how to resolve. > > (Previous mishaps: csvload fails with an error suggesting that the > file does not exist if csvprepare has not been previously run. This > behavior is undocumented, except by example in the tutorials. Also, I > need to run the tutorial in a different J session from my testing work > to prevent the tutorials from breaking my tests.) > > Anyways, I'm currently getting an Unrecognized aggregate function > error, when trying to use the 'max' aggregate function. This should > demonstrate where I'm at: > > require'jd pacman' > load JDP,'tools/csv_load.ijs' > F=: jpath '~temp/rosettacode/example/CSV' > jdcreatefolder_jd_ CSVFOLDER=: F > > assert 0<{{)n > PATIENTID,LASTNAME > 1001,Hopper > 4004,Wirth > 3003,Kemeny > 2002,Gosling > 5005,Kurtz > }} fwrite F,'patients.csv' > > assert 0<{{)n > PATIENTID,VISIT_DATE,SCORE > 2002,2020-09-10,6.8 > 1001,2020-09-17,5.5 > 4004,2020-09-24,8.4 > 2002,2020-10-08, > 1001,,6.6 > 3003,2020-11-12, > 4004,2020-11-05,7.0 > 1001,2020-11-19,5.3 > }} fwrite F,'visits.csv' > > csvprepare 'patients';F,'patients.csv' > csvprepare 'visits';F,'visits.csv' > > csvload 'patients';1 > csvload 'visits';1 > > jd'ref patients PATIENTID visits PATIENTID' > > echo jd ([echo) deb {{)n > reads > p.PATIENTID, > LASTNAME:p.LASTNAME, > first v.VISIT_DATE > by > p.PATIENTID > from > p:patients, > v:p.visits > }} -.LF > > Now, ... one of my thoughts was that maybe this is a type error, > indicating that 'max' does not have a definition for the type of data > in this column. However, replacing 'max' with 'first' (which should be > defined for any type of column) also gives an "Unrecognized aggregate > function' error. > > So... > > (1) What am I doing wrong here, and > > (2) What should I have looked at to discover this information? > > Thanks, > > -- > Raul ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm