[R] Memory allocation failed: Copying Node

2008-06-25 Thread ppatel3026
Following code bugs with "Memory allocation failed: Copying Node" error after parsing n thousand files. I have included the main code(below) and functions(after the main code). I am not sure which lines are causing the copying Node which results in memory failure. Please advise. #Beginning

[R] Pattern Matching Replacement

2008-06-19 Thread ppatel3026
I would like to replace "\r\n" with "" in a character string, where "\r\n" exists only between < and >, how could I do that? Initial: characterString = "\r\n" Result: characterString = "\r\n" Tried with sub(below) but it only replaces the first instance and I am not sure how to pattern match s

[R] try catch block

2008-06-17 Thread ppatel3026
How can I use the try catch block such that if this statement fails xml <- xmlTreeParse(xmlTxt, useInternal=TRUE) then this statement is executed xml <- xmlMalFormed() ? This code does not work but assuming its somewhere along these lines: tryCatch(xml <- xmlTreeParse(xmlTxt, useInternal=TRU

[R] Error

2008-06-17 Thread ppatel3026
My code seems to break out with error below for every 1000 files it processes. Then I re-run from the last file where it errored out and it runs without any bugs. Any ideas what might cause error below? Error in match(x, table, nomatch = 0) : formal argument "nomatch" matched by multiple act

[R] Scan document including "\n"

2008-06-17 Thread ppatel3026
How do you read in a whole file while preserving end of line "\n" characters? Basically, read in a whole file as one string. Ex: After this file is read into a variable, it should really look like "\n\n\n\n" -- View this message in context: http://www.nabble.com/Scan-document-including-

[R] Parse XML

2008-06-10 Thread ppatel3026
Could someone provide a link or examples of parsing XML document in R? Few specific questions below: For instance I can retrieve specific nodes using this: node <- xpathApply(xml, "//" %+% xtag, xmlValue) 1) I want to be able to retrieve parent node for this node, how can I do this? getParentN