jmp-l
[Top] [All Lists]

How to achieve this simple Column addition in JSL?

To: jmp-l@lists.biostat.wustl.edu
Subject: How to achieve this simple Column addition in JSL?
From: Fred Zhang <ieaggie2009@gmail.com>
Date: Wed, 11 Feb 2009 10:36:29 -0500
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type; bh=EWH8CNP0QCzpU5qPxxkdpvGRI8gghtCKpzikH6h2t5A=; b=tgfRPW4/ih5NQZ7LjYVrLtF7/34ihC1NhKZ4TqSPmQ+Dmt5dM9ve1HvxPjIpMamliR Yi/UGUePwJPLOpUxTapudcy28pQw2foyLIOv/vWJt/Ok8TJHIn4GUsJ0ejEM6pp6RiRQ jdCZzfhU/XhfY3jE9wd1HjAWz2D7v2vXBZgms=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=sLc8ChKH47dQdh/a7p7nadh2bKC04bNfiw/NrOTnHeGW1EVdM2iMhnKBe3qFo0CuDf LsDtUACzChXoN3UsqZZeWEQYuGtVbLeHsm9m5RKS+anIGtcEx6SQUm73eDKOxqlfBhGv cEQw1TqvbL0IuRlo7XI3nWEblPU4bSFhuWX0w=
Hi,
 
Just a newbie of JSL.
 
I open a data tabel (each column is numeric type).
And want to add up each other column to a new column "sum".
Given the following script, I always get the Log Comment:

invalid argument in access or evaluation of 'Column' , Column( dt, j )

Can anyone help me out?

Thanks, Fred

dt = currentdatatable();
nc = ncol(dt);
nr = nrow(dt);
show(nr);show(nc);
sumcol = dt << newcolumn("sum", numeric);
for(i=1, i<=nc, 1,
 for(j=1, j<=nr, 2,
  sumcol[i] += column(dt, j)[i];
 )
)

<Prev in Thread] Current Thread [Next in Thread>