Re: [R] Problem Reading SPlus Dump Into R - Spaces Embedded in Data

From: allan miller <amiller_at_a2software.com>
Date: Fri 30 Dec 2005 - 18:29:32 EST

Peter Dalgaard wrote:

>allan miller <amiller@a2software.com> writes:
>
>
>
>>Hello,
>>
>>I'm trying to source() an SPlus 6.x file created using dump(...,
>>oldStyle=T) into R (version 2.01) as using the following instructions:
>>
>>
>>
>>>*If you have access to S-PLUS, it is usually more reliable to |dump|
>>>the object(s) in S-PLUS and |source| the dumpfile in R. For S-PLUS 5.x
>>>and 6.x you may need to use |dump(..., oldStyle=T)|, and to read in
>>>very large objects it may be preferable to use the dumpfile as a batch
>>>script rather than use the |source| function.*
>>>
>>>
>>(from "R Data Import/Export," pg. 15)
>>
>>An example:
>>
>> > source("testdump")
>>Error in parse(file, n, text, prompt) : syntax error on line 1895
>>
>>where the data on line 1895 - and other lines causing this - have
>>embedded spaces, such as the following:
>>
>>
>>[line 1895] Johnson Partners LLC
>>
>>
>>I can't seem to find any options for either the SPlus dump, or R
>>source(), that relate to this problem. Any suggestions for how to
>>either dump or source files containing data with embedded spaces?
>>
>>
>
>A bit more context might be helpful. What's in lines surrounding 1895?
>Can you show a simple S-PLUS object displaying the behaviour? What
>happens if you dput() the object? Will S-PLUS itself restore the file?
>
>
>
Unfortunately, I don't have access to S-PLUS :'( , the S-PLUS file dump was provided to me to load in R. Here are the lines in the S-PLUS dump surrounding 1895:

> 1892 .Label
> 1893 character
> 1894 1
> 1895 Johnson Partners LLC
> 1896 class
> 1897 character
> 1898 1
> 1899 factor
> 1900 Protocol

The problem is with the embedded spaces (whitespace?) characters in 1895. If I remove the spaces, i.e., change it to:

JohnsonPartnersLLC

the line is successfully loaded, and the next error that comes up is another Label with embedded spaces.

Thanks for your help.

        [[alternative HTML version deleted]]



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Fri Dec 30 18:36:13 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:41:44 EST