Re: [R] Curve fitting, probably splines

2012-04-16 Thread Simon Wood
You could use the summation convention built into mgcv:gam for this. See ?linear.functional.terms for details, but here is some example code, both for the exact match, you describe, and a noisy version. best, Simon library(mgcv) f2 <- function(x) 0.2*x^11*(10*(1-x))^6+10*(10*x)^3*(1-x)^10 ## te

Re: [R] Question with R CMD SHLIB in 64 bit R

2012-04-16 Thread Uwe Ligges
You may want to send the files as well as what you exactly typed in the shell in a private message. Uwe Ligges On 15.04.2012 20:09, Katharine Miller wrote: Yes. I have version 2.15.0 of Rtools as well. I went ahead and re-installed both R and Rtools just to make sure everything was OK. But

[R] cairo_pdf() vs. pdf() what is the difference?

2012-04-16 Thread Jonas Stein
cairo_pdf() vs. pdf() what is the difference between them and which one would you suggest to use in combination with pdflatex? kind regards, -- Jonas Stein __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do r

Re: [R] cairo_pdf() vs. pdf() what is the difference?

2012-04-16 Thread Prof Brian Ripley
On 15/04/2012 20:45, Jonas Stein wrote: cairo_pdf() vs. pdf() what is the difference between them and which one would you suggest to use in combination with pdflatex? Well, the help tells you, so please read it. E.g. Note that unlike ‘postscript’ and ‘pdf’, ‘cairo_pdf’ and ‘cairo_ps’

[R] COURSE: Introduction to Bayesian Data Analysis using WinBUGS and R, 21-23 Juni 2012

2012-04-16 Thread Dr. Pablo E. Verde
Dear list members, Apologies for cross-posting. Please, find below the information of an introductory Bayesian Data Analysis course with WinBUGS and R. If you have any question don't hesitate to contact me. Best regards, Pablo ++ Course:

[R] Database connectivity

2012-04-16 Thread Partha Sinha
Dear All please let me know how to connect SQL server from R? which all packages I will require for this? Thanks Parth __ 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

Re: [R] Database connectivity

2012-04-16 Thread andrija djurovic
RODBC On Mon, Apr 16, 2012 at 11:40 AM, Partha Sinha wrote: > Dear All > please let me know how to connect SQL server from R? which all > packages I will require for this? > Thanks > Parth > > __ > R-help@r-project.org mailing list > https://stat.ethz.c

[R] Installation of R 2.15.0

2012-04-16 Thread Partha Sinha
I want to install R 2.15.0 without uninstalling R 2.13 (currently using ). if I install can upgrade take place or we will install two instances of R? Parth __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read t

Re: [R] Installation of R 2.15.0

2012-04-16 Thread ya
Hi Partha, two different R version can coexist together, in the same "R" folder. YA On 2012-4-16 13:44, Partha Sinha wrote: I want to install R 2.15.0 without uninstalling R 2.13 (currently using ). if I install can upgrade take place or we will install two instances of R? Parth

[R] system2 and cspade on Windows

2012-04-16 Thread Shahin Saneinejad
Hi, I'm using the cspade function of the arulesSequences package. Running example(cspade), I'm getting the error: preprocessing ... Error in file(con, "r") : cannot open the connection In addition: Warning message: In file(con, "r") : cannot open file '[...]\cspade1ebc3787780c.log': No such f

Re: [R] for help

2012-04-16 Thread osvald wiklander
Hi, we have a problem concerning the use and forecasting on the GARCH (1, 1) on financial data. We would like to make predictions on future returns in a loop which moves the window of estimation forward one unit for each iteration. Our code is as follows: > BJORN <- read.table("C:/Users/Osvald/De

Re: [R] Cbind help

2012-04-16 Thread Osvald Wiklander
Hi, we have a problem concerning the use and forecasting on the GARCH (1, 1) on financial data. We would like to make predictions on future returns in a loop which moves the window of estimation forward one unit for each iteration. Our code is as follows: > BJORN <- read.table("C:/Users/Osvald

[R] How to create a data.frame from several time series?

2012-04-16 Thread Robert Latest
Hello all, please look at my code below. The problems start where it says # PROBLEMS START HERE. Some sample data is at the very bottom. This is the disgnostic output from the script: > source('load.R') ts.null 1 NA 2 NA 3 NA 4 NA 5 NA 6 NA [1] "Adding data" "VS1A

Re: [R] Seemingly simple "lm" giving unexpected results

2012-04-16 Thread Gene Leynes
Peter, This is exactly the answer I was wanted. 1) I was a little fuzzy on how the qr decomposition was creating the "error" 2) I wanted to know if it was possible to just change a setting to get around the "error". Changing the tol in lm makes a lot more sense to me than changing the global eps

