Wow, you are so lazy... But sometimes R is just designed for lazy guys...
##
f = function(a) {
s = substitute(a)
as.character(s)
}
##
Yihui
Cheers, Yihui, nearly 4 years after your post this still works like a charm.
ps: of course I am not lazy, I simply want to avoid error prone input!
Wow, you are so lazy... But sometimes R is just designed for lazy guys...
##
f = function(a) {
s = substitute(a)
as.character(s)
}
##
f(a = asdf)
[1] "asdf"
f(qwer)
[1] "qwer"
Regards,
Yihui
--
Yihui Xie <[EMAIL PROTECTED]>
Phone: +86-(0)10-82509086 Fax: +86-(0)10-82509086
Mobile:
On Sun, Nov 30, 2008 at 11:38 AM, Carl Witthoft <[EMAIL PROTECTED]> wrote:
> "From: Yihui Xie
> Date: Sun, 30 Nov 2008 15:32:35 +0800
>
> Wow, you are so lazy... But sometimes R is just designed for lazy guys... "
>
>
> Yeah, well, laziness is the mother of creativity :-) .
> But seriously: I kno
"From: Yihui Xie
Date: Sun, 30 Nov 2008 15:32:35 +0800
Wow, you are so lazy... But sometimes R is just designed for lazy guys... "
Yeah, well, laziness is the mother of creativity :-) .
But seriously: I know far too many engineers who plug madly away for
hours/days on end, where I would jus
Wow, you are so lazy... But sometimes R is just designed for lazy guys...
##
f = function(a) {
s = substitute(a)
as.character(s)
}
##
> f(a = asdf)
[1] "asdf"
> f(qwer)
[1] "qwer"
Regards,
Yihui
--
Yihui Xie <[EMAIL PROTECTED]>
Phone: +86-(0)10-82509086 Fax: +86-(0)10-82509086
Mobile: +
This works if you type it in from the R console:
> s <- readline()
this is my string
> s
[1] "this is my string"
On Sat, Nov 29, 2008 at 9:41 AM, Jinsong Zhao <[EMAIL PROTECTED]> wrote:
> Hi there,
>
> I hope to use a string as an input in my function, however, I don't want
> to input the quot
6 matches
Mail list logo