On 5/20/2008 12:58 PM, Applejus wrote:
Hello,

I have an expression "a" in R that has about 2300 characters and I want to
convert it to a string using toString or as.character. The problem is I am
only getting the first 500 or so characters when I convert it to string. I
tried to use substring in order to convert one bunch at a time, but when I
type substring(a, 498, 1000) I get only 2 characters, meaning it seems there
is a limit of 500 characters at most, even for the substring function.

When you deparse a long expression, it comes back as a multi-element character vector. as.character() only returns the first element. You can get all of them by calling deparse() directly, and then perhaps you'll want to paste them together.

I'm not sure if this is a bug in as.character, or just an undocumented limitation.


The weird part is that the conversion with as.character works fine with
Splus, but not in R.

I wouldn't call it "weird"; there are lots of differences between the two programs. They have been developed independently.

Duncan Murdoch


Could anyone help me out? Is there a string buffer function like that of
java? Should I change something in the console configuration? (I tried to
increase the buffer but it still doesn't work)
Thanks!

______________________________________________
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.

Reply via email to