[R] How to pass a character string with a hyphen

Jeff Reichman re|chm@nj @end|ng |rom @bcg|ob@|@net
Tue Nov 17 22:13:44 CET 2020


Boris

Yes in that case it works as you have assigned a character string to key. My
problem is I'm taking a string input from a shiny app and when I run the
function it only sees xxxx.  How to assign xxxx-yyyy to a character string.

Jeff
-----Original Message-----
From: Boris Steipe <boris.steipe using utoronto.ca> 
Sent: Tuesday, November 17, 2020 3:00 PM
To: reichmanj using sbcglobal.net
Cc: r-help using r-project.org
Subject: Re: [R] How to pass a character string with a hyphen

tmp <- function(s) {
  return(str(s))
}
key <- "xxxx-yyyy"
tmp(key)

#  chr "xxxx-yyyy"

.. works for me.

Reprex?

Cheers,
Boris



More information about the R-help mailing list