One more question concerning the variable transfer of tables:
,----
| (let ((file (orgtbl-to-tsv value '(:fmt org-babel-R-quote-tsv-field)))
| (header (if (or (eq (nth 1 value) 'hline) colnames-p)
| "TRUE" "FALSE"))
| (row-names (if rownames-p "1" "NULL")))
| (if (= max min)
| (format "%s <- local({
| con <- textConnection(
| %S
| )
| res <- read.table(
| con,
| header = %s,
| row.names = %s,
| sep = \"\\t\",
| as.is = TRUE
| )
| close(con)
| res
| })" name file header row-names)
| (format "%s <- local({
| con <- textConnection(
| %S
| )
| res <- read.table(
| con,
| header = %s,
| row.names = %s,
| sep = \"\\t\",
| as.is = TRUE,
| fill = TRUE,
| col.names = paste(\"V\", seq_len(%d), sep =\"\")
| )
| close(con)
| res
| })" name file header row-names max))))
`----
It seems that the two variable transfer routines only differ slightly:
1. routine: =header= is present (TRUE) and defined in table when passed
as =colnames= while
2. routine: =header= is not present (FALSE) and =colnames= is generated
as V1 .. Vn
This generation is actually not needed as this is the R default value
which is used when =colnames= is not supplied.
Also: I do not undestand why the argument =fill= is TRUE in the second
routine. From R:
,----
| fill: logical. If ‘TRUE’ then in case the rows have unequal length,
| blank fields are implicitly added. See ‘Details’.
`----
If I understands tables in org correctly, this is not needed as the rows
always have equal length?
so if I am not mistaken the following lines could be deleted:
,----
| row.names = %s,
| sep = \"\\t\",
| as.is = TRUE,
| - fill = TRUE,
| - col.names = paste(\"V\", seq_len(%d), sep =\"\")
`----
Or am I missing something here?