emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* evaluating rows or columns in org-table
@ 2008-07-30 14:08 Kene Meniru
  2008-07-30 15:21 ` Bernt Hansen
  0 siblings, 1 reply; 6+ messages in thread
From: Kene Meniru @ 2008-07-30 14:08 UTC (permalink / raw)
  To: emacs-orgmode


   |   |   | names      | grade 1 | grade 2 | grade 3 | Total |   | 
Letter grade |
 
|---+---+------------+---------+---------+---------+-------+---+--------------|
   | # | 1 | student 01 |   91.80 |   96.40 |   97.00 | 95.07 | 1 | C 
          |
   | # | 2 | student 02 |   88.78 |   89.15 |   98.00 | 91.98 | 2 | B 
          |
   | # | 3 | student 03 |   92.00 |   95.14 |   97.00 | 94.71 | 3 | B 
          |
   | # | 4 | student 04 |   84.00 |   74.62 |   88.00 | 82.21 | 4 | B 
          |
#+TBLFM: $7=($4+$5+$6)/3;%.2f

Sample letter grade calculation:
90-100 = A
80-89  = B
70-79  = C
60-69  = D
  0-59  = F

I am deeply sorry if this has been addressed before here. I have 
searched but could not find any reference.
I am a teacher and have been using org-mode in combination with noweb as 
a class manager. I also use moodle and blackboard but I like to keep my 
lecture notes and student grades local on my machine. I typically have 
the above table for student grades (usually substantially more than 
that). I am able to calculate many things like averages, etc., but would 
like to have letter grades and "best performing" comments by the 
students doing as well.

Starting with letter grades, is there a way I can evaluate the Total 
column and assign letter grades as shown above? Thanks


-- 

Kene Meniru
::::::::::::::::::::::::::::
keMeniru@gmail.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: evaluating rows or columns in org-table
  2008-07-30 14:08 evaluating rows or columns in org-table Kene Meniru
@ 2008-07-30 15:21 ` Bernt Hansen
  2008-07-30 16:12   ` Bernt Hansen
  0 siblings, 1 reply; 6+ messages in thread
From: Bernt Hansen @ 2008-07-30 15:21 UTC (permalink / raw)
  To: Kene Meniru; +Cc: emacs-orgmode

Kene Meniru <kemeniru@gmail.com> writes:

>   |   |   | names      | grade 1 | grade 2 | grade 3 | Total |   |
> Letter grade |
>
> |---+---+------------+---------+---------+---------+-------+---+--------------|
>   | # | 1 | student 01 |   91.80 |   96.40 |   97.00 | 95.07 | 1 | C
> |
>   | # | 2 | student 02 |   88.78 |   89.15 |   98.00 | 91.98 | 2 | B
> |
>   | # | 3 | student 03 |   92.00 |   95.14 |   97.00 | 94.71 | 3 | B
> |
>   | # | 4 | student 04 |   84.00 |   74.62 |   88.00 | 82.21 | 4 | B
> |
> #+TBLFM: $7=($4+$5+$6)/3;%.2f
>
> Sample letter grade calculation:
> 90-100 = A
> 80-89  = B
> 70-79  = C
> 60-69  = D
>  0-59  = F
>
> I am deeply sorry if this has been addressed before here. I have
> searched but could not find any reference.
> I am a teacher and have been using org-mode in combination with noweb
> as a class manager. I also use moodle and blackboard but I like to
> keep my lecture notes and student grades local on my machine. I
> typically have the above table for student grades (usually
> substantially more than that). I am able to calculate many things like
> averages, etc., but would like to have letter grades and "best
> performing" comments by the students doing as well.
>
> Starting with letter grades, is there a way I can evaluate the Total
> column and assign letter grades as shown above? Thanks

It's a bit ugly but I think it works...

|   |   | names      | grade 1 | grade 2 | grade 3 | Total |   | Letter grade |
|---+---+------------+---------+---------+---------+-------+---+--------------|
| # | 1 | student 01 |   91.80 |   96.40 |   97.00 | 95.07 | 1 | A            |
|   |   |            |         |         |         |       |   |              |
| # | 2 | student 02 |   88.78 |   89.15 |   98.00 | 91.98 | 2 | A            |
|   |   |            |         |         |         |       |   |              |
| # | 3 | student 03 |   92.00 |   95.14 |   97.00 | 94.71 | 3 | A            |
|   |   |            |         |         |         |       |   |              |
| # | 4 | student 04 |   84.00 |   74.62 |   88.00 | 82.21 | 4 | B            |
|   |   |            |         |         |         |       |   |              |
#+TBLFM: $7=($4+$5+$6)/3;%.2f::$9=if($7<60,string("F"),if($7<70,string("D"),if($7<80,string("C"),if($7<90,string("B"),string("A")))))

There might be a better/cleaner way to do this.

This also seems to work:

#+TBLFM: $7=($4+$5+$6)/3;%.2f::$9=if($7<60,F,if($7<70,D,if($7<80,C,if($7<90,B,A))))

-Bernt

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: evaluating rows or columns in org-table
  2008-07-30 15:21 ` Bernt Hansen