[R] Attachment

2012-04-16 Thread osvald wiklander
Btw, in the earlier mail i forgot to mention what the error message was. The R console tells us that: "Error in matrix(0, ncoef, ncoef) : invalid 'nrow' value (too large or NA)" before it has done any estimations. i couldnt attach the data in the mail, so i write it manually in text. Datum Kurs 2

[R] Importing data from stata.

2012-04-16 Thread Søren Andersen
Hi everyone! I am very new at R. I am trying to import a data file from stata to R on a Macintosh system ? When I use the foreign function read.dta it says: Error: could not find function "read.dta" p [[alternative HTML version deleted]]

Re: [R] Compiling graphics into the same PDF file

2012-04-16 Thread Ista Zahn
Hi, Please read the Sweave documentation. A good starting place is http://www.statistik.lmu.de/~leisch/Sweave/Sweave-manual.pdf -- there you will learn to use fig=TRUE and many other useful things. Best, Ista On Mon, Apr 16, 2012 at 12:37 AM, damiloveu wrote: > I am new to R and RStudio.  I am

Re: [R] Kaplan Meier analysis: 95% CI wider in R than in SAS

2012-04-16 Thread Enrico Colosimo
What are the significant problems of the log-log transformations? Any papers published about it? Enrico. 2012/4/14 Frank Harrell > I used log-log in my book too until Terry Therneau alerted me to the > significant problems this creates. In the 2nd edition it will use log > S(t). > Frank > > Pa

[R] automatically scan multiple starting values

2012-04-16 Thread Joachim Audenaert
Hi all, I am doing nls regression of the Rogers type III equation. However I can't find good starting values and keep getting the error messages: "Missing value or an infinity produced when evaluating the model" OR "singular gradient matrix at initial parameter estimates" Is there a way to auto

Re: [R] Kaplan Meier analysis: 95% CI wider in R than in SAS

2012-04-16 Thread Frank Harrell
Just generate some data where the estimated survival probability is 0. at a certain time. The log-log transformation blows up. Frank Enrico Colosimo wrote > > What are the significant problems of the log-log transformations? > Any papers published about it? > Enrico. > > > 2012/4/14 Frank

Re: [R] Importing data from stata.

2012-04-16 Thread Uwe Ligges
On 16.04.2012 12:56, Søren Andersen wrote: Hi everyone! I am very new at R. I am trying to import a data file from stata to R on a Macintosh system ? When I use the foreign function read.dta it says: You forgot to load foreign: library("foreign") Uwe Ligges Error: could not f

Re: [R] Censoring data

2012-04-16 Thread Terry Therneau
On 04/14/2012 05:00 AM, r-help-requ...@r-project.org wrote: Hello, ?I want to estimate weibull parameters with 30% censored data. I have below the code for the censoring ?but how it must be put into the likelihood equation to obtain the desire estimate is where i have a problem with, ?can some

Re: [R] Approximately how big is an installation of all packages.

2012-04-16 Thread Uwe Ligges
On 16.04.2012 00:16, Keith Weintraub wrote: Folks, If you know the answer great. If you can tell me which command to use to find out that information please let me know. If this is the wrong forum, my apologies. What is your definition of all packages? If you mean almost all CRAN and Bi

Re: [R] Problems loading siar package

2012-04-16 Thread Uwe Ligges
On 16.04.2012 01:36, Gary Roemer wrote: PS The version of "siar" on my old computer is 4.0, the new version is 4.1.3 - could the latter be corrupt? Try to reinstall both mvtnorm and siar from sources again. Looks lie your mvtnorm installation is broken. Uwe Ligges Thanks, Gary -- V

Re: [R] Installation of R 2.15.0

2012-04-16 Thread R. Michael Weylandt
Certainly in theory, though the CRAN installers might over-write the old version automatically. [I'm pretty sure they do for mac, don't know about Windows] The way to ensure both versions remain will depend on the OP's unstated OS. Michael On Mon, Apr 16, 2012 at 6:57 AM, ya wrote: > Hi Partha,

Re: [R] Kaplan Meier analysis: 95% CI wider in R than in SAS

