Displaying 20 results from an estimated 1000 matches similar to: "Scraping a web page"
2010 Dec 29
3
Windows editor suggestions - autosave
I am looking for advice on an editor to use with R (windows) that has an autosave feature. I typically write scripts using the RGui (and tried TinnR yesterday) but I am having continuing problems with BSODs (non R related) and have in the past have had issues with R crashes and would really like a system that does not require me to remember to hit the save button on my script every 10 minutes so
2011 May 19
2
Anyone successfully install Rgraphviz on windows with R 2.13?
I have been trying to get Rgraphviz to work (I know it is from Bioconductor) unsuccessfully. Since I have no experience with Bioconductor I thought I would ask here if anyone has advice. I have installed Graphviz 2.20.3 as is recommended on the Bioconductor site but basically R cannot seem to find the needed dll files. So, even though I have added the appropriate directories to the system path R
2009 Aug 19
2
Problem with predict.coxph
We occasionally utilize the coxph function in the survival library to fit multinomial logit models. (The breslow method produces the same likelihood function as the multinomial logit). We then utilize the predict function to create summary results for various combinations of covariates. For example:
2009 Apr 28
1
Problem with Random Forest predict
I am trying to run a partialPlot with Random Forest (as I have done many times before).
First I run my forest... Cell is a 6 level factor that is the dependent variable - all other variables are predictors, most of these are factors as well.
predCell<-randomForest(x=tempdata[-match("Cell",names(tempdata))],y=tempdata$Cell,importance=T)
Then I try my partial plot to look at the
2008 Jun 25
1
LDA on pre-assigned training and testing data sets
Dear r-help
I am trying to run LDA on a training data set, and test it on another data set with the same variables. I found examples using crossvalidation, and using training and testing data sets set up with sample, but not when they are preassigned.
Here is what I tried
# FIRST SET UP A DATAFRAME WITH ALL THE DATA AND CREATE NEW VARIABLES
traintest1 <-
2007 Sep 07
2
confusion matrix - better code?
Hi,
I’ve written some code to obtain a confusion matrix when the true classification and the predicted classification are known. Suppose true classification is called “tr” and predicted classification is “pr”. I have 4 classes in tr, but only 3 classes out of 4 are predicted in “pr”. Following is my code, but looks quite “clunky” to me. I wonder if you have any suggestions to improve it.
2008 May 23
3
Percentages for categorical data by group
I can think of several ways to blunt force hard code what I want but I
imagine there is a command or two that can be easily combined to do this:
I have a data frame with about 23000 observations. There first variable is
the group to which the observation belongs (about 500 different groups). The
second variable is a response for each observation that is a 1,2,3,4 or 5. I
want to be able to
2008 Jun 06
5
request: a class having max frequency
Dear R users
I have a very basic question. I tried but could not find the required result. using
dat <- pima
f <- table(dat[,9])
> f
0 1
500 268
i want to find that class say "0" having maximum frequency i.e 500. I used
>which.max(f)
which provide
0
1
How can i get only the "0". Thanks and
best regards
Muhammad Azam
Ph.D. Student
Department of
2006 Jun 01
1
Help with evaluation of expressions
Hello all:
I have searched through the help files and I have been unsuccessful in
solving this problem.
I am trying to create a small wrapper function that will go around a
call to a plot function and create a windows metafile in the directory
and also write the name of the file to a text file. The purpose is to
efficiently bring a large number of plots into powerpoint. I am using
2006 Mar 08
1
Accessing functions in a library
I am trying to write a modified function to plot an rpart object. By
using getS3method I can see the plot and text code that I want to
modify. Since I don't want to modify the package, I create a new
function to plot the rpart object. The problem is that the original
function calls many rpart specific functions that are only visible
inside the rpart namespace. Therefore, when I call my
2007 Jan 25
0
Creating dendrograms from a table
I am trying to create a dendrogram object to be able to display a
multiway table. I understand how the dendrogram object is structured, a
nested list of lists, but I am having trouble trying to create that
structure from a table. Basically, what I would like to do is pass a
multiway table, say table(a,b,c) to a function and have it display the
table as a dendrogram. If a,b,c, and d are all
2007 Feb 05
0
Help with party package
I am just starting to experiment with the party package and I am getting
strange results. In the examples, the "statistic" and "criterion" seem
related, i.e. criterion is a 1-p.value and statistic is the test
statistic. Higher statistics are associated with higher criteria
values. When I run these models on my own dataset, the highest
statistic ends up getting a 0.00
2011 Jun 01
0
Memory management
I am trying to run a very large Bradley-Terry model using the BradleyTerry2 package. (There are 288 "players" in the BT model).
My problem is that I ran the model below successfully.
WLMat is a win-loss matrix that is 288 by 288
WLdf<-countsToBinomial(WLMat)
mod1<-BTm(cbind(win1,win2),player1,player2,~player,id="player",data=WLdf)
Then I needed to run the same model
2009 Dec 31
3
XML and RCurl: problem with encoding (htmlTreeParse)
Hi,
I'm trying to get data from web page and modify it in R. I have a
problem with encoding. I'm not able to get
encoding right in htmlTreeParse command. See below
> library(RCurl)
> library(XML)
>
> site <- getURL("http://www.aarresaari.net/jobboard/jobs.html")
> txt <- readLines(tc <- textConnection(site)); close(tc)
> txt <- htmlTreeParse(txt,
2009 Jun 23
1
How to find b entries using xPath?
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]]
<tr><td id="t1stub17" class="stub1 RGBShade"><b>Unsmoothed composite
leading indicator</b></td>
<td
2009 Mar 02
2
Need help extracting info from XML file using XML package
I have an XML file that has within it the coordinates of some
polygons that I would like to extract and use in R. The polygons are
nested rather deeply. For example, I found by trial and error that I
can extract the coordinates of one of them using functions from the
XML package:
doc <- xmlInternalTreeParse('doc.kml')
docroot <- xmlRoot(doc)
pgon <-
2012 Apr 12
3
Remove superscripts from HTML objects
Is there some way to remove superscripts from objects returned by
html/xmlParse (XML package)?
h <- "<html><p>Cat<sup>a</sup></p><p>Dog</p></html>"
doc <- htmlParse(h)
xpathSApply(doc, "//p", xmlValue)
[1] "Cata" "Dog"
I could probably remove the <sup> tags from the "h" object above,
2011 Oct 10
1
Text Mining with Facebook Reviews (XML and FQL)
Hello,
I am trying to use XML package to download Facebook reviews in the following
way:
require(XML)
mydata.vectors <- character(0)
Qword <- URLencode('#IBM')
QUERY <- paste('SELECT review_id, message, rating from review where message
LIKE %',Qword,'%',sep='')
Facebook_url = paste('https://api.facebook.com/method/fql.query?query=
2010 Jul 03
1
XML and RCurl: problem with encoding (htmlTreeParse)
Hi All,
First method:-
>library(XML)
>theurl <- "http://home.sina.com"
>download.file(theurl, "tmp.html")
>txt <- readLines("tmp.html")
>txt <- htmlTreeParse(txt, error=function(...){}, useInternalNodes =
TRUE)
>g <- xpathSApply(txt, "//p", function(x) xmlValue(x))
>head(grep(" ", g, value=T))
[1] " |
2009 Apr 28
4
Producing customized tickmarks when producing a graph using "curve"
Hello!
I am using function "curve" to create a line graph.
I was wondering, if it's possible to "turn off" the default tick marks
and introduce those tick marks in specific locations.
For example, currently in my X axis tick marks are (automatically) at
10, 11, 12, 13 but I want them to be in 5 specific locations, like
9.89, 10.34, etc.
Any hint would be greatly