@ 2008-07-30 16:12   ` Bernt Hansen
  2008-07-30 16:16     ` Bernt Hansen
  0 siblings, 1 reply; 6+ messages in thread
From: Bernt Hansen @ 2008-07-30 16:12 UTC (permalink / raw)
  To: Kene Meniru; +Cc: emacs-orgmode

Bernt Hansen <bernt@norang.ca> writes:

> Kene Meniru <kemeniru@gmail.com> writes:
>
>>   |   |   | names      | grade 1 | grade 2 | grade 3 | Total |   |
>> Letter grade |
>>
>> |---+---+------------+---------+---------+---------+-------+---+--------------|
>>   | # | 1 | student 01 |   91.80 |   96.40 |   97.00 | 95.07 | 1 | C
>> |
>>   | # | 2 | student 02 |   88.78 |   89.15 |   98.00 | 91.98 | 2 | B
>> |
>>   | # | 3 | student 03 |   92.00 |   95.14 |   97.00 | 94.71 | 3 | B
>> |
>>   | # | 4 | student 04 |   84.00 |   74.62 |   88.00 | 82.21 | 4 | B
>> |
>> #+TBLFM: $7=($4+$5+$6)/3;%.2f
>>
>> Sample letter grade calculation:
>> 90-100 = A
>> 80-89  = B
>> 70-79  = C
>> 60-69  = D
>>  0-59  = F
>>
>> I am deeply sorry if this has been addressed before here. I have
>> searched but could not find any reference.
>> I am a teacher and have been using org-mode in combination with noweb
>> as a class manager. I also use moodle and blackboard but I like to
>> keep my lecture notes and student grades local on my machine. I
>> typically have the above table for student grades (usually
>> substantially more than that). I am able to calculate many things like
>> averages, etc., but would like to have letter grades and "best
>> performing" comments by the students doing as well.
>>
>> Starting with letter grades, is there a way I can evaluate the Total
>> column and assign letter grades as shown above? Thanks
>
> It's a bit ugly but I think it works...
>
> |   |   | names      | grade 1 | grade 2 | grade 3 | Total |   | Letter grade |
> |---+---+------------+---------+---------+---------+-------+---+--------------|
> | # | 1 | student 01 |   91.80 |   96.40 |   97.00 | 95.07 | 1 | A            |
> |   |   |            |         |         |         |       |   |              |
> | # | 2 | student 02 |   88.78 |   89.15 |   98.00 | 91.98 | 2 | A            |
> |   |   |            |         |         |         |       |   |              |
> | # | 3 | student 03 |   92.00 |   95.14 |   97.00 | 94.71 | 3 | A            |
> |   |   |            |         |         |         |       |   |              |
> | # | 4 | student 04 |   84.00 |   74.62 |   88.00 | 82.21 | 4 | B            |
> |   |   |            |         |         |         |       |   |              |
> #+TBLFM: $7=($4+$5+$6)/3;%.2f::$9=if($7<60,string("F"),if($7<70,string("D"),if($7<80,string("C"),if($7<90,string("B"),string("A")))))
>
> There might be a better/cleaner way to do this.
>
> This also seems to work:
>
> #+TBLFM: $7=($4+$5+$6)/3;%.2f::$9=if($7<60,F,if($7<70,D,if($7<80,C,if($7<90,B,A))))

