[R] p-generalized normal distribution

2009-11-10 Thread Steve.Kalke
Hello, I would like to know if there is already an R-package available for computing the density, distribution function, quantiles and random numbers of the p-generalized normal distribution. Best regards, Steve Kalke __ R-help@r-project.org

Re: [R] reference on contr.helmert and typo on its help page.

2009-11-10 Thread Gavin Simpson
On Mon, 2009-11-09 at 19:31 -0600, Peng Yu wrote: On Sun, Nov 8, 2009 at 7:32 PM, John Fox j...@mcmaster.ca wrote: Dear Peng, I'm tempted to try to get an entry in the fortunes package but will instead try to answer your questions directly: I can not install 'fortunes'. What are the

Re: [R] Binary packages on R-forge (was reference on contr.helmert and typo on its help page.)

2009-11-10 Thread Prof Brian Ripley
On Tue, 10 Nov 2009, Gavin Simpson wrote: On Mon, 2009-11-09 at 19:31 -0600, Peng Yu wrote: On Sun, Nov 8, 2009 at 7:32 PM, John Fox j...@mcmaster.ca wrote: Dear Peng, I'm tempted to try to get an entry in the fortunes package but will instead try to answer your questions directly: I can

Re: [R] linear trend line and a quadratic trend line.

2009-11-10 Thread ONKELINX, Thierry
Here is a solution using ggplot2 n - 50 Duncan - data.frame(income = runif(n, 0, 5)) Duncan$prestige - with(Duncan, 0.01 * income - .001 * income ^2 + rnorm(n, sd = 10)) library(ggplot2) ggplot(Duncan, aes(y = prestige, x = income)) + #define the data geom_point() + #add

[R] Plotting Mona clustering result

2009-11-10 Thread Zoe Hoare
Hi all, Is there a way of plotting a 'decision tree' from the results of Mona in the cluster package. The default bannerplot is not quite what I'm after - I would like a plot of the binary decision tree. Thanks Zoë [[alternative HTML version deleted]]

Re: [R] Getting Sphericity Tests for Within Subject Repeated Measure Anova (using car package)

2009-11-10 Thread Mike Lawrence
Check out the reshape package for transforming data from long to wide and vice versa. Yet I still don't know what problem you've encountered with ezANOVA. Using the data you just sent, where Day now has 3 levels, I reformat back to the presumably original long format and find that ezANOVA returns

[R] Nelson- Siegel - (Yield Curve - Smoothening of curve)

2009-11-10 Thread Julia Cairns
I am Julia Cains from Brisbane. This is my first mail to this group and I have recently started learning the R language.   I am trying to learn the smoothening of the yield curve. However, I came across the CRAN package – “YieldCurve” meant for Modelling and estimation of the yield

[R] Is it possible to detect whether running as Rscript?

2009-11-10 Thread Peter Meilstrup
I would like to write a block of code that runs when a script is being run from Rscript, but not to run if the same file is being source()d, or submitted via ESS, etc. As a gloss I would like to write a file that looks somewhat like: #!/usr/bin/env Rscript my.func - function(...) {

[R] contrast in lme

2009-11-10 Thread Jacques Ropers
Dear R-users I'm modelling some longitudinal data (1 response variable measured at 6 occasions, 1 baseline, one treatment variable) collected in the same subjects using the following model: library(nlme) model.lme - lme(response ~ V0+ time+ tt + tt:time, random = ~1|subject, correlation =

Re: [R] Is it possible to detect whether running as Rscript?

2009-11-10 Thread Duncan Murdoch
Peter Meilstrup wrote: I would like to write a block of code that runs when a script is being run from Rscript, but not to run if the same file is being source()d, or submitted via ESS, etc. As a gloss I would like to write a file that looks somewhat like: #!/usr/bin/env Rscript my.func

Re: [R] Getting Sphericity Tests for Within Subject Repeated Measure Anova (using car package)

2009-11-10 Thread Mike Lawrence
Oops, I see now that despite repeated subject names, treatment is a between-Ss variable, so you need to use this to get the equivalent of Anova: library(ez) a = read.table( 'Sergios_wide_data.txt' , header=T ) b = melt.data.frame( data=a , id.vars=c('subject','treatment') , variable_name='day' )

[R] Error: cannot allocate vector of size...

2009-11-10 Thread maiya
I'm trying to import a table into R the file is about 700MB. Here's my first try: DD-read.table(01uklicsam-20070301.dat,header=TRUE) Error: cannot allocate vector of size 15.6 Mb In addition: Warning messages: 1: In scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, : Reached

[R] Compile package in version R-2.10.0 (Windows XP)

