[Rd] reshape documentation
deep@y@n@@@rk@r @end|ng |rom gm@||@com
Sun Apr 11 12:00:55 CEST 2021
On Wed, Mar 17, 2021 at 7:55 PM Michael Dewey <lists using dewey.myzen.co.uk> wrote:
> Comments in line
> On 13/03/2021 09:50, SOEIRO Thomas wrote:
> > Dear list,
> > I have some questions/suggestions about reshape.
> > 1) I think a good amount of the popularity of base::reshape alternative is due to the complexity of reshape documentation. It is quite hard (at least it is for me) to figure out what argument is needed for respectively "long to wide" and "wide to long", because reshapeWide and reshapeLong are documented together.
> > - Do you agree with this?
> > - Would you consider a proposal to modify the documentation?
> > - If yes, what approach do you suggest? e.g. split in two pages?
> The current documentation is much clearer than it was when I first
> started using R but we should always strive for more.
> I would suggest leaving the documentation in one place but it might be
> helpful to add which direction is relevant for each parameter by placing
> (to wide) or (to long) as appropriate. I think having completely
> separate lists is not needed
I have just checked in some updates to the documentation (in R-devel)
which hopefully makes usage clearer. Any further suggestions are
welcome. We are planning to add a short vignette as well, hopefully in
time for R 4.1.0.
> > 2) I do not think the documentation indicates that we can use varying argument to rename variables in reshapeWide.
> > - Is this worth documenting?
> > - Is the construct list(c()) really needed?
> Yes, because you may have more than one set of variables which need to
> correspond to a single variable in long format. So in your example if
> you also had 11 variables for the temperature as well as the
> concentration each would need specifying as a separate vector in the list.
That's a valid point, but on the other hand, direction="long" already
supports specifying 'varying' as a vector, and it does simplify the
single variable case. So we decided to be consistent and allow it for
direction="wide" too, hopefully with loud enough warnings in the
documentation about using the feature carelessly.
> > reshape(Indometh,
> > v.names = "conc",
> > idvar = "Subject",
> > timevar = "time",
> > direction = "wide",
> > varying = list(c("conc_0.25hr",
> > "conc_0.5hr",
> > "conc.0.75hr",
> > "conc_1hr",
> > "conc_1.25hr",
> > "conc_2hr",
> > "conc_3hr",
> > "conc_4hr",
> > "conc_5hr",
> > "conc_6hr",
> > "conc_8hr")))
> > Thanks,
> > Thomas
> > ______________________________________________
> > R-devel using r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-devel
> R-devel using r-project.org mailing list
More information about the R-devel