Here's my attempt at fixing the student rank

|   | Rank | names      | grade 1 | grade 2 | grade 3 | Total | Letter grade |
|---+------+------------+---------+---------+---------+-------+--------------|
| # |    1 | student 01 |   91.80 |   96.40 |   97.00 | 95.07 | A            |
| # |    3 | student 03 |   92.00 |   95.14 |   97.00 | 94.71 | A            |
| # |    2 | student 02 |   88.78 |   89.15 |   98.00 | 91.98 | A            |
| # |    4 | student 04 |   84.00 |   74.62 |   88.00 | 82.21 | B            |
#+TBLFM: $7=($4+$5+$6)/3;%.2f::$8=if($7<60,F,if($7<70,D,if($7<80,C,if($7<90,B,A))))::@2$2=1::$2=@-1+1

If you sort the table by the total column descending to get the rank

If you sort the resulting table like this:

 1) Position cursor on any total value
 2) M-x org-table-sort-lines
 3) N (for reverse numeric sort)

Then you need to set the ranking data sequentially starting from 1 on
row 1.

So... the final table looks like this:


-Bernt

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: evaluating rows or columns in org-table
  2008-07-30 16:12   ` Bernt Hansen
@ 2008-07-30 16:16     ` Bernt Hansen
  2008-07-30 17:49       ` Gabriel Peters
  0 siblings, 1 reply; 6+ messages in thread
From: Bernt Hansen @ 2008-07-30 16:16 UTC (permalink / raw)
  To: Kene Meniru; +Cc: emacs-orgmode

Sorry that last post was unfinished.

Here's my attempt at fixing the student rank

|   | Rank | names      | grade 1 | grade 2 | grade 3 | Total | Letter grade |
|---+------+------------+---------+---------+---------+-------+--------------|
| # |    1 | student 01 |   91.80 |   96.40 |   97.00 | 95.07 | A            |
| # |    3 | student 03 |   92.00 |   95.14 |   97.00 | 94.71 | A            |
| # |    2 | student 02 |   88.78 |   89.15 |   98.00 | 91.98 | A            |
| # |    4 | student 04 |   84.00 |   74.62 |   88.00 | 82.21 | B            |
#+TBLFM: $7=($4+$5+$6)/3;%.2f::$8=if($7<60,F,if($7<70,D,if($7<80,C,if($7<90,B,A))))::@2$2=1::$2=@-1+1

You can sort the table by the total column descending to get the rank.

If you sort the resulting table like this:

 1) Position cursor on any total value
 2) M-x org-table-sort-lines
 3) N (for reverse numeric sort)

Then update the Rank column with C-u C-u C-c C-c anywhere in the table
the rank numbers are recomputed starting from 1 on the first row.

I hope your blank lines aren't too important because sorting puts them
all at the bottom of the table.

Does that do what you want?

-Bernt

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Re: evaluating rows or columns in org-table
  2008-07-30 16:16     ` Bernt Hansen
@ 2008-07-30 17:49       ` Gabriel Peters
  2008-07-30 18:05         ` Bernt Hansen
  0 siblings, 1 reply; 6+ messages in thread
From: Gabriel Peters @ 2008-07-30 17:49 UTC (permalink / raw)
  To: Bernt Hansen; +Cc: Kene Meniru, emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 2331 bytes --]

On Wed, Jul 30, 2008 at 9:16 AM, Bernt Hansen <bernt@norang.ca> wrote:

