[rkward-devel] import/export CSV

meik michalke meik.michalke at uni-duesseldorf.de
Mon Dec 1 11:14:19 UTC 2014


hi,

Am Montag, 1. Dezember 2014, 11:12:48 schrieb Thomas Friedrichsmeier:
> See my last mail. I think defaulting to CSV (_not_ CVS2!) would be sensible.

ok, i'm all for it.

> Assorted comments:
> - Why is the "append" option controlled by the predefined format?

you just wrote it yourself:

> "append, col.names, sep, dec and qmethod cannot be altered."
  ^^^^^^^^

;-)

that option and the column names are the deactivated settings i was referring 
to, for write.csv() and write.csv2(). they are not all on the same tab -- i 
tried to make the dialog as similar to the import plugin as possible, but 
there are quite some differences.

> - Uncommenting arguments, that do not apply, is a nifty idea, but does come
> with some drawbacks:
>   - Bloats the generated code
>   - Seems to suggest that these _could_ be customized for write.csv(2).
> However, the R help says: "append, col.names, sep, dec and qmethod cannot be
> altered." I'd suggest stripping these.

sure, this is only an idea. but let me explain how it came to this: firstly, i 
was thinking about people who want to learn R; there should also appear an 
explaining comment above the write.csv() call explaining that the commented 
options cannot be changed here (btw, if you try, write.csv() throws a warning 
saying the same). secondly, the commented options show the value that they're 
set to internally; for instance, "col.names" depends on the setting of 
"row.names".

@aaron: what do you think would be most useful? the generated code currently 
reads:

  # some options can't be changed with write.csv()
  # they have been commented out to show the values they are set to
  write.csv(
    x=,
    file="",
    #append=FALSE,
    #sep=",",
    eol="\n",
    na="NA",
    #dec=".",
    row.names=TRUE,
    #col.names=NA,
    #qmethod="double",
    fileEncoding=""
  )

the stripped alternative would be:

  write.csv(
    x=,
    file="",
    eol="\n",
    na="NA",
    row.names=TRUE,
    fileEncoding=""
  )

the R code currently also includes all defaults. if we want to strip it down 
to the absolutely necessary arguments only, it would result in just this:

  write.csv(
    x=,
    file=""
  )

> - Remove the "data.frame"-warning (see my last mail).

with pleasure.

> - For encoding specification, import_spss and import_stata share some code
> (currently in the form of a <snippet>. It might make sense to turn this into
> an embeddable plugin, and use it.

i actually included that snipped first, but it added another full tab and had 
a checkbox for "converting strings" which i didn't find the best wording here. 
so i copied the dropdown menu -- and added the checked "(default)" option, 
since write.table() defaults to 'fileEncoding=""'.

having something to embed would be great, but i still didn't really get how to 
write an embeddable plugin ;-)


viele grüße :: m.eik

-- 
  dipl. psych. meik michalke
  institut f"ur experimentelle psychologie
  abt. f"ur diagnostik und differentielle psychologie
  heinrich-heine-universit"at d-40204 d"usseldorf
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/rkward-devel/attachments/20141201/21de286b/attachment.sig>


More information about the Rkward-devel mailing list