2009-11-10 Thread Paul Ruppen
Under version 2.7.0 I could without problems compile R-packages, I wrote myself (Windows XP). In the relevant path I have at the beginning of the path the following enterings: PATH=c:\Rtools\bin;c:\Rtools\perl\bin;c:\Rtools\MinGW\bin;C:\Programme\MiKTeX~1\ miktex\bin;C:\Programme\MiKTeX

[R] write data frame in a list

2009-11-10 Thread Grzes
Hi, I have got a data frame: df=data.frame(x=c(3,6,7),y=c(2,7,4)) and I would like to write my values from data frame to list using loop, for example: lista=list() for (i in 1: length(?)){ lista[[?]][?] = df [?] } But I havn't got any idea what I should put in places where I put a

[R] R-help(tune.svm)

2009-11-10 Thread xavier maresma
Hello, my name is Xavier I'm student of UPC in Barcelnoa and I've read your R-help about tune.svm and i have the same problem. Have you solved the problem?? Do you know how tune.svm works?? Do you know why it's different from svm?? https://stat.ethz.ch/pipermail/r-help/2005-August/077427.html

[R] How to do ADF test and KPSS test in R

2009-11-10 Thread sdlywjl666
Dear all, How to do ADF test ¡¢KPSS¡¢ PP¡¢GLS test in R£¿ Thanks a lot ! [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

Re: [R] write data frame in a list

2009-11-10 Thread jim holtman
Is this what you want: df=data.frame(x=c(3,6,7),y=c(2,7,4)) df x y 1 3 2 2 6 7 3 7 4 as.list(df) $x [1] 3 6 7 $y [1] 2 7 4 On Tue, Nov 10, 2009 at 6:05 AM, Grzes gregori...@gmail.com wrote: Hi, I have got a data frame: df=data.frame(x=c(3,6,7),y=c(2,7,4)) and I would like to write

Re: [R] Models for Discrete Choice in R

2009-11-10 Thread Frank E Harrell Jr
Iuri Gavronski wrote: Frank, I certainly can't speak for Emmanuel. I don't know his reasons. The reason I've posted this question is the fact that (as far as I understood), ordinal regression is based on logistic regression (or probit), and logistic regression expects a formula like

Re: [R] Error: cannot allocate vector of size...

2009-11-10 Thread jim holtman
A little simple math. You have 3M rows with 100 items on each row. If read in this would be 300M items. If numeric, 8 bytes/item, this is 2.4GB. Given that you are probably using a 32 bit version of R, you are probably out of luck. A rule of thumb is that your largest object should consume at

Re: [R] Compile package in version R-2.10.0 (Windows XP)

2009-11-10 Thread Uwe Ligges
Paul Ruppen wrote: Under version 2.7.0 I could without problems compile R-packages, I wrote myself (Windows XP). In the relevant path I have at the beginning of the path the following enterings: PATH=c:\Rtools\bin;c:\Rtools\perl\bin;c:\Rtools\MinGW\bin;C:\Programme\MiKTeX~1\

Re: [R] R process gets killed spontaneously

2009-11-10 Thread Uwe Ligges
Peng Yu wrote: My R process has been killed for a few times, although the system administrator did not do so. It happened when R attempted to allocate a lot of memory. I'm wondering whether R would spontaneously kill itself if it can not allocate enough memory? It does not kill itself. If

[R] Numeric formatting question

2009-11-10 Thread Michael Pearmain
Hi All, I have am using Sweave and the \Sexpr{} to place some numeric variables in my tex document. I want to format the number prior to entry so they read slightly more elegantly. Say i have the following numbers x - 0.00487324 y - 0.00432 z - 0.567 I would like to have the numbers

Re: [R] Numeric formatting question

2009-11-10 Thread Dieter Menne
Michael Pearmain-2 wrote: Hi All, I have am using Sweave and the \Sexpr{} to place some numeric variables in my tex document. I want to format the number prior to entry so they read slightly more elegantly. Say i have the following numbers x - 0.00487324 y - 0.00432 z - 0.567

Re: [R] Numeric formatting question

2009-11-10 Thread Marc Schwartz
On Nov 10, 2009, at 7:23 AM, Michael Pearmain wrote: Hi All, I have am using Sweave and the \Sexpr{} to place some numeric variables in my tex document. I want to format the number prior to entry so they read slightly more elegantly. Say i have the following numbers x - 0.00487324 y -

[R] problem with executing r-function from windows command prompt

2009-11-10 Thread venkata kirankumar
Hi all, I am trying to execute one function from windows command prompt and I am trying to execute queries like source(myRfile.R) but itis throughing runtime errors can any one help me how can i run my *.R file and how can i call a function in that *.R file thanks in advance kiran.

Re: [R] write data frame in a list

2009-11-10 Thread Grzes
Thanks jholtman for advice but I need do it using a loop. (Because my code is a little more complicated). jholtman wrote: Is this what you want: df=data.frame(x=c(3,6,7),y=c(2,7,4)) df x y 1 3 2 2 6 7 3 7 4 as.list(df) $x [1] 3 6 7 $y [1] 2 7 4 On Tue, Nov 10, 2009 at

Re: [R] Error: cannot allocate vector of size...

2009-11-10 Thread maiya
OK, it's the simple math that's confusing me :) So you're saying 2.4GB, while windows sees the data as 700KB. Why is that different? And lets say I could potentially live with e.g. 1/3 of the cases - that would make it .8GB, which should be fine? But then my question is if there is any way to

