В Mon, 18 Dec 2023 09:56:16 +0000
Emily Bakker <emilybak...@outlook.com> пишет:

> When i try to run the function definiton, the command never
> "completes" in de console.

How do you run the function definition? I copied and pasted your
example into a character variable and gave it to parse(text = ...). It
parsed successfully.

Splitting the function into multiple smaller functions is the usual
advice. It should help here too. When you decompose a large function
into a set of smaller functions, it becomes easier to reason about them
and test them individually. (It is also possible to have too many small
functions; it is important to find a balanced solution.)

If you find yourself making a decision based on a fixed set of strings,
consider switch() and match.arg(). If a set of possible values for a
factor is limited to true / false / don't know, it may help to switch
to R's native TRUE / FALSE / NA_logical_ values instead of strings
(which may contain typos).

-- 
Best regards,
Ivan

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to