2012-04-16 Thread Terry Therneau
On 04/14/2012 05:00 AM, r-help-requ...@r-project.org wrote: Am replicating in R an analysis I did earlier using SAS. See this as a test of whether I'm ready to start using R in my day-to-day work. ? Just finished replicating a Kaplan Meier analysis. Everything seems to work out fine except for

Re: [R] Problems loading siar package

2012-04-16 Thread Gary Roemer
Thanks Uwe, I'll give it a whirl. Best, Gary Gary Roemer Associate Professor Dept. Fish, Wildlife & Conservation Ecology New Mexico State University Las Cruces, NM 88003 Off: 575-646-3394 Fax:575-646-1281 groe...@nmsu.edu http://web.nmsu.edu/~groemer/ On Apr 16, 2012,

Re: [R] Approximately how big is an installation of all packages.

2012-04-16 Thread Keith Weintraub
Can you tell me the size of those 3 packages separately? That is CRAN, BioC software, BioC data. If you can only give me CRAN vs the rest that's fine too. Whatever is easiest. Thanks, KW -- On Apr 16, 2012, at 9:12 AM, Uwe Ligges wrote: > > > On 16.04.2012 00:16, Keith Weintraub wrote: >> F

[R] Effeciently sum 3d table

2012-04-16 Thread David A Vavra
I have a large number of 3d tables that I wish to sum Is there an efficient way to do this? Or perhaps a function I can call? I tried using do.call("sum",listoftables) but that returns a single value. So far, it seems only a loop will do the job. TIA, DAV _

[R] ggplot2: scale_shape_manual

2012-04-16 Thread Brian Smith
Hi, I was trying to replicate one of the graphs given on the ggplot2 website. I have given a sample code below. I would like to combine the legends, since each color is uniquely mapped to a shape. ### library(ggplot2) leaves <- letters[1:8] mat <- matrix(sample(1:1000,32),nrow=16,nco

[R] packages install dependencies

2012-04-16 Thread mail.bioinfo
Hello R-Members I have to install several R packages on a Unix server which doesn't have internet connection. I downloaded some packages manually and I installed it from source using the command R CMD INSTALL and it's work but in some cases I can't install the package because of the depende

[R] apply() and sample()

2012-04-16 Thread Patrick Presi
Hi All, I am developing an epidemiological model at animal level. > head(all.herds) ID herd age status status2 dry dry.per pasture id 1 11 3 s s lac 4 1 1 2 21 8 s s lac 4 1 2 3 31 30 s s lac 4 1 3 4 4

Re: [R] Compiling graphics into the same PDF file

2012-04-16 Thread damiloveu
Thanks, Ista. I inserted fig=TRUE to the chunk and it did work. However, it generated each plot into separate files in the directory as well. I have much more to learn soon. Wuyi -- View this message in context: http://r.789695.n4.nabble.com/Compiling-graphics-into-the-same-PDF-file-tp456058

Re: [R] Help - Importing data from txt and xlsx files

2012-04-16 Thread AMFTom
Hi all, it turns out I had left absent data as a blank space instead of filling it with a zero. Now I am able to import data. Thanks for all your help, I'm sure I will be calling on your expertise in future. Tom -- View this message in context: http://r.789695.n4.nabble.com/Help-Importing-data

Re: [R] Kaplan Meier analysis: 95% CI wider in R than in SAS

2012-04-16 Thread Enrico Colosimo
But it is very very unlikely to have a time with survival probability of 0. in a real data set. It would be necessary huge data set. A Monte Carlo simulation could put a little more light in this issue? 2012/4/16 Frank Harrell > Just generate some data where the estimated survival probabilit

[R] Survival Curves

2012-04-16 Thread robgriffin247
Hello I'm trying to make survival curves for some longevity data - 100 males and 100 females, some of which are still living (not dead at the end of survey) I would like to make sex specific survival curves as time on the X axis, proportion alive on the Y, and a line for each sex (two lines) Dat

Re: [R] Seemingly simple "lm" giving unexpected results

2012-04-16 Thread William Dunlap
Instead of changing the tolerance of the qr decomposition you could use poly(x1,df=1) to center and scale x1. The coefficients will be different but the predictions will be fine (because the centering and scaling information is stored in the fitted model as the "predvars" attribute of the terms co

Re: [R] Compiling graphics into the same PDF file

2012-04-16 Thread Yihui Xie
Just FYI: if you use the knitr package (http://yihui.name/knitr/demo/rstudio/), you do not need fig=TRUE; knitr will not create Rplots.pdf either. For the plot files, I do not understand why they should not be generated -- how is LaTeX supposed to insert them into the final PDF output if they are

Re: [R] Effeciently sum 3d table

2012-04-16 Thread Petr Savicky
On Mon, Apr 16, 2012 at 10:28:43AM -0400, David A Vavra wrote: > I have a large number of 3d tables that I wish to sum > Is there an efficient way to do this? Or perhaps a function I can call? > > I tried using do.call("sum",listoftables) but that returns a single value. > > So far, it seems onl

[R] How to adjust the distance between legend and the plot (xyplot)

2012-04-16 Thread Jun Shen
Dear list, As the title indicates if I draw the legend outside of the plot, how do I adjust the distance between the legend and the plot? The default setting is too close. Thanks. Here is the sample code I have == xyplot(1~1,key=list(space=

Re: [R] Survival Curves

2012-04-16 Thread David Winsemius
On Apr 16, 2012, at 10:24 AM, robgriffin247 wrote: Hello I'm trying to make survival curves for some longevity data - 100 males and 100 females, some of which are still living (not dead at the end of survey) I would like to make sex specific survival curves as time on the X axis, proport

Re: [R] How to adjust the distance between legend and the plot (xyplot)

2012-04-16 Thread David Winsemius
On Apr 16, 2012, at 11:43 AM, Jun Shen wrote: Dear list, As the title indicates if I draw the legend outside of the plot, how do I adjust the distance between the legend and the plot? The default setting is too close. Thanks. From the help page: "just A character or numeric vector of l

Re: [R] Effeciently sum 3d table

2012-04-16 Thread Greg Snow
Look at the Reduce function. On Mon, Apr 16, 2012 at 8:28 AM, David A Vavra wrote: > I have a large number of 3d tables that I wish to sum > Is there an efficient way to do this? Or perhaps a function I can call? > > I tried using do.call("sum",listoftables) but that returns a single value. > > S

Re: [R] Coding columns for survival analysis

2012-04-16 Thread Alexander Shenkin
Jim, This was very helpful - thank you! I really like the use of diff and cumsum - those haven't been in my toolkit until now. Your solution came close, but I needed to keep "NAs" when the tree hadn't been found yet, or when it had already died. So, for posterity, here's the code I ended up wit

[R] warning message: coxme with package multcomp

2012-04-16 Thread Simon Tragust
Hi I'm encountering an error/warning when doing multiple comparisons with the package multcomp on a coxme model. My data: I'm looking at the removal of brood from the nest according to three treatments I applied on the brood. The brood and the workers caring about the brood in the nest, belong

Re: [R] Effeciently sum 3d table

2012-04-16 Thread Bert Gunter
Define "sum" . Do you mean you want to get a single sum for each array? -- get marginal sums for each array? -- get a single array in which each value is the sum of all the individual values at the position? Due thought and consideration for those trying to help by formulating your query carefully

[R] formatting sub-second intervals

2012-04-16 Thread Gene Leynes
I would like to suggest that there is some documentation missing from strptime. There appears to be a way to show second decimals by using "%OS4" (change the number to get more or less decimals), but it's not mentioned anywhere that I can find. After a long time searching and experimenting I fina

Re: [R] Approximately how big is an installation of all packages.

2012-04-16 Thread Uwe Ligges
On 16.04.2012 16:16, Keith Weintraub wrote: Can you tell me the size of those 3 packages separately? These are 5000 packages. If you want to kniow, why don't you try out? I have them in one library only. Uwe Ligges That is CRAN, BioC software, BioC data. If you can only give me CRAN vs

Re: [R] packages install dependencies

2012-04-16 Thread Uwe Ligges
On 16.04.2012 15:41, mail.bioi...@fr.netgrs.com wrote: Hello R-Members I have to install several R packages on a Unix server which doesn't have internet connection. I downloaded some packages manually and I installed it from source using the command R CMD INSTALL and it's work but in some

[R] system command to a specific shell (bash)

2012-04-16 Thread Justin Haynes
I need to run a bash command, but when you call system() the default shell is sh (see my sessionInfo below). I found the shell command ( http://www.stat.ucl.ac.be/ISdidactique/Rhelp/library/base/html/shell.html) but it seems to be disappeared in current versions of R? I am running all this from R C

Re: [R] Approximately how big is an installation of all packages.

2012-04-16 Thread Prof Brian Ripley
Note that the answer also depends on the platform (Uwe probably has two archs on Windows and no debug info in his DLLs), whether you byte-compile the packages, the optimization flags you use when compiling CRAN is around 3 - 4GB depending on the platform. Specifically, 3.5GB for x86_64

Re: [R] Cluster Analysis

2012-04-16 Thread David L Carlson
At the R command prompt ?kmeans (for info on the R equivalent to FASTCLUS) ?hclust (for info on the R equivalent to CLUSTER) Install package clusterSim and look at function index.G1 for the Calinski-Harabasz pseudo F-statistic -- David L Carlson Assoc

Re: [R] Survival Curves

2012-04-16 Thread robgriffin247
Hi David thanks for the help, i was just looking back to say I have found my solution (i think) and as you suggested survfit was the way to go. my solution was this: model<-survfit(Surv(a$longevity)~a$sex) plot(model,ylab="proportion alive",xlab="time (days)",col=c("red","blue")) -- View this mes

Re: [R] Seemingly simple "lm" giving unexpected results

2012-04-16 Thread Gene Leynes
Bill, Yes! The time variable was the issue. I should have mentioned that, but I didn't want to open the door to the fact that I should probably be using time series analysis instead of linear regression. Because of the time offset, I felt comfortable subtracting out the minimum of the observed

Re: [R] Survival Curves

2012-04-16 Thread robgriffin247
actually, maybe I haven't quite solved this - the plot doesn't appear to include the 23 that are still alive at the end. I have tried using a status variable (1 or 0 dependant upon survival as in page 800, roughly, in the R book) ... Call: survfit(formula = Surv(ssl$long, ssl$status) ~ ssl$sex)

[R] Creating a point pattern with spatstat

2012-04-16 Thread AMFTom
I have presence/absence data in the following format: 1 2 3 4 5 6 7 8 9 10 11 12 1 1 1 1 1 1 1 1 1 1 1 1 0 2 1 1 1 1 0

[R] Problems with subset, droplevels and lm: variable lengths differ

2012-04-16 Thread Michael Friendly
[Env: R 2.14.2 / Win Xp] In the script below, I want to select some variables from rrcov::OsloTransect, delete cases with any missing data, and subset the data frame Oslo to remove cases for two levels of the factor litho that occur with low frequency. The checks I run on my new data frame O

Re: [R] Survival Curves

2012-04-16 Thread David Winsemius
On Apr 16, 2012, at 1:02 PM, robgriffin247 wrote: actually, maybe I haven't quite solved this - the plot doesn't appear to include the 23 that are still alive at the end. I have tried using a status variable (1 or 0 dependant upon survival as in page 800, roughly, in the R book) ... Call

Re: [R] Problems with subset, droplevels and lm: variable lengths differ

2012-04-16 Thread Joshua Wiley
Hi Michael, Just a silly error, it should be: mod1 <- lm(cbind(Cu, Fe, K, Mg, Mn, P, Zn) ~ litho + forest + weather, data=Oslo) quoted you get a 1 x 7 character matrix you are trying to regress on. Cheers, Josh On Mon, Apr 16, 2012 at 10:43 AM, Michael Friendly wrote: > [Env:  R 2.14.2 / Win

Re: [R] system command to a specific shell (bash)

2012-04-16 Thread Jeff Newmiller
You could make a hash bang bash script that sources the file and then proceeds to do whatever you want. Bourne shell should have no problems invoking another shell. --- Jeff NewmillerThe .

Re: [R] Problems with subset, droplevels and lm: variable lengths differ

2012-04-16 Thread Peter Ehlers
On 2012-04-16 10:43, Michael Friendly wrote: [Env: R 2.14.2 / Win Xp] In the script below, I want to select some variables from rrcov::OsloTransect, delete cases with any missing data, and subset the data frame Oslo to remove cases for two levels of the factor litho that occur with low frequenc

Re: [R] Effeciently sum 3d table

2012-04-16 Thread David A Vavra
Thanks Gunter, I mean what I think is the normal definition of 'sum' as in: T1 + T2 + T3 + ... It never occurred to me that there would be a question. I have gotten the impression that a for loop is very inefficient. Whenever I change them to lapply calls there is a noticeable improvement in

Re: [R] Effeciently sum 3d table

2012-04-16 Thread David A Vavra
Thanks Petr, I'm after T1 + T2 + T3 + ... and your solution is giving a list of n items each containing sum(T[i]). I guess I should have been clearer in stating what I need. Cheers, DAV -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On

Re: [R] Effeciently sum 3d table

2012-04-16 Thread David A Vavra
Thanks Greg, I think this may be what I'm after but the documentation for it isn't particularly clear. I hate it when someone documents a piece of code saying it works kinda like some other code (running elsewhere, of course) making the tacit assumption that everybody will immediately know what th

Re: [R] system command to a specific shell (bash)

2012-04-16 Thread Justin Haynes
Thanks Jeff, but I'm running a python program that expects certain functionality that bash provides and sh doesn't... I can just stop using github checkouts and use system packages though and fix this. I'm mostly wondering where the "shell" command went in base R... it sounds like it completely s

Re: [R] Effeciently sum 3d table

2012-04-16 Thread Bert Gunter
David: 1. My first name is Bert. 2. " It never occurred to me that there would be a question." Indeed. But in fact you got solutions for two different interpretations (Greg's is what you wanted). That is what I meant when I said that clarity in asking the question is important. 3. > I have gotte

Re: [R] ggplot2: scale_shape_manual

2012-04-16 Thread Brian Diggs
On 4/16/2012 7:31 AM, Brian Smith wrote: Hi, I was trying to replicate one of the graphs given on the ggplot2 website. I have given a sample code below. I would like to combine the legends, since each color is uniquely mapped to a shape. ### library(ggplot2) leaves<- letters[1:8]

Re: [R] Effeciently sum 3d table

2012-04-16 Thread David Winsemius
On Apr 16, 2012, at 2:43 PM, David A Vavra wrote: Thanks Petr, I'm after T1 + T2 + T3 + ... Which would be one number ... i.e. the result you originally said you did not want. and your solution is giving a list of n items each containing sum(T[i]). I guess I should have been clearer in

Re: [R] Effeciently sum 3d table

2012-04-16 Thread William Dunlap
> Example in partial code: > > Env <- CreatEnv() # my own function > Assign('final',T1-T1,envir=env) > L<-listOfTables > > lapply(L,function(t) { > final <- get('final',envir=env) + t > assign('final',final,envir=env) > NULL > }) First, finish writing that code so it runs and y

Re: [R] Creating a point pattern with spatstat

2012-04-16 Thread David L Carlson
First you should read the documentation carefully and look at the examples. Your data are tabular. Spatstat expects a row for each point with the x and y coordinates for that point. # First use dput() to create a version of the data that you can copy into your r-help requests so we # can easily ge

Re: [R] Effeciently sum 3d table

2012-04-16 Thread David A Vavra
Bert, My apologies on the name. I haven't kept any data on loop times. I don't know why lapply seems faster but the difference is quite noticeable. It has struck me as odd. I would have thought lapply would be slower. It has taken an effort to change my thinking to force fit solutions to it but I

Re: [R] Effeciently sum 3d table

2012-04-16 Thread David Winsemius
On Apr 16, 2012, at 3:26 PM, David Winsemius wrote: On Apr 16, 2012, at 2:43 PM, David A Vavra wrote: Thanks Petr, I'm after T1 + T2 + T3 + ... Which would be one number ... i.e. the result you originally said you did not want. and your solution is giving a list of n items each conta

Re: [R] Effeciently sum 3d table

2012-04-16 Thread David A Vavra
> even now you _could_ be clearer I fail to see why it's unclear. >> I'm after T1 + T2 + T3 + ... > Which would be one number ... i.e. the result you originally said you >did not want. I think it's precisely what I want. If I have two 3d tables, T1 and T2, then say either 1) T1 + T2

Re: [R] Effeciently sum 3d table

2012-04-16 Thread Bert Gunter
For purposes of clarity only... On Mon, Apr 16, 2012 at 12:40 PM, David A Vavra wrote: > Bert, > > My apologies on the name. > > I haven't kept any data on loop times. I don't know why lapply seems faster > but the difference is quite noticeable. It has struck me as odd. I would > have thought la

Re: [R] Effeciently sum 3d table

2012-04-16 Thread David A Vavra
Thanks Bill, For reasons that aren't important here, I must start from a list. Computing the sum while generating the tables may be a solution but it means doing something in one piece of code that is unrelated to the surrounding code. Bad practice where I'm from. If it's needed it's needed but

[R] Simple Merge

2012-04-16 Thread Jeff
I'm new to R. I have two data frames I need to merge. One has an ID column the other does not, but both have the same number of rows that are ordered in the same way - e.g., row 1 is the same person in both data frames. For this reason, there is no need to sort or specify a "by" column. I

Re: [R] Simple Merge

2012-04-16 Thread Brian Diggs
On 4/16/2012 1:23 PM, Jeff wrote: I'm new to R. I have two data frames I need to merge. One has an ID column the other does not, but both have the same number of rows that are ordered in the same way - e.g., row 1 is the same person in both data frames. For this reason, there is no need to sor

Re: [R] Effeciently sum 3d table

2012-04-16 Thread Bert Gunter
David: Here is a comparison of the gains to be made by vectorization (again, assuming I have interpreted your query correctly) ## create a list of arrays > z <- lapply(seq_len(1),function(i)array(runif(24),dim=2:4)) ## Using an apply type approach > system.time(ans1 <- array(do.call(mapply,c(

Re: [R] Effeciently sum 3d table

2012-04-16 Thread William Dunlap
I generally prefer the list approach too. I only mentioned that you didn't need to have a list of inputs before starting the summation because you said > There's a lot > of extraneous memory wastage holding all of the tables in a list as well as > the return 'values'. I guess I misinterpret

Re: [R] Effeciently sum 3d table

2012-04-16 Thread David A Vavra
OK. I'll take your word for it. The mapply function calls "do_mapply" so I would have thought it is passing the operation down to the C code. I haven't tracked it any further than below. > mapply function (FUN, ..., MoreArgs = NULL, SIMPLIFY = TRUE, USE.NAMES = TRUE) { FUN <- match.fun(FUN)

Re: [R] Effeciently sum 3d table

2012-04-16 Thread Bert Gunter
On Mon, Apr 16, 2012 at 1:39 PM, David A Vavra wrote: > OK. I'll take your word for it. The mapply function calls "do_mapply" so I > would have thought it is passing the operation down to the C code. I haven't > tracked it any further than below. No, they can't. Function evaluation must take plac

Re: [R] Effeciently sum 3d table

2012-04-16 Thread David Winsemius
On Apr 16, 2012, at 4:04 PM, David A Vavra wrote: even now you _could_ be clearer I fail to see why it's unclear. I'm after T1 + T2 + T3 + ... Which would be one number ... i.e. the result you originally said you did not want. I think it's precisely what I want. If I have two 3d tables,

[R] grep and XML

2012-04-16 Thread Simon Kiss
Hi all: I struggle a lot scraping web data. I still haven't got a handle on the XML package. I'd like to get particular exchange rates from this table: https://raw.github.com/currencybot/open-exchange-rates/master/latest.json This is the code that I'm working with: library(RCurl) library(XML) t

[R] arrangement

2012-04-16 Thread Soheila Khodakarim
Dear All I want to arrange our output in 3 columns in R. Example: N 0432003010 00514 00604 0056303430 03022 V 22.00 0.00e+00 15.000 15. 13. 1.30e+01 51.000 p 0.640625 2.910383e-11 0.4257812 0.4375 0.6875 3.356934e-04 0.2434998

Re: [R] arrangement

2012-04-16 Thread David Winsemius
On Apr 16, 2012, at 5:19 PM, Soheila Khodakarim wrote: Dear All I want to arrange our output in 3 columns in R. Example: N 0432003010 00514 00604 0056303430 03022 V 22.00 0.00e+00 15.000 15. 13. 1.30e+01 51.000 p 0.640625 2.910

[R] overlay graphics on a googlemap

2012-04-16 Thread reyjuancarlos
Hi, I need help about overlaying an image on a google map I retrieve a google map by using the rgooglemaps package. Actually I have made a filled.contour graphic with my data, and I would like to overlay this graphic on a static map, but the problem is "how do we indicate this function in the FU

Re: [R] Sending lists from R to C using .C

2012-04-16 Thread Mercier Eloi
Hi Chris, I personally found the documentation rather...indigestible. At least 3 years ago when I developed my R package. It seems they have nicely improved this part of the documentation though. I'm not an expert at all, but at least you will have the point of view of a beginner. First, i

Re: [R] How to adjust the distance between legend and the plot (xyplot)

2012-04-16 Thread Peter Ehlers
On 2012-04-16 08:51, David Winsemius wrote: On Apr 16, 2012, at 11:43 AM, Jun Shen wrote: Dear list, As the title indicates if I draw the legend outside of the plot, how do I adjust the distance between the legend and the plot? The default setting is too close. Thanks. From the help page

Re: [R] Effeciently sum 3d table

2012-04-16 Thread Greg Snow
Here is a simple example: > mylist <- replicate(4, matrix(rnorm(12), ncol=3), simplify=FALSE) > A <- Reduce( `+`, mylist ) > B <- mylist[[1]] + mylist[[2]] + mylist[[3]] + mylist[[4]] > all.equal(A,B) [1] TRUE Basically what Reduce does is it first applies the function (`+` in this case) to the 1

Re: [R] How to adjust the distance between legend and the plot (xyplot)

2012-04-16 Thread Jun Shen
Hi, Peter, Thanks. This is exactly what I am looking for! Just a little concern. Since there are so many parameters in the trellis.par, how do we even know there is one that can do what we want? The documentation does not really have that much details. Jun On Mon, Apr 16, 2012 at 4:29 PM, Peter

Re: [R] Effeciently sum 3d table

2012-04-16 Thread David Winsemius
On Apr 16, 2012, at 5:41 PM, Greg Snow wrote: Here is a simple example: mylist <- replicate(4, matrix(rnorm(12), ncol=3), simplify=FALSE) A <- Reduce( `+`, mylist ) B <- mylist[[1]] + mylist[[2]] + mylist[[3]] + mylist[[4]] all.equal(A,B) [1] TRUE Basically what Reduce does is it first appl

[R] Simultaneous OLS fitting with constraints on coeffcients

2012-04-16 Thread Allan Sikk
Hi, Is it possible in R to fit two equations simultaneously: y1 = a1 - b1*t and y2 = a2 - b2*t so that the following constraint applies: a1/b1 = a2/b2 ? Thanks __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEAS

Re: [R] Effeciently sum 3d table

2012-04-16 Thread David Winsemius
On Apr 16, 2012, at 4:32 PM, Bert Gunter wrote: David: Here is a comparison of the gains to be made by vectorization (again, assuming I have interpreted your query correctly) ## create a list of arrays z <- lapply(seq_len(1),function(i)array(runif(24),dim=2:4)) ## Using an apply type ap

Re: [R] arrangement

2012-04-16 Thread Soheila Khodakarim
Hi David, Thanks a lot for your help. But unfortunately I can not understand your mean:( Could you explain more for me? Best Wishes, Soheila On Tue, Apr 17, 2012 at 1:55 AM, David Winsemius wrote: > > On Apr 16, 2012, at 5:19 PM, Soheila Khodakarim wrote: > > Dear All >> >> I want to

Re: [R] How to adjust the distance between legend and the plot (xyplot)

2012-04-16 Thread David Winsemius
On Apr 16, 2012, at 5:53 PM, Jun Shen wrote: Hi, Peter, Thanks. This is exactly what I am looking for! Just a little concern. Since there are so many parameters in the trellis.par, how do we even know there is one that can do what we want? The documentation does not really have that much

Re: [R] Effeciently sum 3d table

2012-04-16 Thread Bert Gunter
That _is_ interesting. Reduce() calls the sum function at the interpreted level, so I would not expect this. Can you check whether most of the time for my "vectorized" version is spent on the do.call(cbind ...) part, which is what I would guess. Otherwise, this sounds strange, since .rowSums is spe

[R] Can't install package gbm, because packageVersion is not an exported object from namespace::Utils

2012-04-16 Thread Douglas Colkitt
I'm running R 2.11.1 on 64 bit Debian. I've had no problem installing any other CRAN packages, but installing package "gbm" fails due to: *** installing help indices ** building package indices ... ** testing if installed package can be loaded Error : .onAttach failed in attachNamespace() for 'gbm

Re: [R] How to adjust the distance between legend and the plot (xyplot)

2012-04-16 Thread Peter Ehlers
On 2012-04-16 14:53, Jun Shen wrote: Hi, Peter, Thanks. This is exactly what I am looking for! Just a little concern. Since there are so many parameters in the trellis.par, how do we even know there is one that can do what we want? The documentation does not really have that much details. Well

Re: [R] Simultaneous OLS fitting with constraints on coeffcients

2012-04-16 Thread Gabor Grothendieck
On Mon, Apr 16, 2012 at 6:02 PM, Allan Sikk wrote: > Hi, > > Is it possible in R to fit two equations simultaneously: > > y1 = a1 - b1*t   and > y2 = a2 - b2*t > > so that the following constraint applies: a1/b1 = a2/b2 ? > Try this: set.seed(123) # simulated data a2 <- 2; b1 <- 3; b2 <- 4; a1

[R] projection pursuit classification

2012-04-16 Thread Ranjan Maitra
Hello, I am trying to look at projection pursuit classification: I was wondering what function/package is recommended for use. I note that the stats function ppr only takes in numeric responses. Any suggestions? Many thanks, Ranjan __ R-help@r-projec

  1   2   >