[R] Optimization function

2014-11-20 Thread Amit Thombre
Hi, I want to optimize the root mean square error objective function using the optim function. Thus the function will look like sqrt(sum((yi - f(xi))^2)/n). Now the f(xi) is the Arima function. I am not clear how do I get the f(xi) because the call to arima function in C gives the value of th

Re: [R] Parsing Google Finance page data?

2014-11-20 Thread Matt Considine
FWIW, this is the kludge I came up with. The idea is that I only know the name of the company and not the ticker/exchange. So the following admittedly doesn't work in all cases (e.g. "Time Warner"). So if anyone alternatively knows how to return a list of tickers/exchanges of companies match

Re: [R] Parsing Google Finance page data?

2014-11-20 Thread Collin Lynch
If you do not need a pure R solution, you might also find it helpful to blend languages. For scraping and munging tasks such as this I generally turn to python to do extraction then feed data to R for analysis via rpy. On Thu, Nov 20, 2014 at 8:57 PM, Spencer Graves < spencer.gra...@structuremoni

Re: [R] Parsing Google Finance page data?

2014-11-20 Thread Spencer Graves
The Ecfun package includes functions written to scrape data from web pages. See, e.g., readUShouse, readUSsenate, readUSstateAbbreviations. They use getURL{RCurl} and readHTMLTable{XML}. Hope this helps. Spencer Graves On 11/20/2014 5:42 PM, Matt Considine wrote: Hi,

[R] Parsing Google Finance page data?

2014-11-20 Thread Matt Considine
Hi, I'm wondering if anyone can point me to code to parse data on Google Finance pages, i.e. parse the results of a URL request such as this http://www.google.com/finance?q=apple I know how to return the contents of the page; it's figuring out the best tools to parse it that I'm interested i

Re: [R] see rcurl contents before they're sent?