Re: [R] write data frame in a list

2009-11-10 Thread jim holtman
If you really want a loop, then do: df=data.frame(x=c(3,6,7),y=c(2,7,4)) new.list - list() for (i in names(df)){ + new.list[[i]] - df[[i]] + } new.list $x [1] 3 6 7 $y [1] 2 7 4 On Tue, Nov 10, 2009 at 8:12 AM, Grzes gregori...@gmail.com wrote: Thanks jholtman for advice but I

[R] Akaike weight in R

2009-11-10 Thread Sunny
I am using lm simulation in R and try to find the AICc and Akaike weight of the model. I searched out that using package AICcmodavg AICc is easily to get. I wonder how can I get the Akaike weight, any function I can use to generate it? Thanks in advance. Sunny [[alternative HTML version

Re: [R] Error: cannot allocate vector of size...

2009-11-10 Thread Peter Dalgaard
maiya wrote: OK, it's the simple math that's confusing me :) So you're saying 2.4GB, while windows sees the data as 700KB. Why is that different? 700_MB_, I assume! In a nutshell, a single column and a spacer takes 2 bytes per subject, but a floating point variable takes 8, and R is not

Re: [R] Error: cannot allocate vector of size...

2009-11-10 Thread jim holtman
Check out: http://www.mail-archive.com/r-h...@stat.math.ethz.ch/msg79590.html for sampling a large file. On Tue, Nov 10, 2009 at 8:32 AM, maiya maja.zaloz...@gmail.com wrote: OK, it's the simple math that's confusing me :) So you're saying 2.4GB, while windows sees the data as 700KB. Why is

[R] when vectorising does not work: silent function fail?

2009-11-10 Thread Federico Calboli
Dear All, I'm using apply to do some genetic association analysis along a chromosome, with many thousands markers. For each marker the analysis is the same, so I was planning to use apply(chrom, 2, somefunction) In the specific case I do: my.results = apply(chr, 2, function(x){anova(lrm(

Re: [R] when vectorising does not work: silent function fail?

2009-11-10 Thread jim holtman
Have you tried something like this: my.results = apply(chr, 2, function(x){ result - try(anova(lrm( cpstc.f ~ x + time.cpstc + age + sex + mri))[1,3]) if (inherits(result, try-error)) return(NULL) result }) This should catch the error and have NULL in that list element. On Tue, Nov

[R] drop unused levels in subset.data.frame

2009-11-10 Thread baptiste auguie
Dear list, subset has a 'drop' argument that I had often mistaken for the one in [.factor which removes unused levels. Clearly it doesn't work that way, as shown below, d - data.frame(x = factor(letters[1:15]), y = factor(LETTERS[1:3])) s - subset(d, y==A, drop=TRUE) str(s) 'data.frame': 5

Re: [R] drop unused levels in subset.data.frame

2009-11-10 Thread David Winsemius
On Nov 10, 2009, at 10:49 AM, baptiste auguie wrote: Dear list, subset has a 'drop' argument that I had often mistaken for the one in [.factor which removes unused levels. Clearly it doesn't work that way, as shown below, d - data.frame(x = factor(letters[1:15]), y = factor(LETTERS[1:3])) s

Re: [R] drop unused levels in subset.data.frame

2009-11-10 Thread Marc Schwartz
On Nov 10, 2009, at 9:49 AM, baptiste auguie wrote: Dear list, subset has a 'drop' argument that I had often mistaken for the one in [.factor which removes unused levels. Clearly it doesn't work that way, as shown below, d - data.frame(x = factor(letters[1:15]), y = factor(LETTERS[1:3])) s -

[R] Comparison of vectors in a matrix

2009-11-10 Thread esterhazy
Hi, I have a matrix with two columns, and the elements of the matrix are vectors. So for example, in line 3 of column 1 I have a vector v31=(marc, robert, marie). What I need to do is to compare all vectors in column 1 and 2, so as to get, for example setdiff(v31,v32) into a new column. Is

[R] Calculating the percentage of explained deviance in lmer

2009-11-10 Thread Fabio Bulleri
Dear all, I am trying to calculate some measure of the amount of variability in the response variable that is explained by a model fitted in lmer m1-lmer(response-var ~ Condition+(1|Site/Area/Transect),family=binomial) . I've seen from the literature that the precentage of explained deviance is

[R] 2 significant digits

2009-11-10 Thread carol white
Hi, How to represent a rounded number ending with 0 with 2-significant digits? If I have for ex, 0.8031 and I use signif or round with digits = 2, I'll get 0.8. If I use format, I get character type (even if I pass number as parameter) and if I convert with as.numeric, I'll lose one significant

[R] Implementation of the Shuffled Complex Evol ution (SCE-UA) Algorithm

2009-11-10 Thread Simon Seibert
Good evening list, I'm looking for an R implementation of the Shuffled Complex Evolution” (SCE-UA) algorithm after Duan et al. (1993). Does anybody know if there is an extension/ package existing that contains it? Thanks very much for your help! Cheers, Simon Duan QY, Gupta KV, Sorooshian S

[R] NetCDF output in R

2009-11-10 Thread nana
Dear CSAG R users, I will be glad if someone can point out what I am doing wrong or not doing at all in this. I am trying to write out netcdf file in R. I have 26 time step but only the first time step is written. For example: library(ncdf) path - '/home/work/' forecast -

Re: [R] 2 significant digits

2009-11-10 Thread Marc Schwartz
On Nov 10, 2009, at 10:22 AM, carol white wrote: Hi, How to represent a rounded number ending with 0 with 2-significant digits? If I have for ex, 0.8031 and I use signif or round with digits = 2, I'll get 0.8. If I use format, I get character type (even if I pass number as parameter) and

Re: [R] polygon kills X-server

2009-11-10 Thread Barry Rowlingson
2009/11/10 Uwe Ligges lig...@statistik.tu-dortmund.de: This one is extraordinary dangerous: it also killed my kind of X server called Windows completely so that I had to reset the machine. Perhaps it should be debugged on the Linux side with less serious side effects The best way to

Re: [R] drop unused levels in subset.data.frame

2009-11-10 Thread baptiste auguie
Neat, I reinvented the wheel! Would that seem like a useful example at the end of the help page for ?subset ? (it currently has very little to say about drop). Thanks also to David for the alternative idea. Best regards, baptiste 2009/11/10 Marc Schwartz marc_schwa...@me.com: On Nov 10,

Re: [R] drop unused levels in subset.data.frame

2009-11-10 Thread Hadley Wickham
If you don't want to preserve factor levels when subsetting use characters. There are very few other differences in behavior. Hadley On Tuesday, November 10, 2009, baptiste auguie baptiste.aug...@googlemail.com wrote: Dear list, subset has a 'drop' argument that I had often mistaken for the

Re: [R] R process gets killed spontaneously

2009-11-10 Thread Benilton Carvalho
Hi Peng, in a very simplistic manner, what happens is that the Operating System thinks it is too dangerous to let the R process to use so much memory. So, to protect the whole system, it kills R, before the system becomes unstable. I've been looking at the problem you observed last week

Re: [R] phase determination

2009-11-10 Thread Lisandro Benedetti Cecchi
Hi, I'm trying to determine the phase of irregularly sampled data. Is there any particular reason why both spec.pgram and spec.ls return phase-NULL for vectors? Thank you. Lisandro x Lisandro

[R] NetCDF output in R

2009-11-10 Thread nana
Dear R users, I will be glad if someone can point out what I am doing wrong or not doing at all in this. I am trying to write out netcdf file in R. I have 26 time step but only the first time step is written. For example: library(ncdf) path - '/home/work/' forecast -

Re: [R] Error: cannot allocate vector of size...

2009-11-10 Thread tlumley
On Tue, 10 Nov 2009, maiya wrote: OK, it's the simple math that's confusing me :) So you're saying 2.4GB, while windows sees the data as 700KB. Why is that different? Your data are stored on disk as a text file (in CSV format, in fact), not as numbers. This can take up less space. And

Re: [R] when vectorising does not work: silent function fail?

2009-11-10 Thread tlumley
On Tue, 10 Nov 2009, jim holtman wrote: Have you tried something like this: my.results = apply(chr, 2, function(x){ result - try(anova(lrm( cpstc.f ~ x + time.cpstc + age + sex + mri))[1,3]) if (inherits(result, try-error)) return(NULL) result }) This should catch the error and have

Re: [R] when vectorising does not work: silent function fail?

2009-11-10 Thread Federico Calboli
On 10 Nov 2009, at 17:16, tlum...@u.washington.edu wrote: On Tue, 10 Nov 2009, jim holtman wrote: Have you tried something like this: my.results = apply(chr, 2, function(x){ result - try(anova(lrm( cpstc.f ~ x + time.cpstc + age + sex + mri))[1,3]) if (inherits(result, try-error))

Re: [R] NetCDF output in R

2009-11-10 Thread tlumley
On Tue, 10 Nov 2009, nana wrote: I will be glad if someone can point out what I am doing wrong or not doing at all in this. Sending the same message to both r-help and r-devel is one thing you are doing wrong. I am trying to write out netcdf file in R. I have 26 time step but only the

[R] merge data

2009-11-10 Thread Chuck White
df1 -- dataframe with column date and several other columns. #rows 40k Several of the dates are repeated. df2 -- dataframe with two columns date and index. #rows ~130 This is really a map from date to index. I would like to create a column called index in df1 which has the corresponding

[R] Interfacing R and C++

2009-11-10 Thread Nathan Harmston
Hi, I m currently working on interfacing R and C++ (passing a matrix from R to C++, doing some stuff, returning a vector of results). There seem to be a number of ways of doing this, such as rcpp and swig. Is there a recommended way of doing this? In the long run I would like what I m working on

[R] Titles on panel graphs created in zoo

2009-11-10 Thread MichelleJ
I have a plotted a stacked panel graph (single x axis and multiple y axis) using the package zoo and would like to add a title for each separate panel. I am using the script: z - with(mydata,zoo(cbind(mydata$Water.level,mydata$Submerged.plants, mydata$Crayfish.CPUE,mydata$Carp.CPUE),Year))

[R] HEEELP!!!!

2009-11-10 Thread Ana María Prieto
Hello. My name is Ana. I´m doing an eology master, and I´m just learning how R works. I have a Mac OS X 10.5.6, and I´m tryng to run just a simple ANOVA nanalyses. I dowloaded R version 2.10.0, and it seems I have problems with the script. I don´t know what to do, I´ve already change the

[R] How to use package-rsm to generate experimental design

2009-11-10 Thread Rob Wang
Hi guys, I am a totally begginer with R. I am planning to use R to design and optimize my experiment. The experiment includes 4 factors, and three of the fators have 3 levels, and the last factor has 6 levels. I am having a really hard time to learn this program on my own and didn't find

[R] source() vs attach()0

2009-11-10 Thread Stefan Zeugner
Hello, After hours of googling I could not resolve the following (although it seems simple): I would like to put subfunctions in a separate .R file that is then called with source() from inside several main functions. A crude example would be as follows: file subtest.R **

Re: [R] Comparison of vectors in a matrix

2009-11-10 Thread Tony Plate
Nice problem! If I understand you correctly, here's how to do it (with list-based matrices): set.seed(1) (x - matrix(lapply(rpois(10,2)+1, function(k) sample(letters[1:10], size=k)), ncol=2, dimnames=list(1:5,c(A,B A B 1 Character,2 Character,5 2 Character,2

Re: [R] merge data

2009-11-10 Thread David Winsemius
On Nov 10, 2009, at 12:36 PM, Chuck White wrote: df1 -- dataframe with column date and several other columns. #rows 40k Several of the dates are repeated. df2 -- dataframe with two columns date and index. #rows ~130 This is really a map from date to index. I would like to create a

[R] Why arima does not work when the time series is a costant?

2009-11-10 Thread Aijun
Hi! One of my time series happens to be a constant. When I call arima with c(0, 0, 0), it gives me error. Here is an example: ts1 - ts(rep(1, 29)) fit - arima(ts1, order=c(0,0,0)) When I run the second line above, it gives me the following error Error in decompose(ts(x[1L:wind], start =

Re: [R] HEEELP!!!!

2009-11-10 Thread Liviu Andronic
Hello On 11/10/09, Ana María Prieto prieto.anama...@gmail.com wrote: When copying the script in the R console, it seems that there is a problem with the ~ symbol. this symbol is not in the keyboard, so I select it from spetial characters, For what language is your keyboard designed? If

Re: [R] Interfacing R and C++

2009-11-10 Thread Duncan Murdoch
On 11/10/2009 12:35 PM, Nathan Harmston wrote: Hi, I m currently working on interfacing R and C++ (passing a matrix from R to C++, doing some stuff, returning a vector of results). There seem to be a number of ways of doing this, such as rcpp and swig. Is there a recommended way of doing this?

Re: [R] HEEELP!!!!

2009-11-10 Thread David Winsemius
On Nov 10, 2009, at 11:24 AM, Ana María Prieto wrote: Hello. My name is Ana. I´m doing an eology master, and I´m just learning how R works. I have a Mac OS X 10.5.6, and I´m tryng to run just a simple ANOVA nanalyses. I dowloaded R version 2.10.0, and it seems I have problems with the

[R] Monte Carlo Simulation in R...

2009-11-10 Thread Hongwei Dong
Hi, Dear R users, I'm wondering if I can do Monte Carlo Simulation in R. My problem is like this: I know variable X follows Gamma distribution with shape parameter 0.067 and scale parameter 0.008. The sum of the X is 2000. I need R help me to simulate a vector of X that satisfies both the

[R] All possible combinations of functions within a function

2009-11-10 Thread bikemike42
Dear All, I wrote a function for cluster analysis to compute cophenetic correlations between dissimilarity matrices (using the VEGAN library) and cluster analyses of every possible clustering algorithm (SEE ATTACHED) http://old.nabble.com/file/p26288610/cor.coef.R cor.coef.R . As it is now, it

Re: [R] Command-line arguments and --interactive

2009-11-10 Thread Adam D. I. Kramer
On Tue, 10 Nov 2009, Duncan Murdoch wrote: --interactive tells R that there is a human producing the input stream, so it can ask questions and expect them to be answered. In your experiments with it, your input stream was the pipe holding the output of echo, and R got confused because that

Re: [R] Monte Carlo Simulation in R...

2009-11-10 Thread Duncan Murdoch
On 11/10/2009 1:25 PM, Hongwei Dong wrote: Hi, Dear R users, I'm wondering if I can do Monte Carlo Simulation in R. My problem is like this: I know variable X follows Gamma distribution with shape parameter 0.067 and scale parameter 0.008. The sum of the X is 2000. I need R help me to simulate

Re: [R] All possible combinations of functions within a function

2009-11-10 Thread jim holtman
Here is a hint of how you might want to do the first part. You might want to study the 'lappy' function vegList - lapply(c('bray', ..., 'binomial'), function(.method){ vegdist(x, method=.method) }) clustList - lapply(vegList, function(.dist){ lapply(c('average', ..., 'centroid'),

Re: [R] All possible combinations of functions within a function

2009-11-10 Thread baptiste auguie
Hi, From what I understand of your code, you might find the following construct useful, funs - c(mean, sum, sd, diff) x - 1:10 lapply(funs, do.call, args=list(x)) and then working with lists rather than naming every object individually. You might find mapply useful too when you have to pass

[R] Generate Random Draw from Gamma Distribution Re: Monte Carlo Simulation in R...

2009-11-10 Thread Hongwei Dong
Exactly! Thanks, Duncan. Let me re-phrase me question like this: 1) X_i values are independent Gammas, with the shape 0.067 and scale 0.008 2) Min(X)=1 and Max(X)=85 3) SUM(X)=2000 4) Do I also have to define the number of draws? if yes, it could be 250. Based on these restrictions, I want to

Re: [R] do.call and timeSeries

2009-11-10 Thread Peter Ehlers
Bierbryer, Andrew wrote: Does anyone know why the following code hangs on the do.call, but works fine when I either comment out the require(timeSeries) or only do 2 levels of a for loop instead of 3? Thanks, Andrew Bierbryer require(timeSeries) num - 1 x.list -

Re: [R] Generate Random Draw from Gamma Distribution Re: Monte Carlo Simulation in R...

2009-11-10 Thread David Winsemius
On Nov 10, 2009, at 2:26 PM, Hongwei Dong wrote: Exactly! Thanks, Duncan. Let me re-phrase me question like this: 1) X_i values are independent Gammas, with the shape 0.067 and scale 0.008 2) Min(X)=1 and Max(X)=85 You might want to check that your parameterization in in agreement

Re: [R] Generate Random Draw from Gamma Distribution Re: Monte Carlo Simulation in R...

2009-11-10 Thread Hongwei Dong
Thanks. I tried the rgamma function too. But I'm still wondering how I can set the min, max, and sum of the variates created by the random draws. Anyone has a clue? Thanks. Garry On Tue, Nov 10, 2009 at 11:47 AM, David Winsemius dwinsem...@comcast.netwrote: On Nov 10, 2009, at 2:26 PM,

Re: [R] do.call and timeSeries

2009-11-10 Thread Bierbryer, Andrew
Peter - I am using 2.8.1 on linux. When I use 2.10.0 on the pc, it works, so it must be a version issue. sessionInfo() R version 2.8.1 (2008-12-22) x86_64-pc-linux-gnu locale: LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.U

[R] Formatted contingency tables with (%)

2009-11-10 Thread soeren . vogel
Quite often, I need those tables: x - sample(c(a, b, c), 40, rep=T) y - sample(c(X, Y), 40, rep=T) (tbl - table(x, y)) (z - as.factor(paste(as.vector(tbl), (, round(prop.table(as.vector(tbl)) * 100, 1), %), sep=))) matrix(as.factor(z), nrow=3, dimnames=dimnames(tbl)) But the result looks

Re: [R] Automating Plot Commands using a Loop

2009-11-10 Thread Koraelus
Hello, Thank you very much. Your string makes perfect sense to me, but I get an error when I try this: Data-read.csv(Datacull.txt,header=T,row.names=1) TData-t(Data) PlotFunction-function (x) { par(mfrow=c(3,6)) for (i in colnames(x)) {

Re: [R] Generate Random Draw from Gamma Distribution Re: Monte Carlo Simulation in R...

2009-11-10 Thread Ravi Varadhan
I think he means rate = 0.008, so he is looking for: rgamma(n, shape=0.067, rate=0.008) Even then his problem is not well-posed. You cannot have both independent gamma rv's and have them sum to 2000. Ravi. ---

Re: [R] Generate Random Draw from Gamma Distribution Re: Monte Carlo Simulation in R...

2009-11-10 Thread Ravi Varadhan
May be you are interested in the first `n' for which the sum of iid gamma rvs exceeds 2000, subject to the min-max constraints on each rv. If so, the following one-liner will give it to you: which(cumsum(pmax(1, pmin(rgamma(500, shape=0.067, rate=0.008), 85))) 2000)[1] Note that I have used a

Re: [R] Formatted contingency tables with (%)

2009-11-10 Thread David Winsemius
On Nov 10, 2009, at 3:07 PM, soeren.vo...@eawag.ch wrote: Quite often, I need those tables: x - sample(c(a, b, c), 40, rep=T) y - sample(c(X, Y), 40, rep=T) (tbl - table(x, y)) (z - as.factor(paste(as.vector(tbl), (, round(prop.table(as.vector(tbl)) * 100, 1), %), sep=)))

[R] gsub does not support \b?

2009-11-10 Thread Tan, Richard
Hello, can someone help? How come gsub(\bINDS\b,INDUSTRIES,ADVANCED ENERGY INDS) [1] ADVANCED ENERGY INDS not ADVANCED ENERGY INDUSTRIES Thanks. Richard [[alternative HTML version deleted]] __ R-help@r-project.org mailing list

Re: [R] creating multiple plots using a splitting factor

2009-11-10 Thread Johnston, Danielle
Thank you for the responses. The Lattice library is indeed useful for producing the graphs in which I am interested, and I appreciate the clarification between a function and the result of a function. Ideally, I would like to be able to page through the graphs rather than (or in addition to)

Re: [R] R process gets killed spontaneously

2009-11-10 Thread rmailbox
This was happening to me on Red Hat Linux when I was running huge jobs within a screen session. By any chance are your R processes running within a screen session? (screen is a very nice program that will keep your sessions alive after you log out, but it was killing off my big memory jobs for

Re: [R] All possible combinations of functions within a function

2009-11-10 Thread Michael L. Treglia
Thank you Baptiste and Jim- I look forward to trying these ideas out when I have a chance. Mike baptiste auguie wrote: Hi, From what I understand of your code, you might find the following construct useful, funs - c(mean, sum, sd, diff) x - 1:10 lapply(funs, do.call, args=list(x)) and then

[R] standardGeneric seems slow; any way to get around it?

2009-11-10 Thread John Tillinghast
Hi, I'm running some routines with standard matrix operations like solve() and diag(). When I do a profile, the lead item under total time is standardGeneric(). Furthermore, solve() and diag() have much greater total time than self time. ??? I assume there is some time-consuming decision going on

Re: [R] R process gets killed spontaneously

2009-11-10 Thread Peng Yu
I run R in gnome-terminal. Is it what you referred as 'screen session'? On Tue, Nov 10, 2009 at 3:01 PM, rmail...@justemail.net wrote: This was happening to me on Red Hat Linux when I was running huge jobs within a screen session. By any chance are your R processes running within a screen

Re: [R] Formatted contingency tables with (%)

2009-11-10 Thread David Winsemius
On Nov 10, 2009, at 3:07 PM, soeren.vo...@eawag.ch wrote: Quite often, I need those tables: x - sample(c(a, b, c), 40, rep=T) y - sample(c(X, Y), 40, rep=T) (tbl - table(x, y)) (z - as.factor(paste(as.vector(tbl), (, round(prop.table(as.vector(tbl)) * 100, 1), %), sep=)))

Re: [R] gsub does not support \b?

2009-11-10 Thread Tan, Richard
Ok, I figured it out. My stupid mistake, should be \\b instead of \b. From: Tan, Richard Sent: Tuesday, November 10, 2009 3:36 PM To: 'r-help@r-project.org' Subject: gsub does not support \b? Hello, can someone help? How come

[R] R echo code chunk runs off the page using Lyx and Sweave

2009-11-10 Thread Mark Connolly
I am not really sure where in the interactions this is handled, but I would like to keep echo-ed R code chunks from running past the right margin and off the page. I started with R and options(width=n), but this does not seem to do anything (in the context of a document -- line command works

Re: [R] Generate Random Draw from Gamma Distribution Re: Monte Carlo Simulation in R...

2009-11-10 Thread Hongwei Dong
Sorry for the confusion. Let me put it in this way. Here we have 2000 people and we want to put them into 150 groups. The distribution of the group size follows the Gamma distribution with shape parameter 0.067 and scale parameter 0.008. At the same time, the minimum group size is 1, and the

Re: [R] how to suppress the output from stepAIC?

2009-11-10 Thread mohamed . lajnef
Hi Jack, try stepAIC with trace parameter: stepAIC(...,trace=FALSE) Regards, M Jack Luo jluo.rh...@gmail.com a écrit : Hi, I am now running a cross-validation using coxph coupled with stepAIC for model selection, is there anyway to suppress the output? It's too much. -Jack

Re: [R] R process gets killed spontaneously

2009-11-10 Thread Cedrick W. Johnson
I think he was referring to the actual 'screen' command.. but, I digress... Is there any way you can put your commands in a script and execute them from the command line so that you see the actual memory and GC output from R in realtime? I use the following (in WinXP) to debug any faulty

Re: [R] Generate Random Draw from Gamma Distribution Re: Monte Carlo Simulation in R...

2009-11-10 Thread Hongwei Dong
By the way, maybe the number of groups can be determined endogenously. It will be better if I do not have to set the total number of groups exogenously. Thanks Garry On Tue, Nov 10, 2009 at 1:29 PM, Hongwei Dong pdxd...@gmail.com wrote: Sorry for the confusion. Let me put it in this way.

Re: [R] Generate Random Draw from Gamma Distribution Re: Monte Carlo Simulation in R...

2009-11-10 Thread Ravi Varadhan
If the number of groups can be set endogenously my previous email about the smallest `n' would apply. You can view this as a waiting time problem. Here is one approach: x - round(pmax(1, pmin(rgamma(500, shape=0.067, rate=0.008), 85))) csx - cumsum(x) ind - which(csx 2000)[1] xg -

Re: [R] Generate Random Draw from Gamma Distribution Re: Monte Carlo Simulation in R...

2009-11-10 Thread David Winsemius
On Nov 10, 2009, at 4:29 PM, Hongwei Dong wrote: Sorry for the confusion. Let me put it in this way. Here we have 2000 people and we want to put them into 150 groups. The distribution of the group size follows the Gamma distribution with shape parameter 0.067 and scale parameter

Re: [R] R echo code chunk runs off the page using Lyx and Sweave

2009-11-10 Thread Ista Zahn
options(width=n) is supposed to work, and does for me. I don't use Lyx though... -Ista On Tue, Nov 10, 2009 at 4:27 PM, Mark Connolly mark_conno...@acm.org wrote: I am not really sure where in the interactions this is handled, but I would like to keep echo-ed R code chunks from running past the

Re: [R] R echo code chunk runs off the page using Lyx and Sweave

2009-11-10 Thread Ben Bolker
Ista Zahn wrote: options(width=n) is supposed to work, and does for me. I don't use Lyx though... -Ista On Tue, Nov 10, 2009 at 4:27 PM, Mark Connolly mark_conno...@acm.org wrote: I am not really sure where in the interactions this is handled, but I would like to keep echo-ed R code

Re: [R] Generate Random Draw from Gamma Distribution Re: Monte Carlo Simulation in R...

2009-11-10 Thread David Winsemius
On Nov 10, 2009, at 5:00 PM, David Winsemius wrote: On Nov 10, 2009, at 4:29 PM, Hongwei Dong wrote: Sorry for the confusion. Let me put it in this way. Here we have 2000 people and we want to put them into 150 groups. The distribution of the group size follows the Gamma distribution with

Re: [R] Titles on panel graphs created in zoo

2009-11-10 Thread Gabor Grothendieck
Please read the last line on every message to r-help and particularly note the requirement to provide reproducible code. We don't have your data so its not reproducible. Also please clarify what you want where. On Tue, Nov 10, 2009 at 10:46 AM, MichelleJ m.jack...@qmul.ac.uk wrote: I have a

[R] qplot error

2009-11-10 Thread Frank Lawrence
When I invoke qplot, I get the following error: Error in rename.default(x, .base_to_ggplot) : object '.data' not found I would appreciate any advice. sessionInfo: R version 2.10.0 (2009-10-26) i386-pc-mingw32 locale: [1] LC_COLLATE=English_United States.1252 [2] LC_CTYPE=English_United

  1   2   >