Re: [R] RPART - printing full splitting rule number on tree plot

2009-12-14 Thread Prof Brian Ripley
On Mon, 14 Dec 2009, Rebecca O'Leary wrote: Dear R-users I am using RPART package to get regression trees. However having trouble getting the text function to put the full splitting rule number on the plot, instead to puts it in scientific notation. When a covariate has 1e4 or greater

[R] problem with unmatched quotes

2009-12-14 Thread Alfredo Alessandrini
Hi, I've a problem with unmatched quotes with a bash script within a R script: system(awk 'NR2 {FS= ;print$1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12;}' phenology.txt) Errore: unexpected string constant in system(awk 'NR2 {FS= ;print$1 Alfredo __

[R] R square in NLS-urgent help

2009-12-14 Thread ruchita gupta
Hello I need one urgent help I am trying to fit the Sigmod curve of logistic growth model using NLS estimation. But i do not get the R square value in that even after getting the Summary In that case how to compare the fit for 3 models and find which one is better fit?? How to get this R Square

[R] GBM package: Extract coefficients

2009-12-14 Thread Kyle Werner
I am using the gbm package for generalized boosted regression models, and would like to be able to extract the coefficients produced for storage in a database. I am already using R to automatically generate formulas that I can export to a database and store. For example, I have been using Dr.

Re: [R] help: forest plots

2009-12-14 Thread Viechtbauer Wolfgang (STAT)
If you have the bounds of a 95% CI in the form of: exponential(estimate +/- 1.96*SE) then it is easy to get the SE back: SE = (log(UL) - log(LL)) / (2*1.96) Then supply the estimates and the SEs to the forest() function: forest(estimate, sei=SE) You can use: forest(estimate, sei=SE,

Re: [R] problem with unmatched quotes

2009-12-14 Thread Uwe Ligges
Escape the inner quotes. Uwe Ligges Alfredo Alessandrini wrote: Hi, I've a problem with unmatched quotes with a bash script within a R script: system(awk 'NR2 {FS= ;print$1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12;}' phenology.txt) Errore: unexpected string constant in system(awk 'NR2 {FS=

Re: [R] R square in NLS-urgent help

2009-12-14 Thread Peter Dalgaard
ruchita gupta wrote: Hello I need one urgent help The urgency is entirely on your part, and you are not going to get an answer more quickly by posting several times! I am trying to fit the Sigmod curve of logistic growth model using NLS estimation. But i do not get the R square value in

[R] Combinations

2009-12-14 Thread Amelia Livington
Dear R helpers,   I am working on the scenario analysis pertaining to various interest rates. In this connection I need to form the various combinations as under :   Suppose I have two sets A = (a, b, c) and B = (x,y,z)   Then I can easily form the cominations as (ax, ay, az, bx, by, bz, cx, cy,

Re: [R] Combinations

2009-12-14 Thread baptiste auguie
Hi, Try this, apply(expand.grid(letters[1:3], letters[24:26]), 1, paste,collapse=) [1] ax bx cx ay by cy az bz cz ?expand.grid HTH, baptiste 2009/12/14 Amelia Livington amelia_living...@yahoo.com: Dear R helpers, I am working on the scenario analysis pertaining to various interest rates.

[R] Why doesnot Rscript work ?

2009-12-14 Thread z_axis
%cat stock.R #! /usr/local/bin/Rscript args - commandArgs(TRUE) args x - read.csv(000301.csv) matplot(x[,1],x[,-1],type=l) #q(save=no) %Rscript stock.R 000301.csv [1] 000301.csv matplot doesnot draw anything(no drawing window). Howeve, in R, source works great! source(stock.R) Sincerely! --

Re: [R] Combinations

2009-12-14 Thread Romain Francois
On 12/14/2009 10:50 AM, baptiste auguie wrote: Hi, Try this, apply(expand.grid(letters[1:3], letters[24:26]), 1, paste,collapse=) [1] ax bx cx ay by cy az bz cz This will be faster, as it takes advantage of the vectorized paste: cpaste - function(...) paste(..., sep = ) do.call( cpaste,

Re: [R] Why doesnot Rscript work ?

2009-12-14 Thread Romain Francois
Hi, Rscript is meant for non-interactive use, so the default device is not the same as when you run R. If you really want a window, open it yourself by calling the appropriate function (X11, windows, ... ) or reset the device option to whichever device you want to use, but it will disappear

[R] R 2.10.1 is released

2009-12-14 Thread Peter Dalgaard
R-2.10.1.tar.gz was built a short while ago. This is a maintenance release and fixes a number of mostly minor issues. See the full list of changes below. You can get it from http://cran.r-project.org/src/base/R-2/R-2.10.1.tar.gz or wait for it to be mirrored at a CRAN site nearer to you.

Re: [R] Why doesnot Rscript work ?

2009-12-14 Thread Prof Brian Ripley
On Mon, 14 Dec 2009, z_axis wrote: %cat stock.R #! /usr/local/bin/Rscript args - commandArgs(TRUE) args x - read.csv(000301.csv) matplot(x[,1],x[,-1],type=l) #q(save=no) %Rscript stock.R 000301.csv [1] 000301.csv matplot doesnot draw anything(no drawing window). Incorrect: it plots on the

Re: [R] Literature analysis

2009-12-14 Thread Schwan
Dear Liviu, I have tried the Rcmdr GUI but when i load the data, there is no active data set(this is the error message i got). Can someone help me further to realize my project? Thanks On Fri, 2009-12-11 at 19:05 +, Liviu Andronic wrote: Hello On 12/11/09, Schwan

[R] lapply , mapply questions

2009-12-14 Thread Bunny, lautloscrew.com
Dear all, i have a programming problem that should be simple, though i am stuck with it. Please note that this is not a specific geonames problem, though i use it as an example - it´s just a basic problem with lapply. I use the geonames webservices with the R geonames packages which works

[R] Printing to PDF in for

2009-12-14 Thread Trafim Vanishek
Hi everybody, I would like to ask if it is possible using pdf function or some other to print plots in cycle such that every new plot is on new page. like this pdf(file=D:/Plot.pdf,width = 9.25,height=9.25, family=Helvetica,pointsize=8,bg=white) for (i in 1:10){ x - seq(1,40,1) y -

[R] Problem with coeftest using Newey West estimator

2009-12-14 Thread Bender, Marina
Hi, As I didn't get a response last week, I try it again. I want to calculate the t- and p-values for a linear model using the Newey West estimator. I tried this Code and it usually worked just fine: oberlm - lm(DYH ~ BIP + Infl + EOil, data=HU_H) coeftest(oberlm, NeweyWest(oberlm, lag=2))

Re: [R] Printing to PDF in for

2009-12-14 Thread Romain Francois
See the onefile and file arguments of ?pdf and then do something like this : pdf( file = plot-%03d.pdf, onefile = FALSE, width = 9.25, height = 9.25, family=Helvetica,pointsize=8,bg=white ) Romain On 12/14/2009 12:09 PM, Trafim Vanishek wrote: Hi everybody, I would like to ask if it is

Re: [R] Literature analysis

2009-12-14 Thread Liviu Andronic
Hello On 12/14/09, Schwan s.s.hosse...@utwente.nl wrote: I have tried the Rcmdr GUI but when i load the data, there is no active data set(this is the error message i got). Can you post the exact error message? Also, could you post a sample data file (for example, on tinyupload.com) so that

Re: [R] Problem with coeftest using Newey West estimator

2009-12-14 Thread Achim Zeileis
On Mon, 14 Dec 2009, Bender, Marina wrote: Hi, As I didn't get a response last week, I try it again. I want to calculate the t- and p-values for a linear model using the Newey West estimator. I tried this Code and it usually worked just fine: oberlm - lm(DYH ~ BIP + Infl + EOil,

Re: [R] Error with hgu133a2.db

2009-12-14 Thread Duncan Murdoch
mkna005 mkna005 wrote: Hi, I'm trying to get this library working under R2.10.0. I downloaded it and installed it from zip file. i get the following output. library(hgu133a2.db) Error in library(hgu133a2.db) : there is no package called 'hgu133a2.db' utils:::menuInstallLocal()

[R] Connect to internet

2009-12-14 Thread ehcpieterse
Hi, I have a new workstation and am in the process of moving all my work onto it. I have also installed R 2.10.0 on the new machine. I remember changing my R settings of my old machine (R 2.9.1) to connect to the internet, but I can't remember exactly how. I have tried Sys.getenv(), but it does

Re: [R] how to use Rengine instance to parse R script String

2009-12-14 Thread Gray Calhoun
Hi hobartlul, The R-devel mailing list is more appropriate for this sort of question. You'll probably get the best response there if you include your own code (that I assume is not running correctly) and ask about specific errors you're getting---I don't know that anyone has their own small,

Re: [R] Problem with coeftest using Newey West estimator

2009-12-14 Thread Bender, Marina
I give you a reproducable example from my data: ## packages library(sandwich) library(lmtest) ## data DYF - c(-0.1164, 0.1164, -0.1164, -0.1287, 0.1287, 0.4127) BIP - c(0.063, 0.039, 0.057, 0.036, 0.052, 0.033) AQ - c(-0.3, -0.9, -0.1, 0.2, 0.0, 1.4) BrInv_t - c(0.044, 0.044, 0.080, 0.042,

[R] Determining the correlation coefficient?

2009-12-14 Thread Anja Mohorko
Hello, I need your help! Probably the answer is quite easy, but still ... How can I sample two (or more) vectors of data from a normal distribution so they are correlated with an exact value I select (for example pearson's r = .30)? Thanks! James [[alternative HTML version

Re: [R] how to use Rengine instance to parse R script String

2009-12-14 Thread Romain Francois
On 12/14/2009 01:35 PM, Gray Calhoun wrote: Hi hobartlul, The R-devel mailing list is more appropriate for this sort of question. Slightly, but the one mailing list where the question actually fits is this one : http://mailman.rz.uni-augsburg.de/mailman/listinfo/stats-rosuda-devel

Re: [R] Problem with coeftest using Newey West estimator

2009-12-14 Thread Achim Zeileis
On Mon, 14 Dec 2009, Bender, Marina wrote: I give you a reproducable example from my data: One of my suspicion's was correct: too few data. You have 6 observations with which you estimate 4 regression coefficients. That's already questionable. But then, to obtain the standard errors, you

Re: [R] Determining the correlation coefficient?

2009-12-14 Thread Liviu Andronic
Hello On 12/14/09, Anja Mohorko nekostrg...@yahoo.com wrote: Hello, I need your help! Probably the answer is quite easy, but still ... How can I sample two (or more) vectors of data from a normal distribution so they are correlated with an exact value I select (for example pearson's r =

Re: [R] Literature analysis

2009-12-14 Thread Schwan
I have uploaded the csv file here: http://s000.tinyupload.com/?file_id=79349565739733953435 It contains the citations, which I generated from the bibtex file. The exact error message is: [2] ERROR: more columns than column names A screenshot of the Rcmd is located here:

[R] Calling R code from within STATA

2009-12-14 Thread tonitogomez
Dear R Users, Do you know whether is possible to call R code from within STATA and how to do it? Also, do you know whether is there any way of doing the other way round, i.e. calling STATA from within R (possibly in a similar way that is possible to call WinBUGS from within R using the

Re: [R] rpart - classification and regression trees (CART)

2009-12-14 Thread Terry Therneau
When two variables have exactly the same figure of merit, they will be listed in the output in the same order in which they appeared in your model statement. Terry Therneau -- begin inclusion --- I had a question regarding the rpart command in R. I used seven continuous predictor variables

Re: [R] Non-linear Weibull model for aggregated parasite data

2009-12-14 Thread Terry Therneau
I am trying to fit a non-linear model for a parasite dataset. Initially, I ... The survreg() function will fit a weibull distribution. It has the further ability to include censored data, a facility you don't need. library(survival) fit - survreg(Surv(coccidiaopg) ~ age + year +

Re: [R] Literature analysis

2009-12-14 Thread Erich Neuwirth
The screenshot shows your error. Just have a look at the error message in the bottom part of the window. Your csv file has more columns than column names. On Dec 14, 2009, at 2:42 PM, Schwan wrote: I have uploaded the csv file here: http://s000.tinyupload.com/?file_id=79349565739733953435

Re: [R] Literature analysis

2009-12-14 Thread Liviu Andronic
On 12/14/09, Schwan s.s.hosse...@utwente.nl wrote: [2] ERROR: more columns than column names I looked at the data and there is a column name called ISBN#. Try to remove # and then import the data. Liviu __ R-help@r-project.org mailing list

Re: [R] Literature analysis

2009-12-14 Thread Romain Francois
Hello, Sorry to arrive late on this. Did you try the recently uploaded bibtex package. It reads a bibtex file into an R list (of class citationList). So for example : if your posted example lives in biblio.bib for example, you can read it like this : bib - read.bib( biblio.bib ) sapply(

[R] Bug in lnme package?

2009-12-14 Thread Pieter Deleu
Hi! Something funny happens to me in lnme. I don't know if it's a bug or not. Here's a short sketch of the problem (you could skip the introduction and just go to the models): I'm counting the number of spider webs ( = response variable) along two rivers, with a two-level treatment: free-flowing

Re: [R] rpart - classification and regression trees (CART)

2009-12-14 Thread Katie N
Actually, that's the first thing I thought too, but they weren't listed in that order in my model statement (model that I used is below): fit=rpart(pres ~ TB144 + TB118 + TB129 + TB139 + TB114 + TB131 + TB122, method=class, data=data8) Would the selection of the best split when improvement is

[R] write.csv and header

2009-12-14 Thread Walther, Alexander
Dear list, I would like to export a matrix to a TXT-File by using write.csv (not necessarily). Is there a way to add a header (with additional informations concerning the project) spanning multiple lines to this file before the actual data are listed up? Should look like this: date: filename:

Re: [R] odfWeave produces output file that OO can't open

2009-12-14 Thread Max Kuhn
Can you: - run any of the examples in the package's examples directory - provide the results of sessionInfo() - tell us what version of OO - read the posting guide? Max On Sun, Dec 13, 2009 at 2:17 PM, Michael Kubovy kub...@virginia.edu wrote: Dear R-helpers, I'm trying to learn how

Re: [R] Bug in lnme package?

2009-12-14 Thread ONKELINX, Thierry
Dear Pieter, I suppose that you have attached your data.frame and then messed up the Distance variable. Therefore do not use attach(your.data.frame) but use the data = your.data.frame argument in your models. If that does not solve the problem, then send us a reproducible example of your problem

[R] R output

2009-12-14 Thread Manuel Jesús López Rodríguez
Dear all, I would like to ask you if exists some way of having the results of an R instruction (for instance, summary) in a table to copy it directly in Excel. Thank you very much in advance. Best wishes! Manuel __ R-help@r-project.org mailing list

[R] Odp: R square in NLS-urgent help

2009-12-14 Thread Petr PIKAL
Hi I believe it was answered several times and if I remember correctly R squared in nonlinear models is not so simple (from statistical point of wiev). Here you have some insights from help archive, which you could probably get as easy as myself if you had used search facilities offered to you

Re: [R] Repeated Measures Analysis - GLM

2009-12-14 Thread Michael Friendly
To follow up on John's advice: Start with something like my.mod - lm(cbind(OpenR1, OpenR2, OpenR3) ~ AgeClass * Treatment, data=my.data) then read ?Anova to see how to specify idata= and idesign= for the repeated factor. hth, -Michael John Fox wrote: Dear Ingo, One approach would be to

Re: [R] write.csv and header

2009-12-14 Thread Patrick Hausmann
Hi Alex, try this mfile - c:\\ex01.txt nperm - 12 sDate - paste(date: , 2009-12-13, sep=) sFile - paste(filename: , mfile, sep=) sPerm - paste(number of permutations: , nperm, sep=) mt - matrix(1:10, 2) sink(mfile) cat(sDate, \n) cat(sFile, \n) cat(sPerm, \n)

Re: [R] shared axes in multipanel plot

2009-12-14 Thread Jennifer Young
splendid! This worked well, but there are two oddities that I can't resolve. 1. In the real data, the baseline is a cumulative probability plot (from simulations) rather than the straight line. The panel.lines plots this curve, but seems to join the first and last points together.

Re: [R] Literature analysis

2009-12-14 Thread Liviu Andronic
On 12/14/09, Schwan s.s.hosse...@utwente.nl wrote: but unfortunately somehow the package bibtex dont want to install (actually it installs, but if i follow your instruction: bib - read.bib( /home/schwan/Desktop/science.bib ) I got an Error Message which says: Error: could not find

[R] Odp: R output

2009-12-14 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 14.12.2009 17:09:55: Dear all, I would like to ask you if exists some way of having the results of an R instruction (for instance, summary) in a table to copy it directly in Excel. What do you mean directly in Excel. If the output is structured

Re: [R] extracting vectors from lists of lists

2009-12-14 Thread Jennifer Young
This is just the thing. The former version I would never have guessed, but the function(x) version is much more intuitive. Does there exist some section of some manual where these sorts of things are explained? I find that figuring out how to access parts of output is the trickiest thing in R.

Re: [R] Literature analysis

2009-12-14 Thread Schwan
Thanks, but unfortunately somehow the package bibtex dont want to install (actually it installs, but if i follow your instruction: bib - read.bib( /home/schwan/Desktop/science.bib ) I got an Error Message which says: Error: could not find function read.bib I already installed the package as

[R] ggplot : scale_x_datetime issues

2009-12-14 Thread ravi
Dear R users, My immediate problem is that I do not seem to understand how to use the function scale_x_datetime function in ggplot. My deeper problem is that I don’t understand the use of the POSIXct class.   My data looks like like the following : T  val 2009-11-04 23:59:57   972.357117 

Re: [R] Determining the correlation coefficient?

2009-12-14 Thread Ravi Varadhan
If you want the samples to have exact correlation that you have specified, then you must specify the `empirical=TRUE' option: mvrnorm(n=1000, rep(0, 2), Sigma, empirical=TRUE) Ravi. Ravi Varadhan, Ph.D. Assistant Professor,

Re: [R] Bug in lnme package?

2009-12-14 Thread Ben Bolker
Pieter Deleu pieterdeleu at gmail.com writes: Hi! Something funny happens to me in lnme. I don't know if it's a bug or not. Here's a short sketch of the problem (you could skip the introduction and just go to the models): I'm counting the number of spider webs ( = response variable)

Re: [R] R output

2009-12-14 Thread stephen sefick
?write.table() 2009/12/14 Manuel Jesús López Rodríguez mjlr1...@yahoo.es: Dear all, I would like to ask you if exists some way of having the results of an R instruction (for instance, summary) in a table to copy it directly in Excel. Thank you very much in advance. Best wishes! Manuel

Re: [R] how can generate from trunceted gamma distribution in R ?

2009-12-14 Thread Peter Ruckdeschel
Duncan Murdoch wrote: On 11/12/2009 7:12 AM, khaz...@ceremade.dauphine.fr wrote: Hi, all How can generate a sample from truncated inverse gamma distribution in R? Using the inverse CDF method or rejection sampling are possible, depending on what your truncation is like. If your

[R] Problems loading RMySQL

2009-12-14 Thread Azeez
Hi! I have installed MySQL, DBI RODBC with any problems. I installed MySQL 5.0 everything went fine. Since the second time I tried loading RMySQL I have been receiving this error message: library(RMySQL) Error in if (utils::file_test(-d, MySQLhome)) break : Argument hat Länge 0 Error :

[R] hdf5 package

2009-12-14 Thread jgarcia
Hi all, I'm testing the use of the hdf5 R library under Windows XP. With some simple example (an R list with several subobjects as showed in the examples in the library) the library exports and imports .hdf files adequately. However, if I try to open the exported file with another program

Re: [R] shared axes in multipanel plot

2009-12-14 Thread Gabor Grothendieck
On Mon, Dec 14, 2009 at 11:30 AM, Jennifer Young jennifer.yo...@math.mcmaster.ca wrote: splendid! This worked well, but there are two oddities that I can't resolve. 1. In the real data, the baseline is a cumulative probability plot (from simulations) rather than the straight line.  The

Re: [R] hdf5 package

2009-12-14 Thread Prof Brian Ripley
On Mon, 14 Dec 2009, jgar...@ija.csic.es wrote: Hi all, I'm testing the use of the hdf5 R library under Windows XP. With some simple example (an R list with several subobjects as showed in the examples in the library) the library exports and imports .hdf files adequately. However, if I try to

Re: [R] shared axes in multipanel plot

2009-12-14 Thread Jennifer Young
On Mon, Dec 14, 2009 at 11:30 AM, Jennifer Young jennifer.yo...@math.mcmaster.ca wrote: splendid! This worked well, but there are two oddities that I can't resolve. 1. In the real data, the baseline is a cumulative probability plot (from simulations) rather than the straight line.  The

[R] Logit Estimation with Panel Data

2009-12-14 Thread Moysés Nascimento
Hi all! Do you know if there is any R function/package that can be used to estimate logit models with panel data and forecasting? Thanks, Moysés. -- Moysés Nascimento Bacharel em Estatística/UFES Mestre em Estatística Aplicada e Biometria/UFV Doutorando em Estatística e Experimentação

Re: [R] shared axes in multipanel plot

2009-12-14 Thread Gabor Grothendieck
Try this: You seem to have found a problem. At any rate try this instead: pnl - function(x, y, ...) { tt - time(z) y - matrix(y, length(tt)) for(j in 1:ncol(y)) panel.plot.default(tt, y[,j], ...) panel.lines(tt, baseline, lwd = 2, col = grey(0.5)) panel.lines(tt, b2) } On Mon,

Re: [R] shared axes in multipanel plot

2009-12-14 Thread Gabor Grothendieck
One resolution of the need to go outside of pnl would be to use this line: tt - unique(x) in place of tt - time(z). That would overcome the objection that the pnl function is not self contained. On Mon, Dec 14, 2009 at 3:44 PM, Gabor Grothendieck ggrothendi...@gmail.com wrote: Try this: You

Re: [R] A random number from any distribution?þ

2009-12-14 Thread Bert Gunter
Sounds like the poster might be interested in bootstrap sampling ... As usual, what's the question of interest? Bert Gunter Genentech Nonclinical Biostatistics -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Greg Snow Sent:

Re: [R] Logit Estimation with Panel Data

2009-12-14 Thread Gray Calhoun
RSiteSearch(logit panel) and RSiteSearch(logit longitudinal) will turn up some results, including task views. So... yes. --Gray On Mon, Dec 14, 2009 at 2:44 PM, Moysés Nascimento moysesnas...@gmail.com wrote: Hi all! Do you know if there is any R function/package that can be used to estimate

Re: [R] debug an error that incapacitates R?

2009-12-14 Thread Brian Diggs
-Original Message- From: Liviu Andronic [mailto:landronim...@gmail.com] Sent: Sunday, December 13, 2009 4:05 AM To: Duncan Murdoch Cc: r-help@r-project.org Help Subject: Re: [R] debug an error that incapacitates R? Hello And thank you for the quick answer. On 12/13/09, Duncan

[R] Creating a string

2009-12-14 Thread Tom Pitt
Hi All, Thanks for your help. I want to add a letter x and a number to a string like x1. How do I do that? Thanks, Tom -- View this message in context: http://n4.nabble.com/Creating-a-string-tp963915p963915.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] debug an error that incapacitates R?

2009-12-14 Thread Rolf Turner
Wouldn't sink.number() give you a handle on whether the problem is that there is an invalid sink() in effect? On 15/12/2009, at 10:55 AM, Brian Diggs wrote: -Original Message- From: Liviu Andronic [mailto:landronim...@gmail.com] Sent: Sunday, December 13, 2009 4:05 AM To: Duncan

Re: [R] shared axes in multipanel plot

2009-12-14 Thread Jennifer Young
Ah, I think i see the problem. The default plot recognizes there is one set of x for each set of y, but since there were two vectors in the default.plot, the x vector is repeated and loops around for the lines part. Presumably the default plot uses your recursive plot automatically. At any rate,

Re: [R] A random number from any distribution?þ

2009-12-14 Thread ivan popivanov
:) I might be trying to do something stupid so let me try again: 1) I have a large sample - daily percentage movement for a stock 2) I want to generate a synthetic stock which has daily movements from the same distribution as the original The solution I was planning to implement (following the

Re: [R] debug an error that incapacitates R?

2009-12-14 Thread Brian Diggs
-Original Message- From: Rolf Turner [mailto:r.tur...@auckland.ac.nz] Sent: Monday, December 14, 2009 2:07 PM To: Brian Diggs Cc: r-help@r-project.org Help Subject: Re: [R] debug an error that incapacitates R? Wouldn't sink.number() give you a handle on whether the problem is

[R] fast matrix-vector multiplication

2009-12-14 Thread parkbomee
Hi all, Is there a way to do a matrix multiplication in a faster way? I am making a product of a matrix (composed of a lot of dummy variables) and a vector, and is there any way to make it faster? The simple X %*% y takes too long a time. I know using sparse matrix would help, but don't

Re: [R] shared axes in multipanel plot

2009-12-14 Thread Felix Andrews
I think the basic problem is that you are bringing in new data from outside the xyplot() call -- i.e `b2` and `baseline` -- and are then trying to plot that against the panel argument `x`. This is asking for trouble, as you have found, because `x` as passed to the panel function is modified by

Re: [R] A random number from any distribution?þ

2009-12-14 Thread Bert Gunter
Questionable. Doesn't this implicitly assumes that the log(stock prices) form an AR(1) series? If so, is this reasonable? And what about the occasional shocks? Appropriate simulation of time series like stock prices is a tricky business, I believe. I would question whether your naïve approach

Re: [R] shared axes in multipanel plot

2009-12-14 Thread Gabor Grothendieck
Good observation. In fact, panel.plot.default works because it uses the subscripts and groups variables which are passed down to the panel function and if not explicitly referenced in the formal argument list of pnl are passed via ... thus we could use any of these equivalent pnl functions though

Re: [R] MLE for a t distribution

2009-12-14 Thread Kjetil Halvorsen
Brian Ripley sometimes on this list or elsewhere suggested to reparametrize as 1/k. I have used that with good results. But you should be aware that usually data contains very little information about k, so thhat if you do not have a lot more than 100 observations you coukld be out of luck. You

[R] R2 in lm function

2009-12-14 Thread Tom Pitt
Hi All, After I run the lm function, where (which variable) do I find my R-squared for further calculations? Thanks, Tom -- View this message in context: http://n4.nabble.com/R2-in-lm-function-tp963958p963958.html Sent from the R help mailing list archive at Nabble.com.

[R] Loop counter used in variable

2009-12-14 Thread Tom Pitt
Hi All, I need to run muliple lm functions. My independent variables are called dataset$x1, x2, x3, x4 etc. How can I use a loop counter variable to replace the numbers? fit1=lm(dataset$y~dataset$x1) fit2=lm(dataset$y~dataset$x2) fit3=lm(dataset$y~dataset$x3) fit4=lm(dataset$y~dataset$x4)

Re: [R] R2 in lm function

2009-12-14 Thread Jorge Ivan Velez
Hi Tom, Take a look at the following taken/modified from ?lm: ctl - c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14) trt - c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69) group - gl(2,10,20, labels=c(Ctl,Trt)) weight - c(ctl, trt) lm.D9 - lm(weight ~ group) slm - summary(lm.D9) str(slm)

Re: [R] fast matrix-vector multiplication

2009-12-14 Thread Gray Calhoun
Check out crossprod and the Matrix package (capitalized); there's also a discussion of their speed gains in the R newsletter that should turn up with a search and in the vignette as well. -Gray On Monday, December 14, 2009, parkbomee bbom...@hotmail.com wrote: Hi all, Is there a way to

[R] Help in R

2009-12-14 Thread li li
Hello, Can anyone give me some suggestion in term of calculating the sum below. Is there a function in R that can help doing it faster? x1, x2, ...xn where xi can be 0 or 1. I want to calculate the following: sum{ beta[a+sum(xi), b+n-sum(xi) ]* [ (1-x1)dnorm(0,1)+x1dnorm(2,1) ]* [

[R] Is there lazy copy in R?

2009-12-14 Thread Peng Yu
I'm wondering if lazy copy is available in R or not. For example, in the following code, I'm wondering if the memory for y is allocated in the 2nd line or the 3rd line. Is there a documentation for this? x=1:1 y=x y[[10]]=5 __ R-help@r-project.org

Re: [R] lapply , mapply questions

2009-12-14 Thread Michael Denslow
Hi Matt, On Mon, Dec 14, 2009 at 5:49 AM, Bunny, lautloscrew.com bu...@lautloscrew.com wrote: Dear all, i have a programming problem that should be simple, though i am stuck with it. Please note that this is not a specific geonames problem, though i use it as an example - it愀 just a basic

Re: [R] Is there lazy copy in R?

2009-12-14 Thread Benilton Carvalho
use tracemem() to figure out... and read its documentation in detail. b On Dec 15, 2009, at 1:03 AM, Peng Yu wrote: I'm wondering if lazy copy is available in R or not. For example, in the following code, I'm wondering if the memory for y is allocated in the 2nd line or the 3rd line. Is

Re: [R] Is there lazy copy in R?

2009-12-14 Thread Peng Yu
a=1:10 b=a a=1:10 tracemem(a)# I assume the following is address 'a' points to [1] 0x05cf2798 b=a b[1]=1 tracemem[0x05cf2798 - 0x05cf2750]: tracemem[0x05cf2750 - 0x05ed8ba0]: I don't understand what these addresses mean. Would you please help me understand it? On Mon, Dec 14, 2009 at 9:23

Re: [R] Is there lazy copy in R?

2009-12-14 Thread hadley wickham
I don't understand what these addresses mean. Would you please help me understand it? Did you try reading the documentation? When an object is traced any copying of the object by the C function ‘duplicate’ or by arithmetic or mathematical operations produces a message to

[R] Diagonal Labels on Beside Bars in Barplot

2009-12-14 Thread Jason Rupert
My question is based on an example provided in the following: Referencing: Statistics with R Vincent Zoonekynd zoo...@math.jussieu.fr 6th January 2007 URL: http://zoonek2.free.fr/UNIX/48_R/all.html data(HairEyeColor) a - as.table( apply(HairEyeColor, c(1,2), sum) ) # Provided Example

Re: [R] Is there lazy copy in R?

2009-12-14 Thread Linlin Yan
It means that R does have the lazy copy mechanism, which I didn't know, and I think it can be very useful to make R running more quickly. On Tue, Dec 15, 2009 at 12:15 PM, Peng Yu pengyu...@gmail.com wrote: a=1:10 b=a a=1:10 tracemem(a)# I assume the following is address 'a' points to [1]

[R] Supressing Scientific Notation

2009-12-14 Thread Anderson, Chris
I'm trying to display my deciles without scientific notation, but have not found an option that will allow me to do so. According to web searches, the options(scipen=999) should remove scientific notation, but it seems not too. Does this option work with quantcut function? Is there any other

Re: [R] Supressing Scientific Notation

2009-12-14 Thread Daniel Malter
Example: x=rnorm(1000) terc.cut.x=cut(x,breaks=quantile(x,probs=c(0,1/3,2/3,1)),labels=c(L,M,H ),include.lowest=T) HTH, Daniel - cuncta stricte discussurus - -Original Message- From: r-help-boun...@r-project.org

Re: [R] fast matrix-vector multiplication

2009-12-14 Thread Martin Maechler
GC == Gray Calhoun gray.calh...@gmail.com on Mon, 14 Dec 2009 19:26:44 -0600 writes: GC Check out crossprod and the Matrix package (capitalized); there's also GC a discussion of their speed gains in the R newsletter that should turn GC up with a search and in the vignette as