2014-11-20 Thread Hasan Diwan
RCurl has a verbose switch, which may be set as follows: response <- postForm(getUpdateURL(),.opts = list(postfields = '{"delete": {"query":"*:*"}}',httpheader = c('Content-Type' = 'application/json',Accept = 'application/json', *verbose = TRUE*) # emphasis mine On 20 November 2014 16:16, Mark Mi

[R] see rcurl contents before they're sent?

2014-11-20 Thread Mark Miller
I am trying to use the R / solr integration from https://github.com/datadolphyn/R/blob/master/r_solr_integration.R I have the query function working, but I'm having trouble with the post functions, which uses rcurl. Is it possible to see the string that rcurl is going to send to a webserver (inst

[R] Saving Google worksheets with common prefix

2014-11-20 Thread Jennifer Sabatier
Hi R-Help, So, I will try to provide a reproducible example...I basically made a dummy spreadsheet that contains the same number of tabs as the spreadsheet I am really interested in. The data on that spreadsheet is really sensitive so I couldn't use it. Anyway, here are the various sheets in the

Re: [R] ggplot question error: Error in s(x, bs = "cs") : object 'x' not found

2014-11-20 Thread Dimitri Liakhovitski
Never mind, I found the problem. In my profile s was assigned to summary. This is why it did not work. On Thu, Nov 20, 2014 at 5:14 PM, Dimitri Liakhovitski wrote: > Dear R-ers, > > apologies for not providing the full code. I just need a point in the > right direction. > I have a data frame ('te

Re: [R] R website

2014-11-20 Thread Ista Zahn
On Thu, Nov 20, 2014 at 5:02 PM, Duncan Murdoch wrote: > On 20/11/2014, 4:35 PM, Ista Zahn wrote: >> This prompted me to do something I've been meaning to do for a long >> time, which is to try to get the R website updated in terms of visual >> style. It really is showing it's age and could use a

[R] Function returns NULL on running this code in latest version of R!

2014-11-20 Thread Aditya Singh
Any help on this issue will be greatly appreciated. Spent days sitting alone in a remote corner of the world--> Patiala, Punjab, India.. trying to do this! --- setwd("C:/Documents and Sett

Re: [R] R website

2014-11-20 Thread Ista Zahn
This prompted me to do something I've been meaning to do for a long time, which is to try to get the R website updated in terms of visual style. It really is showing it's age and could use a facelift in my opinion. Toward than end I've mocked up a copy of cran.r-project.or using css from the python

Re: [R] R website

2014-11-20 Thread Duncan Murdoch
On 20/11/2014, 4:35 PM, Ista Zahn wrote: > This prompted me to do something I've been meaning to do for a long > time, which is to try to get the R website updated in terms of visual > style. It really is showing it's age and could use a facelift in my > opinion. Toward than end I've mocked up a co

[R] ggplot question error: Error in s(x, bs = "cs") : object 'x' not found

2014-11-20 Thread Dimitri Liakhovitski
Dear R-ers, apologies for not providing the full code. I just need a point in the right direction. I have a data frame ('temp') with 1,200 rows and 2 variables. I am using ggplot2 to create a scatter plot: This is my code and it works fine, it creates a scatter plot: library(ggplot2) sp10<-ggplo

Re: [R] SVYPLOT

2014-11-20 Thread David Winsemius
On Nov 20, 2014, at 12:56 PM, David Winsemius wrote: > > On Nov 20, 2014, at 8:10 AM, Anthony Damico wrote: > >> survey:::svyplot.default with style="grayhex" calls >> hexbin:::gplot.hexbin >> >> an internet search turns up lots of people asking the question "how do i >> set xlim and ylim

Re: [R] SVYPLOT

2014-11-20 Thread David Winsemius
On Nov 20, 2014, at 8:10 AM, Anthony Damico wrote: > survey:::svyplot.default with style="grayhex" calls > hexbin:::gplot.hexbin > > an internet search turns up lots of people asking the question "how do i > set xlim and ylim on hexbin plots?" but i don't see any easy solutions. :/ Looking

Re: [R] [R-pkgs] rms 4.1-0

2014-11-20 Thread David Winsemius
On Nov 20, 2014, at 7:56 AM, Dewi VERNEREY wrote: > > Hi Franck, > > I am using the calibrate function from the package rms (4.2-1) with R (3.1.2) > in a Mac OS 10.10.1 environment . That's the Yosemite platform. I'm running R 3.1.2 with the current CRAN binaries (which were recently updated

Re: [R] Symbolic equations to R code?

2014-11-20 Thread Boris Steipe
I usually find my students appreciate it when I teach them something that has utility in multiple contexts. Teaching them how to express an idea in R code is valuable. And as far as structuring thought and expressing ideas go, it's quite equivalent to symbolic equations. Both are just notation.

Re: [R] R website

2014-11-20 Thread Duncan Murdoch
On 20/11/2014 2:10 PM, Prof J C Nash (U30A) wrote: I was looking at the R website (r-project.org). 1) The Books page does not list several books about R, including one of my own (Nonlinear parameter optimization tools in R) nor that of Karline Soetaert on differential equations. How is the list

Re: [R] Symbolic equations to R code?

2014-11-20 Thread Scott Rifkin
Ista, On the one hand I'd like it to be as flexible as possible so the students could really come up with whatever they like. On the other hand, restricting their choices probably would make it easier to do the backend. The goal would be to get them to realize that the apparatus of hypothes

Re: [R] Bootstrap CIs for weighted means of paired differences

2014-11-20 Thread David Winsemius
On Nov 20, 2014, at 2:23 AM, i.petzev wrote: > Hi David, > > sorry, I was not clear. Right. You never were clear about what you wanted and your examples was so statistically symmetric that it is still hard to see what is needed. The examples below show CI's that are arguably equivalent. I can

[R] R website

2014-11-20 Thread Prof J C Nash (U30A)
I was looking at the R website (r-project.org). 1) The Books page does not list several books about R, including one of my own (Nonlinear parameter optimization tools in R) nor that of Karline Soetaert on differential equations. How is the list updated? 2) The wiki seems to be dead. Is anyone in

[R] [R-pkgs] rms 4.1-0

2014-11-20 Thread Dewi VERNEREY
Hi Franck, I am using the calibrate function from the package rms (4.2-1) with R (3.1.2) in a Mac OS 10.10.1 environment . With my previous configuration (other computer) the function calibrate worked very well. Unfortunately, now the calibrate function doesn’t work. Do you have an idea to h

Re: [R] Equivalent to matlab ".*" operator in R

2014-11-20 Thread peter dalgaard
Not sure you really want the overhead of sweep() for this, but logically, you want z as a vector or maybe 1d array since sweep() is designed as complimentary to apply(). I.e., you can sweep out marginal means using, say, m <- matrix(c(5, 7, 9, 13), 2) colmean <- apply(m, 2, mean) sweep(m, 2, col

Re: [R] auto.arima function in R

2014-11-20 Thread peter dalgaard
On 20 Nov 2014, at 17:19 , Akhil dua wrote: > I am sorry for violating the guidelines but the data that I am using is > highly confidential so I can't disclose it.I posted sample data just for > giving the flavour of the data. This happens, but then you need to simulate some data that show the

Re: [R] Symbolic equations to R code?

2014-11-20 Thread alanm (Alan Mitchell)
Have you thought about programming a function builder into the Shiny applet? It might simplify the process for your students a bit. A highly simplified version of the page David suggested could be built that generates the R code. Best of luck, Alan -Original Message- From: Scott Rif

Re: [R] auto.arima function in R

2014-11-20 Thread Akhil dua
I am sorry for violating the guidelines but the data that I am using is highly confidential so I can't disclose it.I posted sample data just for giving the flavour of the data. On Nov 20, 2014 5:46 PM, "Prof Brian Ripley" wrote: There is no auto.arima function 'in R'. Do give credit/blame where

Re: [R] SVYPLOT

2014-11-20 Thread Anthony Damico
survey:::svyplot.default with style="grayhex" calls hexbin:::gplot.hexbin an internet search turns up lots of people asking the question "how do i set xlim and ylim on hexbin plots?" but i don't see any easy solutions. :/ On Thu, Nov 20, 2014 at 10:31 AM, Raphael Fraser wrote: > Does not w

Re: [R] Adapt sweave function to produce an automatic pdf.

2014-11-20 Thread Marc Schwartz
> On Nov 20, 2014, at 4:03 AM, Frederic Ntirenganya wrote: > > Hi All, > > I want to make a climate method ("sweave_function"). The aim is to be able > to adapt sweave code that produces an automatic pdf so that it can works > for my climate object. i.e. instead of compile pdf, I call : > data_

Re: [R] SVYPLOT

2014-11-20 Thread Raphael Fraser
Does not work when ,style="grayhex". library(survey) data(api) dstrat<-svydesign(id=~1,strata=~stype, weights=~pw, data=apistrat, fpc=~fpc) svyplot(api00~api99, design=dstrat, style="grayhex") svyplot(api00~api99, design=dstrat, style="grayhex", ylim=c(500, 700)) On Thu, Nov 20, 2014 at 9:19 AM,

Re: [R] install R without texlive dependencies

2014-11-20 Thread Marc Schwartz
> On Nov 20, 2014, at 8:00 AM, Duncan Murdoch wrote: > > On 20/11/2014 3:31 AM, Muraki Kazutaka wrote: >> Hi all >> I'm trying install R from EPEL repo on Scientific Linux. It's going >> together texlive rpm dependencies also from repo, but I already have >> installed TexLive with tlmgr from CTA

Re: [R] SVYPLOT

2014-11-20 Thread Adams, Jean
Raphael I just ran an example from the help file, and the xlim argument worked fine. Can you post a small example where the xlim argument doesn't work? Jean library(survey) data(api) dstrat<-svydesign(id=~1,strata=~stype, weights=~pw, data=apistrat, fpc=~fpc) svyplot(api00~api99, design=dstrat,

Re: [R] install R without texlive dependencies

2014-11-20 Thread Duncan Murdoch
On 20/11/2014 3:31 AM, Muraki Kazutaka wrote: Hi all I'm trying install R from EPEL repo on Scientific Linux. It's going together texlive rpm dependencies also from repo, but I already have installed TexLive with tlmgr from CTAN mirror and I don't want texlive rpms from linux repo. So... Question

[R] install R without texlive dependencies

2014-11-20 Thread Muraki Kazutaka
Hi all I'm trying install R from EPEL repo on Scientific Linux. It's going together texlive rpm dependencies also from repo, but I already have installed TexLive with tlmgr from CTAN mirror and I don't want texlive rpms from linux repo. So... Question is... How can I install R without these deps an

Re: [R] portfolio optimization in R

2014-11-20 Thread Boris Steipe
Indeed. Start here: http://www.r-bloggers.com/three-tips-for-posting-good-questions-to-r-help-and-stack-overflow/ and then read this: http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example Then put some comments into your code about what you think it should do. Oh

Re: [R] Conditionally replace multiple rows in a dataframe

2014-11-20 Thread Bert Gunter
Sorry, just noticed the typo: it's is.na() of course. -- Bert Bert Gunter Genentech Nonclinical Biostatistics (650) 467-7374 "Data is not information. Information is not knowledge. And knowledge is certainly not wisdom." Clifford Stoll On Thu, Nov 20, 2014 at 4:04 AM, Bert Gunter wrote: >

Re: [R] auto.arima function in R

2014-11-20 Thread Prof Brian Ripley
There is no auto.arima function 'in R'. Do give credit/blame where it is due (probably package 'forecast'). Without the reproducible example the posting guide asked for, we can only guess wildly. I at least decline to do so. On 20/11/2014 10:52, Akhil dua wrote: Hello every one, I am usi

Re: [R] Conditionally replace multiple rows in a dataframe

2014-11-20 Thread Bert Gunter
No comment on whether Jeff's solution is correct or not, but for setting elements to NA, perhaps preferable, as it invokes the NA method for data frames -- see ?NA -- is: is,na(DF[ , c("value1","value2") ]) <- !DF$ToKeep (I would welcome comments from cogniscenti as to whether this is actually pr

[R] auto.arima function in R

2014-11-20 Thread Akhil dua
Hello every one, I am using daily data of the flight departure. Departure Date Load (Seats booked/Capacity) 12/01/2011 10 13/01/2011 12 14/01/2011 09 I want to fit an arima model to the data

Re: [R] Bootstrap CIs for weighted means of paired differences

2014-11-20 Thread i.petzev
Hi David, sorry, I was not clear. The difference comes from defining or not defining �w� in the boot() function. The results with your function and your approach are thus: set.seed() x <- rnorm(50) y <- rnorm(50) weights <- runif(50) weights <- weights / sum(weights) dataset <- cbind(x,y,we

Re: [R] Using sapply instead of for loop

2014-11-20 Thread Amit Thombre
Thanks Charles. I will have to extract the min value from the list A by selecting the proper index. From: Charles Determan Jr [deter...@umn.edu] Sent: Wednesday, November 19, 2014 11:48 PM To: Amit Thombre Cc: r-help@r-project.org Subject: Re: [R] Using sapply ins

[R] Adapt sweave function to produce an automatic pdf.

2014-11-20 Thread Frederic Ntirenganya
Hi All, I want to make a climate method ("sweave_function"). The aim is to be able to adapt sweave code that produces an automatic pdf so that it can works for my climate object. i.e. instead of compile pdf, I call : data_obj$sweave_function() and get the pdf. for instance I have boxplot_method()

Re: [R] R - PLOT - X-AXIS - DECIMALS

2014-11-20 Thread PIKAL Petr
Hi Plot calls function pretty which calculates values for annotating axes. You can get rid of this behaviour by plot(..., axes=FALSE) and calling axis(1, ...) see ?plot ?pretty ?axis Cheers Petr > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > p