emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* left aligned changes to right alignment in table after adding one row - possible bug?
@ 2014-10-13 10:43 Rainer M Krug
  2014-10-13 16:55 ` Charles Berry
  0 siblings, 1 reply; 2+ messages in thread
From: Rainer M Krug @ 2014-10-13 10:43 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 3869 bytes --]


#+PROPERTY: header-args :exports both

* Changing alignment when one row is added
Despite of all values are strings, the alignment changes in the below
example. Is this a bug or am I missing something?

Thanks,

Rainer

** Here it works
The column pm and pb are left aligned as expected for strings (correct?).

#+begin_src R :colnames yes :rownames yes 
x <- structure(c("-1.358", "-1.957", "-1.752", "-1.773", "-1.886", 
"-1.948", "-1.754", "-1.730", "-1.859", "-1.900", "4.757", "5.708", 
"5.419", "5.408", "5.493", "5.581", "5.250", "5.193", "5.329", 
"5.396", "", "*0.000 *** *", "*0.034 **", "0.411", "*0.002 ***", 
"0.376", "0.055 .", "0.134", "*0.012 **", "0.243", "", "*0.000 *** *", 
"0.072 .", "0.833", "0.228", "0.549", "0.061 .", "0.756", "0.128", 
"0.916", "", "*0.000 *** *", "*0.048 **", "0.938", "0.389", "0.640", 
"*0.044 **", "0.598", "0.217", "0.941"), .Dim = c(10L, 5L), .Dimnames = list(
    c("Quercus robur - single", "Quercus robur - 95", "Quercus robur - 90", 
    "Quercus robur - 85", "Quercus robur - 80", "Quercus robur - 75", 
    "Quercus robur - 70", "Quercus robur - 65", "Quercus robur - 60", 
    "Quercus robur - 55"), c("slope", "intercept", "p", "pm", 
    "pb")))

head(x, 5)
#+end_src

#+RESULTS:
|                        |  slope | intercept | p            | pm           | pb           |
|------------------------+--------+-----------+--------------+--------------+--------------|
| Quercus robur - single | -1.358 |     4.757 |              |              |              |
| Quercus robur - 95     | -1.957 |     5.708 | *0.000 *** * | *0.000 *** * | *0.000 *** * |
| Quercus robur - 90     | -1.752 |     5.419 | *0.034 **    | 0.072 .      | *0.048 **    |
| Quercus robur - 85     | -1.773 |     5.408 | 0.411        | 0.833        | 0.938        |
| Quercus robur - 80     | -1.886 |     5.493 | *0.002 ***   | 0.228        | 0.389        |

** Here it doesn't
By adding row 6, pm and pb become right aligned. This can also be
reproduced by only using columns 5:7 (~x[5:7,]~ instead of ~head(x,6)~).

#+begin_src R :colnames yes :rownames yes 
x <- structure(c("-1.358", "-1.957", "-1.752", "-1.773", "-1.886", 
"-1.948", "-1.754", "-1.730", "-1.859", "-1.900", "4.757", "5.708", 
"5.419", "5.408", "5.493", "5.581", "5.250", "5.193", "5.329", 
"5.396", "", "*0.000 *** *", "*0.034 **", "0.411", "*0.002 ***", 
"0.376", "0.055 .", "0.134", "*0.012 **", "0.243", "", "*0.000 *** *", 
"0.072 .", "0.833", "0.228", "0.549", "0.061 .", "0.756", "0.128", 
"0.916", "", "*0.000 *** *", "*0.048 **", "0.938", "0.389", "0.640", 
"*0.044 **", "0.598", "0.217", "0.941"), .Dim = c(10L, 5L), .Dimnames = list(
    c("Quercus robur - single", "Quercus robur - 95", "Quercus robur - 90", 
    "Quercus robur - 85", "Quercus robur - 80", "Quercus robur - 75", 
    "Quercus robur - 70", "Quercus robur - 65", "Quercus robur - 60", 
    "Quercus robur - 55"), c("slope", "intercept", "p", "pm", 
    "pb")))

head(x, 6)
#+end_src

#+RESULTS:
|                        |  slope | intercept | p            |           pm |           pb |
|------------------------+--------+-----------+--------------+--------------+--------------|
| Quercus robur - single | -1.358 |     4.757 |              |              |              |
| Quercus robur - 95     | -1.957 |     5.708 | *0.000 *** * | *0.000 *** * | *0.000 *** * |
| Quercus robur - 90     | -1.752 |     5.419 | *0.034 **    |      0.072 . |    *0.048 ** |
| Quercus robur - 85     | -1.773 |     5.408 | 0.411        |        0.833 |        0.938 |
| Quercus robur - 80     | -1.886 |     5.493 | *0.002 ***   |        0.228 |        0.389 |
| Quercus robur - 75     | -1.948 |     5.581 | 0.376        |        0.549 |         0.64 |




-- 
Rainer M. Krug
email: Rainer<at>krugs<dot>de
PGP: 0x0F52F982

[-- Attachment #2: Type: application/pgp-signature, Size: 494 bytes --]

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

* Re: left aligned changes to right alignment in table after adding one row - possible bug?
  2014-10-13 10:43 left aligned changes to right alignment in table after adding one row - possible bug? Rainer M Krug
@ 2014-10-13 16:55 ` Charles Berry
  0 siblings, 0 replies; 2+ messages in thread
From: Charles Berry @ 2014-10-13 16:55 UTC (permalink / raw)
  To: emacs-orgmode

Rainer M Krug <Rainer <at> krugs.de> writes:

> 
> 
> #+PROPERTY: header-args :exports both
> 
> * Changing alignment when one row is added
> Despite of all values are strings, the alignment changes in the below
> example. Is this a bug or am I missing something?
> 

One of these two maybe:

,----[ C-h v org-table-number-regexp RET ]
| org-table-number-regexp is a variable defined in `org-table.el'.
| Its value is
| "^\\([<>]?[-+^.0-9]*[0-9][-+^.0-9eEdDx()%:]*\\|[<>]?[-+]?0[xX][0-9a-
| [wrapped] fA-F.]+\\|[<>]?[-+]?[0-9]+#[0-9a-zA-Z.]+\\|nan\\|[-+u]?inf\\)$"
| 
| Documentation:
| Regular expression for recognizing numbers in table columns.
| If a table column contains mostly numbers, it will be aligned to the
| right.  If not, it will be aligned to the left.
| 
| The default value of this option is a regular expression which allows
| anything which looks remotely like a number as used in scientific
| context.  For example, all of the following will be considered a
| number:
|     12    12.2    2.4e-08    2x10^12    4.034+-0.02    2.7(10)  >3.5
| 
| Other options offered by the customize interface are more restrictive.
| 
| You can customize this variable.
| 
| [back]
`----



,----[ C-h v org-table-number-fraction RET ]
| org-table-number-fraction is a variable defined in `org-table.el'.
| Its value is 0.5
| 
| Documentation:
| Fraction of numbers in a column required to make the column align right.
| In a column all non-white fields are considered.  If at least
| this fraction of fields is matched by `org-table-number-regexp',
| alignment to the right border applies.
| 
| You can customize this variable.
| 
| [back]
`----


With the added row, the fraction is exceeded in the last two columns.


HTH,

Chuck

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

end of thread, other threads:[~2014-10-13 16:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-13 10:43 left aligned changes to right alignment in table after adding one row - possible bug? Rainer M Krug
2014-10-13 16:55 ` Charles Berry

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).