Re: [R] Assistance converting to R a python function that extracts from an XML file

2014-12-13 Thread Duncan Temple Lang
Hi Don library(XML) readxmldate = function(xmlfile) { doc = xmlParse(xmlfile) xpathSApply(doc, '//Esri/CreaDate | //Esri/CreaTime', xmlValue) } D. On 12/13/14, 12:36 PM, MacQueen, Don wrote: > I would appreciate assistance doing in R what a colleague has done in > python. Unfortunately (f

Re: [R] RStem with portuguese language

2008-07-28 Thread Duncan Temple Lang
/~pcortez +351253510313 Fax:+351253510300 > > __ > 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

Re: [R] RCurl: authentication when posting forms

2008-08-28 Thread Duncan Temple Lang
Hi Valerie Valerie Obenchain wrote: Hi, Has anyone successfully used RCurl for posting data to a password-protected site? Yes. I just set up a sample form to test with and the following all work # Perl script (and HTML form for testing in the browser) taken from # http://www.elated.co

Re: [R] RCurl: authentication when posting forms

2008-08-28 Thread Duncan Temple Lang
header = lines[-1] > header <- read.dcf(textConnection(header)) > } > else { > els <- sapply(lines, function(x) strsplit(x, ":[ ]*")) > header <- lapply(els, function(x) x[2]) > names(header) <- sapply(els, function(x) x[1]) &g

Re: [R] RGoogleDocs: getDocs() - "problems connecting to get the list of documents"

2009-08-14 Thread Duncan Temple Lang
Hi Matthew You mentioned in mail direclty to me that this code worked earlier in your morning. So that suggests that it is not the code. But you should look carefully at the 2 lines you ran (i.e. the ones below) and painstakingly check that the user name and password are the same. It is easy to o

Re: [R] Rcompression on Omegahat

2009-08-18 Thread Duncan Temple Lang
Hi Stanley Yes, I install it on my macs and need it as part of working with .docx, .xlsx files and downloading content via RCurl. So it gets some exercise and does work on Intel Macs. (Although my systems are always non-standard!) You will have to give us more information about what the pro

Re: [R] RGoogleDocs/RCurl through proxy

2009-08-18 Thread Duncan Temple Lang
This might be a little difficult in the current version. But it is a good point. I have a few ideas about this could be done conveniently but with a reasonably clear semantic model. It may take a couple of days before I have time to implement that. D. Remko Duursma wrote: Dear list, I am t

Re: [R] RGoogleDocs/RCurl through proxy

2009-08-19 Thread Duncan Temple Lang
Hi Remko There is a new version (1.1-0) of the RCurl package (on which RGoogleDocs depends) (no binary for Windows at this point). This version allows one to specify default curl options that are used each time a new curl handle/object is created. You set these defaults in R's own options()

Re: [R] RCurl and Google Scholar's EndNote references

2009-09-17 Thread Duncan Temple Lang
Hi Jarno You've only told us half the story. You didn't show how you i) performed the original query ii) retrieved the URL you used in subsequent queries But I can suggest two possible problems. a) specifying the cookiejar option tells libcurl where to write the cookies that the particular

Re: [R] Writing Reports from R in Microsoft Office Open XML format (follow-up)

2009-09-18 Thread Duncan Temple Lang
to support the XML format of Microsoft > Word?) > > Kind regards, > Tobias > > > On Tue, Jun 9, 2009 at 4:22 PM, Duncan Temple Lang > wrote: >> Yes. We will release a version in the next few weeks >> when I have time to wrap it all up. >> There is a

Re: [R] Writing Reports from R in Microsoft Office Open XML format (follow-up)

2009-09-18 Thread Duncan Temple Lang
I believe that their approach is based on DCOM and the post was about Office Open XML. We have had the ability to do this via DCOM for at least 6 years, but unfortunately DCOM is limited to Windows. Greg Snow wrote: > The people who brought us rexcel are working on sword which is a sweave for

Re: [R] Amazon SimpleDB and R

2009-09-20 Thread Duncan Temple Lang
Hi Tim Since we have a package to interface to Amazon's S3 storage system (http://www.omegahat.org/RAmazonS3), I put together an RAmazonDBREST package that uses the REST interface. It is available at http://www.omegahat.org/RAmazonDBREST/ and installable from source via install.packages("RA

Re: [R] write.zip?

2010-02-10 Thread Duncan Temple Lang
Hi Spencer I just put a new source version (0.9-0) of the Rcompression package on the www.omegahat.org/R repository and it has a new function zip() that creates or appends to a zip file, allowing one to provide alternative names. I'll add support for writing content from memory (i.e. AsIs char

