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: +86-15810805877
Homepage: http://www.yihui.name
School of Statistics, Room 1037, Mingde Main Building,
Renmin University of China, Beijing, 100872, China
Thanks!
However,
> f(012345)
[1] "12345"
> f(0123-X)
[1] "-" "123" "X"
>
I hope to get:
"012345"
"0-123-X"
On Sat, Nov 29, 2008 at 10:59 PM, Gabor Grothendieck
<[EMAIL PROTECTED]> wrote:
This works if you type it in from the R console:
s <- readline()
this is my string
s
[1] "this is my string"
Thanks! readline() works for my situation.
Regards,
Jinsong
______________________________________________
R-help@r-project.org mailing list
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.