> Sorry that last post was unfinished.
>
> Here's my attempt at fixing the student rank
>
> |   | Rank | names      | grade 1 | grade 2 | grade 3 | Total | Letter
> grade |
>
> |---+------+------------+---------+---------+---------+-------+--------------|
> | # |    1 | student 01 |   91.80 |   96.40 |   97.00 | 95.07 | A
>  |
> | # |    3 | student 03 |   92.00 |   95.14 |   97.00 | 94.71 | A
>  |
> | # |    2 | student 02 |   88.78 |   89.15 |   98.00 | 91.98 | A
>  |
> | # |    4 | student 04 |   84.00 |   74.62 |   88.00 | 82.21 | B
>  |
> #+TBLFM:
> $7=($4+$5+$6)/3;%.2f::$8=if($7<60,F,if($7<70,D,if($7<80,C,if($7<90,B,A))))::@2$2=1::$2=@-1+1
>
> You can sort the table by the total column descending to get the rank.
>
> If you sort the resulting table like this:
>
>  1) Position cursor on any total value
>  2) M-x org-table-sort-lines
>  3) N (for reverse numeric sort)
>
> Then update the Rank column with C-u C-u C-c C-c anywhere in the table
> the rank numbers are recomputed starting from 1 on the first row.
>
> I hope your blank lines aren't too important because sorting puts them
> all at the bottom of the table.



The blank lines do also pose a problem in different approach, one which will
make use of vector functions in calc. If you allow for no empty lines and
one extra line toward the end of table, this also can do the computation.


|   | Rank | names      | grade 1 | grade 2 | grade 3 | Total | Letter grade
|
|---+------+------------+---------+---------+---------+-------+--------------|
| # |    1 | student 01 |   91.80 |   96.40 |   97.00 | 95.07 | A
|
| # |    2 | student 03 |   92.00 |   95.14 |   97.00 | 94.71 | A
|
| # |    3 | student 02 |   88.78 |   89.15 |   98.00 | 91.98 | A
|
| # |    4 | student 04 |   84.00 |   74.62 |   88.00 | 82.21 | B
|
|---+------+------------+---------+---------+---------+-------+--------------|
#+TBLFM: $2=find(rsort(@I$7..@II
$7),$7)::$7=($4+$5+$6)/3;%.2f::$8=if($7<60,F,if($7<70,D,if($7<80,C,if($7<90,B,A))))



>
> Does that do what you want?
>
> -Bernt
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>

[-- Attachment #1.2: Type: text/html, Size: 3914 bytes --]

[-- Attachment #2: Type: text/plain, Size: 204 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Re: evaluating rows or columns in org-table
  2008-07-30 17:49       ` Gabriel Peters
@ 2008-07-30 18:05         ` Bernt Hansen
  0 siblings, 0 replies; 6+ messages in thread
From: Bernt Hansen @ 2008-07-30 18:05 UTC (permalink / raw)
  To: Gabriel Peters; +Cc: Kene Meniru, emacs-orgmode

"Gabriel Peters" <gabrielpeters1000@gmail.com> writes:

> The blank lines do also pose a problem in different approach, one which will
> make use of vector functions in calc. If you allow for no empty lines and one
> extra line toward the end of table, this also can do the computation.
>
> |   | Rank | names      | grade 1 | grade 2 | grade 3 | Total | Letter grade |
> |---+------+------------+---------+---------+---------+-------+--------------|
> | # |    1 | student 01 |   91.80 |   96.40 |   97.00 | 95.07 | A            |
> | # |    2 | student 03 |   92.00 |   95.14 |   97.00 | 94.71 | A            |
> | # |    3 | student 02 |   88.78 |   89.15 |   98.00 | 91.98 | A            |
> | # |    4 | student 04 |   84.00 |   74.62 |   88.00 | 82.21 | B            |
> |---+------+------------+---------+---------+---------+-------+--------------|
> #+TBLFM: $2=find(rsort(@I$7..@II$7),$7)::$7=($4+$5+$6)/3;%.2f::$8=if($7
> <60,F,if($7<70,D,if($7<80,C,if($7<90,B,A))))

Cool :) I learn something new everyday!  And this doesn't require that
you sort the entries first to get it right - so I like Gabriel's
solution better.

This way you are free to sort the table anyway you like and the data is
still correct.

-Bernt

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-07-30 18:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-07-30 14:08 evaluating rows or columns in org-table Kene Meniru
2008-07-30 15:21 ` Bernt Hansen
2008-07-30 16:12   ` Bernt Hansen
2008-07-30 16:16     ` Bernt Hansen
2008-07-30 17:49       ` Gabriel Peters
2008-07-30 18:05         ` Bernt Hansen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).