Re: [R] how to process this in R

2010-07-08 Thread Tony B
I don't have R on the netbook I'm writing this from, but I *think* the following will work: 1. how can i only read in the files with the string patterns ggg or fff as part of the file names?   for instance, I only need the file names with the ggg or fff in it      x_ggg_y_1.txt      

[R] is there a Decode HTML function somewhere (similar to URLdecode)?

2010-06-23 Thread Tony B
Dear all, I am aware of the URLdecode(..) function and was wondering if there was something similar for HTML? For example, I would like to convert strings like this: x - isnapos;t into this: isn't Many thanks for your time, Tony Breyal # O/S: Windows Vista 32 bit # R version 2.11.0

Re: [R] reading formatted txt file into a data frame

2010-05-07 Thread Tony B
          Steven Moffat     8.9  Doctor Who 2 002             Joss Whedon     8.8       Buffy 3 003  J. Michael Straczynski     7.4     Babylon On Thu, May 6, 2010 at 9:58 AM, Tony B tony.bre...@googlemail.com wrote: Dear all Lets say I have a plain text file as follows: cat(c([ID: 001

[R] reading formatted txt file into a data frame

2010-05-06 Thread Tony B
Dear all Lets say I have a plain text file as follows: cat(c([ID: 001 ] [Writer: Steven Moffat ] [Rating: 8.9 ] Doctor Who, + [ID: 002 ] [Writer: Joss Whedon ] [Rating: 8.8 ] Buffy, + [ID: 003 ] [Writer: J. Michael Straczynski ] [Rating: 7.4 ] Babylon [5]), + sep = \n, file =

Re: [R] regular expression help to extract specific strings from text

2010-04-01 Thread Tony B
Thank you guys, both solutions work great! Seems I have two new packages to investigate :) Regards, Tony Breyal On 31 Mar, 14:20, Tony B tony.bre...@googlemail.com wrote: Dear all, Lets say I have the following: x - c(Eve: Going to try something new today..., Adam: Hey @Eve, how are you

[R] regular expression help to extract specific strings from text

2010-03-31 Thread Tony B
Dear all, Lets say I have the following: x - c(Eve: Going to try something new today..., Adam: Hey @Eve, how are you finding R? #rstats, Eve: @Adam, It's awesome, so much better at statistics that #Excel ever was! @Cain @Able disagree though :(, Adam: @Eve I'm sure they'll sort it out

Re: [R] Three most useful R package

2010-03-03 Thread Tony B
I only really need the base packages, but otherwise I suppose the most useful for me are: (1) RCurl (2) plyr (3) XML On 2 Mar, 20:13, Ralf B ralf.bie...@gmail.com wrote: Hi R-fans, I would like put out a question to all R users on this list and hope it will create some feedback and

Re: [R] two questions for R beginners

2010-03-01 Thread Tony B
Background: During my uni days, I was taught to use MAPLE, MATLAB, SPSS, SAS, C++ and Java. Then after uni, several years went by without me ever using any of them again and was told to just use Excel. Then I started my PhD and was told I should start using R instead (something I'd never even

[R] Reshaping data with xtabs giving me 'extra' data

2010-01-20 Thread Tony B
Dear all, Lets say I have several data frames as follows: set.seed(42) dates - as.Date(c(2010-01-19, 2010-01-20)) times - c(09:30:00, 11:30:00, 13:30:00, 15:30:00) shows - c(Red Dwarf, Being Human, Doctor Who) df1 - data.frame(Date = dates[1], Time = times[1], Show = shows, Score = 1:3)

Re: [R] Reshaping data with xtabs giving me 'extra' data

2010-01-20 Thread Tony B
Dallazuanna www...@gmail.com wrote: Try with tapply:  with(do.call(rbind, df.list), tapply(Score, list(Date, Time, Show), length)) On Wed, Jan 20, 2010 at 10:20 AM, Tony B tony.bre...@googlemail.com wrote: Dear all, Lets say I have several data frames as follows: set.seed(42) dates - as.Date

Re: [R] Reading PDF files

2009-12-22 Thread Tony B
Copied/pasted from my earlier reply: It's been a while since I've done this, but if memory serves, the basic process was to download xpdf and add it to the windows path, thus making it accessable from within R. Two methods follow: Method One (easiest) - using the awesome ?system command: (1)

Re: [R] Replying to Posts Within Same Thread

2009-12-02 Thread Tony B
To be honest, I've never figured this out either. However, if you're familiar with the gmail way of threading emails, just bookmark and use google groups: http://groups.google.co.uk/group/r-help-archive It's the easiest way I've personally found, and has a very intuitive interface. HTH, Tony

Re: [R] XML package example code?

2009-11-25 Thread Tony B
Cls59 is correct that there is a lot of example code, just look in ? htmlTreeParse and you'll get most of what you need i think. here's some simplified code I use a lot of (XPath expressions are used to parse the code): # libraries library(RCurl) library(XML) # google url my.url -

Re: [R] XML package example code?

2009-11-25 Thread Tony B
Not sure if my code was attached in that last post: library(RCurl) library(XML) html - getURL(http://www.omegahat.org/RSXML/index.html;) html.tree - htmlTreeParse(html, useInternalNodes = TRUE, error = function(...){}) On 25 Nov, 16:21, Peng Yu pengyu...@gmail.com wrote: On Wed, Nov 25, 2009

Re: [R] XML package example code?

2009-11-25 Thread Tony B
It's been a long time since i read the tutorials, but 'I think', the reason you get those notifications is because the html code is malformed, meaning that some of the opening tags 'dd' don't have corresponding end tags /dd etc. The XML package seems rather good at working with malformed code,

Re: [R] parsing Google search results

2009-11-17 Thread Tony B
Hi Philip, If i understood correctly, you just wish to get the urls from a given google search? I have some old code you could adapt which extracts the main links from a google search. It makes use of XPath expressions using the lovely XML and RCurl packages: library(XML) library(RCurl)