Re: [R] help with EXPASY HTML form submission in RCurl package

2010-02-12 Thread Duncan Temple Lang
Sunando Roy wrote: > Hi, > > I am trying to submit a form to the EXPASY protscale server ( > http://www.expasy.ch/tools/protscale.html). I am using the RCurl package and > the postForm function available in it. I have extracted the variables for > the form from the HTML source page. According to

Re: [R] help with EXPASY HTML form submission in RCurl package

2010-02-13 Thread Duncan Temple Lang
your_age = "35-55", > your_sex = "m", > submit = "submit", > .opts = list(userpwd = "bob:welcome")) > > which would suggest atleast the setup is correct. > I parsed the expasy protscale source c

Re: [R] Working with combinations

2010-03-02 Thread Duncan Temple Lang
I think there are several packages that implement combinations and several that allow you to specify a function to be called when each vector of combinations is generated. I can't recall the names of all such packages, but the Combinations package on www.omegahat.org/Combinations is one. D.

Re: [R] Making FTP operations with R

2010-03-08 Thread Duncan Temple Lang
R does provide support for basic FTP requests. Not for DELETE requests. And not for communication on the same connection. I think your best approach is to use the RCurl package (http://www.omegahat.org/RCurl). D. Orvalho Augusto wrote: > Dears I need to make some very basic FTP operations wit

Re: [R] parse an HTML page with verbose error message (using XML)

2010-03-11 Thread Duncan Temple Lang
Hi Yihui It took me a moment to see the error message as the latest development version of the XML package suppresses/hides them by default for htmlParse(). You can provide your own function via the error parameter. If you just want to see more detailed error messages on the console you can us

Re: [R] Do colClasses in readHTMLTable (XML Package) work?

2010-03-20 Thread Duncan Temple Lang
On 3/17/10 6:52 PM, Marshall Feldman wrote: > Hi, > > I can't get the colClasses option to work in the readHTMLTable function > of the XML package. Here's a code fragment: > > require("XML") > doc <- "http://www.nber.org/cycles/cyclesmain.html"; > table <- getNodeSet(htmlParse(doc

Re: [R] exportation of xml file from R

2009-06-25 Thread Duncan Temple Lang
Hi Guillaume Once you have created an XML representation using any of the various ways to represent XML in R via the XML package (e.g. internal nodes, lists of lists, hash trees), you can use the saveXML() function: saveXML(myXML, "fileName.xml") Personally, I use newXMLNode() and friend

Re: [R] exportation of xml file from R

2009-06-25 Thread Duncan Temple Lang
BTW, the XML you show is not legal XML. For instance, the element F)>NAF)> is not a legal XML element name. Similarly is not a legal name since it is "2". And anova:2 means an element with name 2 with (XML) name space prefix "anova" (which must be declared previously) As Gabor mentioned

Re: [R] wordStem problems in R 2.9, Fedora 11; Linux Kernel 2.6.29.5-191.fc11.i586

2009-07-07 Thread Duncan Temple Lang
Hi Rene Can you tell us the version of the Rstem package you installed. Rstem_0.3-1 from http://www.omegahat.org/Rstem/ or install.packages("Rstem", repos = "http://www.omegahat.org/R";) work fine for me. I seem to recall this being a problem with an older version of Rstem.

Re: [R] Import xlsx file in Ubuntu 9.04

2009-07-08 Thread Duncan Temple Lang
I did some preliminary work on xslx (and docx and pptx) files some time ago and will hopefully finish things off by the end of summer. We can read these with a combination of the Rcompression and XML package. I have put versions of two packages (ROOXML and RExcelXML) at http://www.omegahat.o

Re: [R] Getting value rather than formula in RGoogleDocs

2009-07-08 Thread Duncan Temple Lang
Farrel Buchinsky wrote: Is there an easy way to read the value of the cells rather than the formula?So for instance in a cell whose value was created by simply using the value from the cell immediately to the left in the Google spreadsheet I would prefer to get the value rather than =RC[-1] W

Re: [R] Reading from Google Docs

2009-07-08 Thread Duncan Temple Lang
Farrel Buchinsky wrote: > Boy oh boy that process of getting source to binary was super painful. Now that I have the package as binary I can share the whole folder with my coworker and she is able to use RGoogleDocs. I intend to use the same process for the other two windows machines

Re: [R] Reading from Google Docs

2009-07-09 Thread Duncan Temple Lang
lled. Farrel Buchinsky Google Voice Tel: (412) 567-7870 On Wed, Jul 8, 2009 at 22:53, Duncan Temple Lang mailto:dun...@wald.ucdavis.edu>> wrote: Farrel Buchinsky wrote: > Boy oh boy that process of getting source to binary was super painful.

Re: [R] (simple) xml into data.frame and reverse

2009-07-14 Thread Duncan Temple Lang
stefan.d...@gmail.com wrote: Hello, I am trying to convert a simple data.frame (it will always be a few equally long variables) into the XML format (which I don't understand too well but need as input for another program) and reverse the operation (from XML back into data.frame). I found some

Re: [R] (simple) xml into data.frame and reverse

2009-07-15 Thread Duncan Temple Lang
Thanks Dieter. It should have been http://www.omegahat.org/RSXML/xmlToDataFrame.R as it is an R file. Thanks D. Dieter Menne wrote: Duncan Temple Lang wrote: I wrote some relatively general functions, but hastily written functions to read this sort of data. You can find them

Re: [R] Downloading data from from internet

2009-09-24 Thread Duncan Temple Lang
Thanks for explaining this, Charlie. Just for completeness and to make things a little easier, the XML package has a function named readHTMLTable() and you can call it with a URL and it will attempt to read all the tables in the page. tbls = readHTMLTable('http://www.rateinflation.com/consumer

Re: [R] Downloading data from from internet

2009-09-25 Thread Duncan Temple Lang
s package is an approach to the poor-man's Web services - HTML forms- rather than REST and SOAP that are becoming more relevant each day. The RCurl and SSOAP address the latter. D. > Thanks > > > Duncan Temple Lang wrote: >> >> Thanks for explaining this, Charl

Re: [R] Downloading data from from internet

2009-09-26 Thread Duncan Temple Lang
erating systems and to create binaries. Running Windows and not being able to install R packages from source is a choice, not a technical limitation. D. > > Thanks, > > > > Duncan Temple Lang wrote: >> >> >> Bogaso wrote: >>> Thank you so much fo

Re: [R] R and REST API's

2009-09-28 Thread Duncan Temple Lang
Hi Gary, Greg, et al. In addition to making some things slightly simpler, the RCurl package also provides some necessary lower-level control over the HTTP requests. Firstly, it can handle HTTPS. Secondly, numerous REST applications will require more information in the header of the HTTP request,

Re: [R] Compress (gzip) a pdf device - [ ] Message is from an unknown sender

2009-10-01 Thread Duncan Temple Lang
The latest version of the Rcompression package (www.omegahat.org/Rcompression) provides a gzip() function that does this. The example in the help page shows how. There is a source version of the package in the Omegahat repository (and on the package's Web site), but no binaries at this point.

Re: [R] odfWeave & XML error in post-processing

2009-10-09 Thread Duncan Temple Lang
Hi Rob. Without the file content_1.xml or any information from the R call stack (e.g. options(error = recover) and then run the command and dynamically explore the state of affairs when the error occurs), there is no way for us to know what the problem might be. Somehow, the XML parser appears t

Re: [R] Removing Embedded Null characters from text/html

2009-10-16 Thread Duncan Temple Lang
[David contacted me directly, so I am sending my off-line reply to the list just for the record in case others encounter a simple problem.] Hi David. No problem contacting me at all. I saw your mail at one point on the mailing list, but didn't have a chance to respond. Indeed, it seems like th

Re: [R] How to make XML support Expat?

2009-10-24 Thread Duncan Temple Lang
Hi Joh. What particular aspects of expat do you want that libxml2 and the XML package currently cannot provide? The early versions of the XML package (for the first few years) could support expat and libxml2 as the C++/C-level parsers. However, the support for expat was not maintained, so while

Re: [R] How to make XML support Expat?

2009-10-24 Thread Duncan Temple Lang
doesn't have a full XPath implementation by itself, AFAIK. So basically, I wouldn't prematurely worry about speed. If you have a test case, you can profile the code and see where the bottlenecks are. D. > > Thanks, Joh > > On Saturday 24 October 2009 20:38:23 Duncan Temp

Re: [R] How to make XML support Expat?

2009-10-24 Thread Duncan Temple Lang
the files you are working with? Suprisingly, reading 70Mb files into memory and doing XPath can be quite fast. D. > > Thanks, Joh > > On Saturday 24 October 2009 23:31:46 Duncan Temple Lang wrote: >> Johannes Graumann wrote: >>> Hi, >>> >>> I had heard that E

Re: [R] How to express a tree?

2009-10-27 Thread Duncan Temple Lang
Jim Lemon wrote: > On 10/28/2009 04:06 AM, Hesen Peng wrote: >> Hello everybody, >> >> I'm write a function whose output represents a tree. Can anyone please >> recommend me some data structure in R which are good for expressing a >> tree? The possible idea I'm having in my mind is to represent t

Re: [R] Error installing RSPerl.

2009-10-29 Thread Duncan Temple Lang
Hi Grainne There is one likely cause. But before getting into the explanation, can you send me the output from when you installed the package, e.g. the output from R CMD INSTALL RSPerl and any configuration arguments you specified. You can send this to me off-list and we can summarize a

Re: [R] help with SSOAP (can't find working examples)

2009-11-03 Thread Duncan Temple Lang
Hi Steffen et al. The development version of SSOAP and XMLSchema I have on my machine does complete the processWSDL() call without errors. I have to finish off some tests before releasing these. It may take a few days before I have time to work on this, but hopefully soon. Thanks for the info.

Re: [R] XML: Reading transition matrices into R

2009-11-12 Thread Duncan Temple Lang
stefan.d...@gmail.com wrote: > Hello, > from a software I have the following output in xml (see below): > It is a series of matrices, for each age one. I have 3 categories > (might vary in the application), hence, 3x3 matrices where each > element gives the probability of transition from i to j.

Re: [R] XML: Reading transition matrices into R

2009-11-12 Thread Duncan Temple Lang
}) top = newXMLNode("transitionmatrix", .children = trans) saveXML(top, "newTransition.xml") > > Best, > Stefan > > > On Thu, Nov 12, 2009 at 3:17 PM, Duncan Temple Lang > wrote: >> >> stefan.d...@gmail.com wrote: >>> Hel

Re: [R] problem post request with RCurl

2009-11-18 Thread Duncan Temple Lang
Use curlPerform(url = 'http://pubchem.ncbi.nlm.nih.gov/pug/pug.cgi', postfields = q) That gives me: 31406321645402938 Rajarshi Guha wrote: >

Re: [R] XML package example code?

2009-11-25 Thread Duncan Temple Lang
Peng Yu wrote: > On Wed, Nov 25, 2009 at 12:19 AM, cls59 wrote: >> >> Peng Yu wrote: >>> I'm interested in parsing an html page. I should use XML, right? Could >>> you somebody show me some example code? Is there a tutorial for this >>> package? >>> >> Did you try looking through the help pages

Re: [R] How to suppress errors generated by readHTMLTable?

2009-11-26 Thread Duncan Temple Lang
Just this morning, I made suppressing these parser messages the default behavior for htmlParse() and that will apply to readHTMLTable() also. Until I release that (along with another potentially non-backward compatible change regarding character encoding), you can use readHTMLTable(htmlParse("i

Re: [R] Build of XML package failed

2009-11-27 Thread Duncan Temple Lang
Hi Luis. You can change the two lines PROBLEM buf WARN; to the one line warning(buf); That should compile. If not, please show us the compilation command for DocParse.c, i.e. all the arguments to the compiler, just above the error messages. D. Luis Tito de Morais wrote: > Hi list,

Re: [R] Reading from Google Docs

2009-11-28 Thread Duncan Temple Lang
rel Buchinsky wrote: >> >>> That was painless. I had already installed Rtools and had already put it >>> on my path. >>> >>> Your line worked very well. [Thanks for telling me. However I did it last >>> time was worse than sticking daggers in my eyes.

Re: [R] Scraping a web page

2009-12-03 Thread Duncan Temple Lang
Hi Michael If you just want all of the text that is displayed in the HTML docment, then you might use an XPath expression to get all the text() nodes and get their value. An example is doc = htmlParse("http://www.omegahat.org/";) txt = xpathSApply(doc, "//body//text()", xmlValue) The resul

Re: [R] Have you used RGoogleDocs and RGoogleData?

2009-12-11 Thread Duncan Temple Lang
Hi Farrel I have taken a look at the problems using RGoogleDocs to read spreadsheets and was able to reproduce the problem I believe you were having. A few minor, but important, changes and I can read spreadsheets again and apparently still other types of documents. I have put an updated versio

Re: [R] Have you used RGoogleDocs and RGoogleData?

2009-12-12 Thread Duncan Temple Lang
cally, recognizing the type of a document, e.g. a spreadsheet or word processing document or generic document. The changes made the detection more robust or more consistent with any changes at Google. D. > Farrel Buchinsky > Google Voice Tel: (412) 567-7870 > > > > On Fri, D

Re: [R] RSPerl and Statistics::R

2009-05-07 Thread Duncan Temple Lang
RSPerl is not abandonded, but I haven't had much time to work on it. If you can send me an example to reproduce the race condition, we can probably think about a solution. D. Daniel Klein wrote: Greetings! Being a Perl hacker for some time, and wanting to leverage what R provides, I've be

Re: [R] RGoogleDocs

2009-05-08 Thread Duncan Temple Lang
Robert Schneider wrote: Hi there, I'm not certain if this is the correct list where to post this question, or if it ought to be on the R developper one... I am trying to use the RGoogleDocs package to import into R the spreadsheets on my Google docs account. I downloaded the latest package (0.

Re: [R] import HTML tables

2009-05-13 Thread Duncan Temple Lang
Dieter Menne wrote: Dimitri Szerman-2 wrote: Hello, I was wondering if there is a function in R that imports tables directly from a HTML document. The XML package can do this: http://markmail.org/message/cyicoa3htme4gei2 Duncan Temple Lang: The htmlParse() and htmlTreeParse() functions

Re: [R] RGoogleDocs: can now see documents but cannot get content.

2009-05-20 Thread Duncan Temple Lang
package, Duncan Temple Lang posted an update. I have installed it and now can list my spreadsheets but alas I cannot read the data within any of them. Has anybody been able to get it to work. I would love to see a real live example of sheetAsMatrix I am not sure how to specify sheet and con = sh

Re: [R] Example for parsing XML file?

2009-05-20 Thread Duncan Temple Lang
Hi Brigid. Here are a few commands that should do what you want: bri = xmlParse("myDataFile.xml") tmp = t(xmlSApply(xmlRoot(bri), xmlAttrs))[, -1] dd = as.data.frame(tmp, stringsAsFactors = FALSE, row.names = 1:nrow(tmp)) And then you can convert the columns to whatever ty

Re: [R] XML parse error

2009-05-20 Thread Duncan Temple Lang
Hi Kulwinder There seems to be many points of confusion here You appear to have added new files to the installation of the XML package, i.e. norel.xsd and LogCallSummary.bin into examplData. They are not part of the regular XML package installation. Because these are not part of the XML insta

Re: [R] Example for parsing XML file?

2009-05-21 Thread Duncan Temple Lang
actually row numbers where specific events occurred. Thanks again for all the help! -Brigid On Wed, May 20, 2009 at 5:16 PM, Duncan Temple Lang wrote: Hi Brigid. Here are a few commands that should do what you want: bri = xmlParse("myDataFile.xml") tmp = t(xmlSApply(xmlRoot(br

Re: [R] SSOAP failing

2009-06-03 Thread Duncan Temple Lang
Olivier Cailloux wrote: Dear list, I am trying to use the SSOAP package to access a very simple SOAP service, included as a demonstrator in the axis2 Apache package: "Version" (takes no input parameters and should return a string with the version number). The web service itself seems to be

Re: [R] error installing RCurl in SUSE SLES10-SP2

2009-06-05 Thread Duncan Temple Lang
Hi Robert As Brian Ripley wrote in a message to the list earlier today, you will want a more recent version of libcurl. RCurl can be easily made to check the availability of all the different options to handle old versions of libcurl, but this slows down the installation for everyone. But more

Re: [R] SSOAP failing

2009-06-05 Thread Duncan Temple Lang
Olivier Cailloux wrote: Duncan Temple Lang a écrit : Olivier Cailloux wrote: Dear list, Sorry about that, my e-mail has been sent too soon by mistake (also from an incorrect exp. address). I was planning to add further details. So I'm running Debian Lenny. sessionInfo() giv

Re: [R] Install RCurl in Linux

2009-06-06 Thread Duncan Temple Lang
Hi If you are getting exactly the same errors, then it is probable that your installation of curl-7.19.2 is not taking effect and the configuration script is still finding the older version. So you may want to check the output of curl-config --version in the same shell as you issue R CMD INS

Re: [R] Writing Reports from R in Office Open XML format (ooxmlWeave?)

2009-06-09 Thread Duncan Temple Lang
Yes. We will release a version in the next few weeks when I have time to wrap it all up. There is also a Docbook-based version that uses R extensions to Docbook for authoring structured documents. D. Tobias Sing wrote: Dear all, has someone implemented functionality for writing reports from R

Re: [R] Fast JSON <-> R converter?

2009-06-12 Thread Duncan Temple Lang
It is not so much that rjson is implemented in R that makes it slow, just that it does not use vectorized operations. The package RJSONIO http://www.omegahat.org/RJSONIO can be used as a drop-in replacement for rjson and was written to be faster (by using vectorized operations) and exte

Re: [R] RGoogleDocs: can now see documents but cannot get content.

2009-06-17 Thread Duncan Temple Lang
> (08 May 2009) > > > Farrel Buchinsky > Google Voice Tel: (412) 567-7870 > > > > On Wed, May 20, 2009 at 12:28, Duncan Temple Lang > wrote: > > > > > Hi Farrel > > > > This particular problem is a trivial issue of an argument out > >

Re: [R] How to find b entries using xPath?

2009-06-23 Thread Duncan Temple Lang
g...@ucalgary.ca wrote: We got all rows by: library(XML) doc = htmlParse('http://www.statcan.gc.ca/daily-quotidien/090520/t090520b1-eng.htm') rows = xpathSApply(doc, '//table/tbody/tr') The last row is: row_last = rows[15] row_last [[1]] Unsmoothed composite leading indicator 221.8 218.4

Re: [R] Qualified parameters in SOAP body using .SOAP

2009-06-24 Thread Duncan Temple Lang
Hi Olivier Olivier Cailloux wrote: Hello, I am trying to reach a web service using the SOAP package. I succeeded calling the web service, but not sending parameters to it. After much research and tries, I think I found that the problem lies in the namespace including the parameters in the S

Re: [R] xmlEventParse returning trimmed content?

2009-04-09 Thread Duncan Temple Lang
Hi Johannes I would "guess" that the trimming of the text occurs because you do not specify trim = FALSE in the call to xmlEventParse(). If you specify this, you might well get the results you expect. If not, can you post the actual file you are reading so we can reproduce your results. D. J

Re: [R] xmlEventParse returning trimmed content?

2009-04-10 Thread Duncan Temple Lang
own versions of my script and data file. Thanks for any further hint. Joh Duncan Temple Lang wrote: Hi Johannes I would "guess" that the trimming of the text occurs because you do not specify trim = FALSE in the call to xmlEventParse(). If you specify this, you might well get the r

Re: [R] how to inspect content of save() file

2009-04-22 Thread Duncan Temple Lang
Hi Benno et al. I have had some code for reading RDA files via R functions and binary connections. It is available from http://www.omegahat.org/RDA or install.packages("RDA", repos = "http://www.omegahat.org/R";, dep = TRUE) It could be made faster if there is inte

Re: [R] XML and RCurl: problem with encoding (htmlTreeParse)

2009-12-31 Thread Duncan Temple Lang
Hi Lauri. I am in the process of making some changes to the encoding in the XML package. I'll take a look over the next few days. (Not certain precisely when.) D. Lauri Nikkinen wrote: > Hi, > > I'm trying to get data from web page and modify it in R. I have a > problem with encoding. I'm no

Re: [R] xmlToDataFrame#Help!!!

2010-01-10 Thread Duncan Temple Lang
ontinue developing a small package called R2sas2R with > obvious meaning and I'll release it on CRAN as soon as I'm a bit > further. (first tests under Windows using the StatconnDCOM connector and > the rcom package are encouraging). > -- "There are men who can

Re: [R] Data import export zipped files from URLs

2010-01-19 Thread Duncan Temple Lang
Dieter Menne wrote: > > Velappan Periasamy wrote: >> I am not able to import zipped files from the following link. >> How to get thw same in to R?. >> mydata <- >> read.csv("http://nseindia.com/content/historical/EQUITIES/2010/JAN/cm15JAN2010bhav.csv.zip";) >> > > As Brian Ripley noted in > >

Re: [R] SSOAP XML-RPC

2010-01-27 Thread Duncan Temple Lang
Hi Jan Is .XMLRPC("http://localhost:9000";, "Cytoscape.test", .opts = list(verbose = TRUE)) the command you used? If not, what did you use? Can you debug the .XMLRPC function (e.g. with options(error = recover)) and see what the XML that was sent to the server, i.e. the cmd variabl

Re: [R] RCurl : limit of downloaded Urls ?

2010-01-31 Thread Duncan Temple Lang
Alexis-Michel Mugabushaka wrote: > Dear Rexperts, > > I am using R to query google. I believe that Google would much prefer that you use their API rather than their regular HTML form to make programmatica search queries. > > I am getting different results (in size) for manual queries and que

Re: [R] create zip archive in R

2010-02-04 Thread Duncan Temple Lang
Uwe Ligges wrote: > > > On 04.02.2010 03:31, mkna005 mkna005 wrote: >> Hello all! >> I was wondering if it is possible to create a zip archive within R and >> add files to it? > > No. Well, the Rcompression package on the Omegahat package does have some facilities for it. It doesn't do it in

Re: [R] convert R plots into annotated web-graphics

2010-02-09 Thread Duncan Temple Lang
Hi While there is different level of support for SVG in the different browsers, basic SVG (non-animation) does work on all of them (with a plugin for IE). In addition to the 2 SVG packages on CRAN, there is SVGAnnotation at www.omegahat.org/SVGAnnotation and that is quite a bit more powerful. The

Re: [R] Weird 'xmlEventParse' encoding issue

2013-07-16 Thread Duncan Temple Lang
Hi Sascha Your code gives the correct results on my machine (OS X), either reading from the file directly or via readLines() and passing the text to xmlEventParse(). The problem might be the version of the XML package or your environment settings. And it is important to report the session info

Re: [R] downloading web content

2013-07-23 Thread Duncan Temple Lang
Hi Daisy Use getURLContent() rather than getURL(). The former handles binary content and this appears to be a zip file. You can write it to a file or read its contents directly in memory, e.g library(RCurl) z = getURLContent("http://biocache.ala.org.au/ws/occurrences/download?q=Banksia+eri

Re: [R] xmlToDataFrame very slow

2013-07-31 Thread Duncan Temple Lang
Hi Stavros xmlToDataFrame() is very generic and so doesn't know anything about the particulars of the XML it is processing. If you know something about the structure of the XML, you should be able to leverage that for performance. xmlToDataFrame is also not optimized as it is just a convenience

Re: [R] How to download this data?

2013-08-02 Thread Duncan Temple Lang
That URL is an HTTPS (secure HTTP), not an HTTP. The XML parser cannot retrieve the file. Instead, use the RCurl package to get the file. However, it is more complicated than that. If you look at source of the HTML page in a browser, you'll see a jsessionid and that is a session identifier. The

Re: [R] How to download this data?

2013-08-03 Thread Duncan Temple Lang
Hi Ron Yes, you can use ssl.verifypeer = FALSE. Or alternatively, you can use also use getURLContent(, cainfo = system.file("CurlSSL", "cacert.pem", package = "RCurl")) to specify where libcurl can find the certificates to verify the SSL signature. The error you are encounte

Re: [R] XML package installation -- an old question

2013-08-15 Thread Duncan Temple Lang
Hi Tao In the same R session as you call install.packages(), what does system("which xml2-config", intern = TRUE) return? Basically, the error message from the configuration script for the XML package is complaining that it cannot find the executable xml2-config in your PATH. (You can also

Re: [R] RCurl cookiejar

2013-08-27 Thread Duncan Temple Lang
Hi Earl The cookies will only be written to the file specified by the cookiejar option when the curl handle is garbage collected. If you use rm(ch) gc() the cookie.txt file should be created. This is the way libcurl behaves rather than something RCurl introduces. If you don't explic

Re: [R] Create a Data Frame from an XML

2013-01-22 Thread Duncan Temple Lang
Hi Adam [You seem to have sent the same message twice to the mailing list.] There are various strategies/approaches to creating the data frame from the XML. Perhaps the approach that most closely follows your approach is xmlRoot(doc)[ "row" ] which returns a list of XML nodes whose node n

Re: [R] htmlParse (from XML library) working sporadically in the same code

2013-03-20 Thread Duncan Temple Lang
When readHTMLTable() or more generally the HTML/XML parser fails to retrieve a URL, I suggest you use check to see if a different approach will work. You can use the download.file() function or readLines(url()) or getURLContent() from the RCurl package to get the content of the URL. The you can p

Re: [R] memory leak using XML readHTMLTable

2012-09-17 Thread Duncan Temple Lang
Hi James Unfortunately, I am not certain if the "latest version" of the XML package has the garbage collection activated for the nodes. It is quite complicated and that feature was turned off in some versions of the package. I suggest that you install the version of the package on github git

Re: [R] memory leak using XML readHTMLTable

2012-09-17 Thread Duncan Temple Lang
i >> -- >> Yihui Xie >> Phone: 515-294-2465 Web: http://yihui.name >> Department of Statistics, Iowa State University >> 2215 Snedecor Hall, Ames, IA >> >> >> On Mon, Sep 17, 2012 at 11:16 AM, Duncan Temple Lang >> wrote: >>> Hi

Re: [R] scraping with session cookies

2012-09-18 Thread Duncan Temple Lang
Hi ? The key is that you want to use the same curl handle for both the postForm() and for getting the data document. site = u = "http://www.wateroffice.ec.gc.ca/graph/graph_e.html?mode=text&stn=05ND012&prm1=3&syr=2012&smo=09&sday=15&eyr=2012&emo=09&eday=18"; library(RCurl) curl = getCurlHandle(c

Re: [R] scraping with session cookies

2012-09-19 Thread Duncan Temple Lang
; > I have been trying what you suggested however I am getting an error when > trying to create the function fun<- createFunction(forms[[1]]) > it says Error in isHidden I hasDefault : > operations are possible only for numeric, logical or complex types > > On Wed, Sep 19,

Re: [R] Problems with getURL (RCurl) to obtain list files of an ftp directory

2012-10-12 Thread Duncan Temple Lang
Hi Francisco The code gives me the correct results, and it works for you on a Windows machine. So while it could be different versions of software (e.g. libcurl, RCurl, etc.), the presence of the word "squid" in the HTML suggests to me that your machine/network is using the proxy/caching softw

Re: [R] saving to docx

2012-10-20 Thread Duncan Temple Lang
Just to let people know On the Omegahat site (and source on github), there are packages for working with Office Open documents (and LibreOffice too), includinging RWordXML, RExcelXML and the generic package OOXML on which they rely. These are prototypes in the sense that they do not comprehe

Re: [R] Downloading a html table

2012-10-23 Thread Duncan Temple Lang
Rather than requiring manual tweaking, library(XML) readHTMLTable("http://www.worldatlas.com/aatlas/populations/usapoptable.htm";) will do the job for us. D. On 10/22/12 8:17 PM, David Arnold wrote: > All, > > A friend of mine would like to use this data with his stats class: > > http://www.

Re: [R] Extracting results from Google Search

2012-10-23 Thread Duncan Temple Lang
Hi Eduardo Scraping the coordinates from the HTML page can be a little tricky in this case. Also, Google may not want you using their search engine for that. Instead, you might use their Geocoding API (https://developers.google.com/maps/documentation/geocoding), but do ensure that this fits wit

Re: [R] Parsing very large xml datafiles with SAX: How to profile functions?

2012-10-26 Thread Duncan Temple Lang
Hi Frederic Perhaps the simplest way to profile the individual functions in your handlers is to write the individual handlers as regular named functions, i.e. assigned to a variable in your work space (or function body) and then two write the handler functions as wrapper functions that call thes

Re: [R] XML namespace control

2012-10-29 Thread Duncan Temple Lang
Hi Ben Can you tell us the slightly bigger picture, please? Do you want to create a single similar node entirely in isolation or do you want to create it as part of an XML tree/document? Who will be reading the resulting XML. You can use a parent node top = newXMLNode("storms", namespaceDef

Re: [R] RCurl - curlPerform - Time out?!?

2012-10-30 Thread Duncan Temple Lang
Hi Florian Yes, there are several options for a curl operation that control the timeout. The timeout option is the top-level general one. There is also timeout.ms. You can also control the timeout length for different parts of the operation/request such as via the connecttimeout for just estab

Re: [R] problem with XML package

2012-11-15 Thread Duncan Temple Lang
Hi Arvin 2.9.2 is very old. 2.13 is still old. Why not upgrade to 2.15.*? However, the problem is that you the object you are passing to xmlName() is NULL. This will give an error in the latest version of the XML package and most likely any version of the XML package. I imagine the structure

Re: [R] reading json tables

2012-12-01 Thread Duncan Temple Lang
Hi Michael The problem is that the content of the .js file is not JSON, but actual JavaScript code. You could use something like the following tt = readLines("http://mbostock.github.com/protovis/ex/wheat.js";) txt = c("[", gsub(";", ",", gsub("var [a-zA-Z]+ = ", "", tt)), "]") tmp = paste(tx

Re: [R] reading json tables

2012-12-02 Thread Duncan Temple Lang
lete and which need to be filled in with NAs before rbinding. Best, D. On 12/2/12 6:26 AM, Michael Friendly wrote: > On 12/1/2012 4:08 PM, Duncan Temple Lang wrote: >> Hi Michael >> >>The problem is that the content of the .js file is not JSON, >> but actual JavaScript

  1   2   3   >