Re: [R] Data transformation

2009-11-10 Thread legen
Thank you for your kind help. Your script works very well. Would you please show me how to change NaN to zero and column variables 1, 2, ..., 8 to var1, var2, ..., var8? Thanks again. Legen jholtman wrote: > > Is this what you want: > >> x <- read.table(textConnection("idcode1code2

Re: [R] Re moving levels of a factor

2009-11-10 Thread Dieter Menne
Henrik Wahren wrote: > > How can one or more levels be removed from a factor of a data frame. There > was a similar post on how to do this when a factor meets some criterion > (e.g. <= 2), but I can¹t seem to get that solution to work. > Here, I simply want to drop some levels. > > Simply ca

Re: [R] Unexpected behaviour for as.date()

2009-11-10 Thread Patrick Connolly
G'day fellow Pacific rim dwellers, On Wed, 11-Nov-2009 at 11:13AM +0800, Berwin A Turlach wrote: |> G'day Isabella, |> [...] |> > However, when trying to convert a character date from the year 2000 |> > to a Julian date, I get an instead of the desired Julian date: |> > |> > > as.date("02-MA

Re: [R] lm and levels

2009-11-10 Thread Daniel Malter
Hi, your problem is that you run a regression on three observations with independent variables. This is obviously nonsense as two independent variables plus intercept MUST perfectly explain all variable. This you can see from the fact that the r-squared in the regression is 1, and that the standard

Re: [R] creating custom package and functions

2009-11-10 Thread cls59
dvkirankumar wrote: > > Hi all, > I am new to R-project > I have to create custom package and some required functions in that > package > can any one help me how to create a custompackage and how to write my > function in to that package > These things I have to use in many places as per requir

Re: [R] creating custom package and functions

2009-11-10 Thread Ronggui Huang
You can find guidance from Writing R Extensions manual, which is shipped with R and available on CRAN. Besides, you can have a look at package.skeleton. 2009/11/11 venkata kirankumar > > Hi all, > I am new to R-project > I have to create custom package and some required functions in that packag

[R] Removing levels of a factor

2009-11-10 Thread Henrik Wahren
How can one or more levels be removed from a factor of a data frame. There was a similar post on how to do this when a factor meets some criterion (e.g. <= 2), but I can¹t seem to get that solution to work. Here, I simply want to drop some levels. [[alternative HTML version deleted]]

[R] p-value calculation on a joint distribution

2009-11-10 Thread Leon Yee
Dear R users, For a uni-variable distribution represented in a numerical vector, we can obtain a distribution function using 'ecdf', and then calculate corresponding p-values. But if I have a 2-column dataframe representing a bi-variable joint distribution, given a pair of values, how can

[R] creating custom package and functions

2009-11-10 Thread venkata kirankumar
Hi all, I am new to R-project I have to create custom package and some required functions in that package can any one help me how to create a custompackage and how to write my function in to that package These things I have to use in many places as per requirements in my solution please help me to

Re: [R] Unexpected behaviour for as.date()

2009-11-10 Thread Berwin A Turlach
G'day Isabella, On Tue, 10 Nov 2009 20:11:31 -0800 "Isabella Ghement" wrote: > I tried the solution you suggested and find that am having problems > getting R to extract the year from an object created by as.date(): Perhaps it would be best to first clarify what you really need. :) If you have

[R] please add this email to the maillist

2009-11-10 Thread 杨江伟
thanks a lot -- Pleasure should be subordinate to duty. [[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 http://www.R-project.org/posting-gu

[R] plotting moving range control chart

2009-11-10 Thread Erin Hodgess
Dear R People: I am using qcc for a quality control class. I have used qcc with type "xbar.one" for individuals but cannot determine how to plot a moving range control chart. Has anyone done that, please? Thanks, Erin -- Erin Hodgess Associate Professor Department of Computer and Mathematica

[R] lm and levels

2009-11-10 Thread Chuck White
Consider the following example: x <- c(2,4,3,6) y <- c(4,9,5,10) z <- factor(c(1,1,2,2)) summary(lm("y ~ x + z")) The above works fine. Suppose I change z so that x <- c(2,4,3,6) y <- c(4,9,5,10) z <- factor(c(1,1,2,NA)) summary(lm("y ~ x + z")) the last row/observation is not considered in the

Re: [R] merge data

2009-11-10 Thread Chuck White
David -- thank you for your response. merge does work but it creates another dataframe. df1 is very large and I did not want another copy created. What I ended up doing is: df1 <- merge(df1, df2, by="week") In terms of memory allocation, will memory for two dataframes be allocated or will the

Re: [R] Unexpected behaviour for as.date()

2009-11-10 Thread Isabella Ghement
Hi David, Thank you so much for your reply - the quick answer is that I inherited the R code I am working with from someone else so I am trying to use the same functions they have used. In hindsight, this did not make my life any easier - on the contrary. Of course, little did I know that I would

Re: [R] Unexpected behaviour for as.date()

2009-11-10 Thread David Winsemius
On Nov 10, 2009, at 11:11 PM, Isabella Ghement wrote: Hi Berwin, Many thanks for your fast reply! It's evening time in Vancouver, Canada but it must be day time in Australia, so good day to you. Sorry about the confusion regarding the library name - I am using the "date" library, as yo

Re: [R] Unexpected behaviour for as.date()

2009-11-10 Thread Isabella Ghement
Hi Berwin, Many thanks for your fast reply! It's evening time in Vancouver, Canada but it must be day time in Australia, so good day to you. Sorry about the confusion regarding the library name - I am using the "date" library, as you pointed out. I tried the solution you suggested and find that

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

2009-11-10 Thread Martin Morgan
John Tillinghast wrote: > 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. > ??? Hi John -- are you i

Re: [R] Unexpected behaviour for as.date()

2009-11-10 Thread Berwin A Turlach
G'day Isabella, On Tue, 10 Nov 2009 18:40:11 -0800 "Isabella Ghement" wrote: > I am trying to use the function as.date() from the "dates" package As far as I can tell, there is no package called "dates", did you mean the package "date"? > in R 2.10.0 to convert a character date to a Julian d

Re: [R] lme4 glmer how to extract the z values?

2009-11-10 Thread Ben Bolker
sj gmail.com> writes: > I am using glmer() from lmer(lme4) to run generalized linear mixed models. I > can't figure out how to extract the z values for the fixed effects that are > reported using the summary function . Any help would be appreciated. library(lme4) example(glmer) coef(summary(gm1

[R] What parts of 'Statistical Models in S' are not applicable to R?

2009-11-10 Thread Peng Yu
According to Amazon review, 'Statistical Models in S' is a key reference for understanding the methods implemented in several of S-PLUS' high-end statistical functions, including 'lm()', predict()', 'design()', 'aov()', 'glm()', 'gam()', 'loess()', 'tree()', 'burl.tree()', 'nls()' and 'ms()'. But

[R] Unexpected behaviour for as.date()

2009-11-10 Thread Isabella Ghement
Hi everyone, I am trying to use the function as.date() from the "dates" package in R 2.10.0 to convert a character date to a Julian date, as follows: > as.date("02-MAY-01", order="mdy") # convert May 2, 2001 to a Julian date [1] 2May1 However, when trying to convert a character date from the yea

[R] lme4 glmer how to extract the z values?

2009-11-10 Thread sj
Hello, I am using glmer() from lmer(lme4) to run generalized linear mixed models. I can't figure out how to extract the z values for the fixed effects that are reported using the summary function . Any help would be appreciated. Thanks, Spencer [[alternative HTML version deleted]]

[R] AMRAtoMA

2009-11-10 Thread Pietrzykowski, Matthew (GE, Research)
Hello R Users! I have a question about the output of ARMAtoMA when used to calculate the variance of a model. I have a mixed model of the form ARMA(1,1). The actual model takes the form: X(t) = 0.75X(t-12) + a(t) - 0.4a(t-1) Given that gamma(0) takes the form [(1 + theta^2 - 2*theta*phi)/(1-ph

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

2009-11-10 Thread Sergios (Sergey) Charntikov
Thank you. I think that this is what I was looking for. I am getting the hang of it with my data. Thank you all. Sincerely, Sergios Charntikov (Sergey), MA Behavioral Neuropharmacology Lab Department of Psychology University of Nebraska-Lincoln Lincoln, NE 68588-0308 USA On Tue, Nov 10,

[R] ARMAtoMA

2009-11-10 Thread Matthew Pietrzykowski
Hello R Users! I have a question about the output of ARMAtoMA when used to calculate the variance of a model.  I have a mixed model of the form ARMA(1,1).  The actual model takes the form: X(t) = 0.75X(t-12) + a(t) - 0.4a(t-1) Given that gamma(0) takes the form [(1 + theta^2 - 2*theta*phi)/(1-ph

Re: [R] Data transformation

2009-11-10 Thread jim holtman
Is this what you want: > x <- read.table(textConnection("idcode1code2 p + 148 0.1 + 157 0.9 + 218 0.4 + 262 0.2 + 243 0.6 + 356

Re: [R] R process gets killed spontaneously

2009-11-10 Thread rmailbox
Cedrick is correct. I was referring to the command invoked by entering the string "screen" at the shell prompt. - Original message - From: "Cedrick W. Johnson" To: "Peng Yu" Cc: r-help@r-project.org Date: Tue, 10 Nov 2009 16:38:09 -0500 Subject: Re: [R] R process gets killed spontaneo

[R] Help using "leaps" package

2009-11-10 Thread Axel Urbiz
Dear R users, I'm new in R and couldn't find the solution to this in the postings. I want to be able to use the "leaps" package to perform an "exhaustive" regression. Most of my variables are categorical with many levels. I'd like to restrict the candidate subsets to either all levels included or

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

2009-11-10 Thread Marc Schwartz
On Nov 10, 2009, at 2:36 PM, David Winsemius wrote: 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), " (", roun

Re: [R] Dates plotting backwards

2009-11-10 Thread tlumley
On Tue, 10 Nov 2009, Sam Albers wrote: Hello, I am having a little trouble formatting my dates correctly. When I plot something using the following commands, R plots the most recent date on the left of the figure and then earlier date on the right of the figure. Given that English is read from

Re: [R] Dates plotting backwards

2009-11-10 Thread William Dunlap
> -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of Sam Albers > Sent: Tuesday, November 10, 2009 3:08 PM > To: r-help@r-project.org > Subject: [R] Dates plotting backwards > > Hello, > > I am having a little trouble formatting m

Re: [R] Dates plotting backwards

2009-11-10 Thread Sam Albers
> > > > > > Thanks in advance! > > > > Sam > > > > Date=as.Date(test$Date, format= "%d/%m/%Y") > > Change that to > test$Data <- as.Date(...) > or plot Date instead of test$Date. > Yes that worked. Silly mistake. Sometimes those are the hardest ones to spot. Thanks! > > Bill Dunlap > Spotfire,

Re: [R] Dates plotting backwards

2009-11-10 Thread Duncan Murdoch
Sam Albers wrote: Hello, I am having a little trouble formatting my dates correctly. When I plot something using the following commands, R plots the most recent date on the left of the figure and then earlier date on the right of the figure. Given that English is read from left to right I would

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

2009-11-10 Thread Duncan Murdoch
Mark Connolly wrote: Thanks. I guess it kind of works for me as well. The contents of a dataframe will display in the specified width, but doing a str(dataframe) will happily run past the width set in options and use up the device width (command line). I guess this may be my issue. Options

[R] Dates plotting backwards

2009-11-10 Thread Sam Albers
Hello, I am having a little trouble formatting my dates correctly. When I plot something using the following commands, R plots the most recent date on the left of the figure and then earlier date on the right of the figure. Given that English is read from left to right I would like to have the dat

[R] Data transformation

2009-11-10 Thread legen
Dear all, I have a dataset as below: idcode1code2 p 148 0.1 157 0.9 218 0.4 262 0.2 243 0.6 356 0.7 37

Re: [R] [Rd] NetCDF output in R

2009-11-10 Thread Robert J. Hijmans
Hi Nana, This is not a r-devel question. I suspect this should be something like: write.netcdf.time(paste(path,'cam_fore.nc',sep=""), fore[,,times] ,lon,lat,times) Robert On Tue, Nov 10, 2009 at 8:31 AM, nana wrote: > Dear CSAG R users, > > I will be glad if someone can point out what I am do

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

2009-11-10 Thread maiya
Cool! Thanks for the sampling and ff tips! I think I've figured it out now using sampling... I'm getting a quad-core, 4GB RAM computer next week, will try it again using a 64 bit version :) Thanks for your time!!! Maja tlumley wrote: > > On Tue, 10 Nov 2009, maiya wrote: > >> >> OK, it's

[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 States

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 wrote: > > I have a plotted a stacked pa

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

2009-11-10 Thread Mark Connolly
Thanks. I guess it kind of works for me as well. The contents of a dataframe will display in the specified width, but doing a str(dataframe) will happily run past the width set in options and use up the device width (command line). I guess this may be my issue. Options(width) does work for

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 s

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 > wrote: >> I am not really sure where in the interactions this is handled, but I >> would >> like to keep echo-ed R code chunks f

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 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 right margin and >

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] 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 <- c

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 wrote: > Sorry for the confusion. > > Let me put it in this way. Here we have 2000

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 proce

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 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 [[alternative HTML version d

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 large

[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 j

[R] how to suppress the output from stepAIC?

2009-11-10 Thread Jack Luo
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 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.e

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, 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 > session? (screen is a

[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 i

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))

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 u

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) ha

[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 li

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 > gsub("\bINDS\b","INDUSTRIE

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] 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] 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] Automating Plot Commands using a Loop

2009-11-10 Thread jim holtman
Why did you transpose the dataframe (TData <- t(Data))? Is your data in the same structure as is expected. Provide either the data file you are plotting, or at least an 'str' of the object. On Tue, Nov 10, 2009 at 3:06 PM, Koraelus wrote: > > Hello, > > Thank you very much. Your string makes pe

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] 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)) { plot(x[[i]],type="o",axes=F,xlab='',ylab='',ylim=c(0,2

[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

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 TF-8;LC_MONETARY=C;LC_MESSAGES=en_US.UTF

Re: [R] HEEELP!!!!

2009-11-10 Thread cls59
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 > script. > I don´t know

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 wrote: > > On Nov 10, 2009, at 2:26 PM, Hongwei Dong wrote: > >

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 with

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 <- l

[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 ge

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 t

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'), funct

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 a

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 p

[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 i

[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 probabil

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 scri

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? I

Re: [R] HEEELP!!!!

2009-11-10 Thread Liviu Andronic
Hello On 11/10/09, Ana María Prieto 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 it is for English, sim

[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 = sta

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 colum

Re: [R] source() vs attach()0

2009-11-10 Thread Duncan Murdoch
On 11/10/2009 11:14 AM, Stefan Zeugner wrote: 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 a

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 Char

[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 ** sub

[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 enough

[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 languages,

[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)) plo

[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 t

[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 inde

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 fir

[R] do.call and timeSeries

2009-11-10 Thread Bierbryer, Andrew
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 <- list() for ( i in 1:10 ) {

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")) r

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 hav

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 let

[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 <- open.ncdf(paste(path

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 Bene

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

  1   2   >