Skip to content
Prev 388005 / 398502 Next

Create a function problem

On Sat, 15 May 2021 00:55:08 +0000 (UTC)
Kai Yang <yangkai9999 at yahoo.com> wrote:

            
Then I suggest that you spend some time learning basic R syntax, with
the help of some of the excellent online tutorials.  "An Introduction
to R" from https://cran.r-project.org/manuals.html would be a good
place to start.
In this case something along the lines of the following *might*
work:

xxx <- with(raw,k_subset(<some arguments>))

but you would have to rewrite the function k_subset() so that its
argument list actually makes sense.
I'm not actually very good at this sort of thing, but a quick web
search tells me that there are existing ways to do this, using tools
from the tidyr package.  Apparently there are also tools for this sort
of thing in the dplyr package.  Since the function select() that you
invoke is from the dplyr package (and you really should have mentioned
this rather than expecting your readers to be psychic) using dplyr tools
might be the best way for you to go.
As I said, this sort of thing is not my fort?, so I cannot help you
further.  If you want others on the list to help you then you should
provide an example data set ("raw" or some version thereof).  Use
dput() to provide the data in your posting.

*DO NOT* post in html!!!

cheers,

Rolf