Robert
I ended up using the paste command, its not pretty but it works thank you
Jeff
From: Robert Knight
Sent: Tuesday, November 17, 2020 3:56 PM
To: reichm...@sbcglobal.net
Cc: r-help@r-project.org
Subject: Re: [R] How to pass a character string with a hyphen
Strip the left
Strip the left characters and strip the right characters into their own
variables using one of the methods that can do that. Then pass it using
something like paste(left, "-", right).
On Tue, Nov 17, 2020, 2:43 PM Jeff Reichman wrote:
> R-Help
>
>
>
> How does one pass a character string contai
Hi,
You might want to look at ?shQuote, which wraps text in single quotes, if the
source text does not include them, or double quotes otherwise, as might be used
in a shell setting, where you are passing arguments that may have spaces or
other characters that may be evaluated.
My guess is that
Sent: Tuesday, November 17, 2020 3:00 PM
To: reichm...@sbcglobal.net
Cc: r-help@r-project.org
Subject: Re: [R] How to pass a character string with a hyphen
tmp <- function(s) {
return(str(s))
}
key <- "-"
tmp(key)
# chr "-"
.. works
tmp <- function(s) {
return(str(s))
}
key <- "-"
tmp(key)
# chr "-"
... works for me.
Reprex?
Cheers,
Boris
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do
R-Help
How does one pass a character string containing a hyphen? I have a function
that accesses an api if I hard code the object, for example
key_key <- "-"
it works but when I pass the key code to the function (say something like
key_code <- code_input) it returns only
6 matches
Mail list logo