Re: [R] Weighted Sum Optimization in R (Maximization)

2008-11-12 Thread GR
There is a package "lpSolve" that you might want to look at. At the R prompt, do the following: > install.packages("lpSolve") Once the package will be installed, you can type help(lpSolve) to get details. cheers, -Girish On Nov 13, 8:37 am, "Yun, Myung Ho" <[EMAIL PROTECTED]> wrote: > Dear All,

Re: [R] Weighted Sum Optimization in R (Maximization)

2008-11-12 Thread Prof Brian Ripley
This is 'linear programming'. Try RSiteSearch("linear programming") The first few fits will give you a lot to explore. On Thu, 13 Nov 2008, Yun, Myung Ho wrote: Dear All, First of all, this is the first time for me to use R for optimization, I tried to search r-help postings & googled on wei

[R] Weighted Sum Optimization in R (Maximization)

2008-11-12 Thread Yun, Myung Ho
Dear All, First of all, this is the first time for me to use R for optimization, I tried to search r-help postings & googled on weighted sum optimization, I could not find anything applicable. I would need to optimize following function in R; MAXIMIZE function = w1*R1 + w2*R2 + w3*R3 + w4*R

[R] sem and "simple variables"

2008-11-12 Thread steven northway
salutations! i am doing some longitudinal modeling with sem and thought calculating some "simple variables" would make my model more readable. this is the smallest subset of my model that illustrates the resulting problem. i have 2 observed exogenous variables (c1, d2) and 4 observed endogenous v

Re: [R] Retrieving x argument name from a trellis object in R 2.8.0

2008-11-12 Thread Deepayan Sarkar
On Wed, Nov 12, 2008 at 7:41 AM, <[EMAIL PROTECTED]> wrote: > > Dear Deepayan, > > thanks for you quick response. > > The main idea is to use trellis_object$call$x as a label in a tcltk > interface to choose one among several plots and perform a given task (e.g. > print on screen, export as pdf e

Re: [R] metaprogramming with lm

2008-11-12 Thread Simon Blomberg
Yet again my baroque programming style shows itself. The . notation is great, although solution 2. is perhaps more versatile, allowing you to pick and choose your predictors more easily. On Thu, 2008-11-13 at 11:56 +1100, [EMAIL PROTECTED] wrote: > Two possible ways around this are > > 1. If the

Re: [R] metaprogramming with lm

2008-11-12 Thread Simon Blomberg
You can construct the formula on the fly. Say you have a data frame with columns: y, x1,...x10: dat <- data.frame(matrix(rnorm(1100), ncol=11, dimnames=list(NULL,c("y", paste("x", 1:10, sep="") Then you could construct the formula using: form <- formula(paste("y ~ ", paste(names(dat)[which(n

Re: [R] metaprogramming with lm

2008-11-12 Thread Bill.Venables
Two possible ways around this are 1. If the x's are *all* the other variables in your data frame you can use a dot: fm <- lm(y ~ ., data = myData) 2. Here is another idea > as.formula(paste("y~", paste("x",1:10, sep="", collapse="+"))) y ~ x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8 + x9 + x10 > (Y

Re: [R] gam help (really a vegan question)

2008-11-12 Thread Gavin Simpson
On Tue, 2008-11-11 at 23:56 -0500, stephen sefick wrote: > What does Generalized Cross Validation score mean. I preform and > ordisurf on an ordination (nmds) with an environmental variable. I am > trying to figure out "how well" the environmental varibles > predict/explain the sites placements i

Re: [R] metaprogramming with lm

2008-11-12 Thread Erik Iverson
The special name "." may be used on the right side of the "~" operator, to stand for all the variables in a data.frame other than the response. --John Chambers, Statistical Models in S, p. 101 So, if the y and Xi (in your case) were the only variables in mydata, then lm(y ~ . , data = mydata)

[R] metaprogramming with lm

2008-11-12 Thread June Kim
Hello, Say I want to make a multiple regression model with the following expression: lm(y~x1 + x2 + x3 + ... + x_n,data=mydata) It gets boring to type in the whole independent variables, in this case x_i. Is there any simple way to do the metaprogramming for this? (There are different cases wher

Re: [R] Citing R in journal articles (or the failure to)

2008-11-12 Thread ronggui
> In two recent in press articles where I cited R packages, > I was asked by the copy-editor to add a location or url to the references. > Could I suggest that citation() be modified to include > the URL automatically? > I second this suggestion. I experienced similar case once as well. > > -- >

Re: [R] sample size estimation for count (poisson?) data?

2008-11-12 Thread David Winsemius
The first hit for search on "sample size" and "poisson" on Baron's search engine web interface appears on target: http://search.r-project.org/cgi-bin/namazu.cgi?query=%22sample+size%22+poisson&max=100&result=normal&sort=score&idxname=functions&idxname=Rhelp02a Getting the same result from your

[R] Understanding glm family documentation: dev.resids

2008-11-12 Thread Peter Dunn
Hi all Consider the family function, as used by glm. The help page says the value of the family object is a list, one element of which is the following: dev.resids function giving the deviance residuals as a function of (y, mu, wt). But reading any of the family functions (eg poisson) sh

[R] sample size estimation for count (poisson?) data?

2008-11-12 Thread Shawn Morrison
Is there a function in R that will allow me to estimate the sample size required from count data (poisson data?), given the known variance and desired margin of error and confidence interval? My specific data set will be based on a survey of hikers that will be asked about the number of anim

Re: [R] different results with plot.lm vs. plot.lm(which=c(2))

2008-11-12 Thread Greg Snow
Just a clarification on one of my statements below. I realize on rereading my statement on R-core paying attention that it could be interpreted as a possible criticism. That is not how it was intended, rather that I have seen cases in the past where a discussion confirms that something is a bu

[R] Permutations and large data sets

2008-11-12 Thread Chris Miller
I have 200 samples, with 1 million data points in each. Each data point can have a value from zero to 10, and we can assume that they're normally distributed. If I calculate a sum by drawing one random data point from each sample and adding them, what value does that sum need to be before I can say

Re: [R] separate a variable in several variables

2008-11-12 Thread Gabor Grothendieck
You can fix the space problem by using '[^[:digit:]]' instead of '[[:alpha:]]' and '[^[:alpha:]]' instead of '[[:digit:]]' On Wed, Nov 12, 2008 at 5:10 PM, Peter Alspach <[EMAIL PROTECTED]> wrote: > Tena koe > > Try: > > gsub('[[:alpha:]]', '', unlist(DATA)) and > gsub('[[:digit:]]', '', unlist(DA

Re: [R] separate a variable in several variables

2008-11-12 Thread Wacek Kusnierczyk
CE.KA wrote: > > x > 1 12F > 2 13 AD > 3 356PO > 4 1D > 5 GRT > 6 PO52 > 7 LN4Z > > Is there a way to separarate x in 2 variables: > y: only numeric caracters > z: only alpha caracters > For exemple: > x y z > 1 12F12 F > 2 13 AD 13

Re: [R] separate a variable in several variables

2008-11-12 Thread Peter Alspach
Tena koe Try: gsub('[[:alpha:]]', '', unlist(DATA)) and gsub('[[:digit:]]', '', unlist(DATA)) unlist(DATA) since it looks like DATA maybe a dataframe. You are still left with the spaces, but these can be readily removed. Someone else may offer a better solution. HTH ... Peter Alspach > -

Re: [R] sampling and testing

2008-11-12 Thread Peter Alspach
Kia ora Grant The problem is that feb[sample(nrow(feb),###),] randomly rearrangements the rows of all columns together, and hence doesn't altering the pairing. Try cor(feb[, col1], feb[sample(nrow(feb)), col2]) HTH Peter Alspach > -Original Message- > From: [EMAIL PROTECTED]

[R] separate a variable in several variables

2008-11-12 Thread CE.KA
Hello R users, Imagine the data frame DATA with the variable x which is composed by numeric and alpha caracters. > DATA x 1 12F 2 13 AD 3 356PO 4 1D 5 GRT 6 PO52 7 LN4Z Is there a way to separarate x in 2 variables: y: only numeric caracters z: only alpha caracters For exemple

Re: [R] Getting parameters of Gaussian fit in density

2008-11-12 Thread Erik Iverson
Victor - What package/functions did you use to do the fit? Can you send a small example with a made-up or built-in dataset, show how far you get, and what you'd like to have as the result? It's much easier to show what to do when we know what functions and packages you're using to get your

[R] sampling and testing

2008-11-12 Thread Grant Humphries
Hello everyone, I have a dataset in the following format: col1 col2 # # # # # # # # # # # # What I want to do is: loop a random sample 10 times, and for each time it is sampled I want to run a correlation between both columns. What I have so far is this: >feb <- read.

[R] Getting parameters of Gaussian fit in density

2008-11-12 Thread Victor Bloomfield
Is there a way to obtain the parameters (mean, sd, amplitude) of the gaussian functions obtained in a density fit to data. The faithful $waiting times is a standard example. The 2-gaussian fit is very nice, but how can I obtain the parameters? Thanks for your help. Regards, Victor Bloomfiel

Re: [R] Linear regression

2008-11-12 Thread Greg Snow
Alireza, The "lm" function fits the linear regression (linear model), the "predict" function predicts new response values based on values of the predictor variables. Try something like: > mydata <- data.frame( x=1:30, y=31:60+rnorm(30) ) > fit1 <- lm( y ~ x, data=mydata ) > summary(fit1) # opt

Re: [R] Linear regression

2008-11-12 Thread John Sorkin
lm, for example: fit1<-lm(y~x,data=mydata) if you enter ?lm in an R session you will get more information. John John David Sorkin M.D., Ph.D. Chief, Biostatistics and Informatics University of Maryland School of Medicine Division of Gerontology Baltimore VA Medical Center 10 North Greene Stree

[R] Linear regression

2008-11-12 Thread Dr. Alireza Zolfaghari
Hi List, Does anybody know what function I need to use for a simple regression? Here is the data: I want to find the value for x1=3.5 data<-data.frame(x=c(1:30),Value=c(31:60)) x1<-3.5 Regards, Alireza [[alternative HTML version deleted]] __ R

Re: [R] How can I generate a random order?

2008-11-12 Thread jim holtman
sample(100) On Wed, Nov 12, 2008 at 3:24 PM, Stuart Leask <[EMAIL PROTECTED]> wrote: > Feeling very stupid here. > > I just want to randomly-ordered some integers, e.g. the numbers 1 to > 100, with each element present once only in a random order. > I suspect I need to randomly sample a population

Re: [R] [SPAM] - How can I generate a random order? - Found word(s) remove list in the Text body

2008-11-12 Thread davidr
sample(1:100) -- David -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Stuart Leask Sent: Wednesday, November 12, 2008 2:24 PM To: [EMAIL PROTECTED] Subject: [SPAM] - [R] How can I generate a random order? - Found word(s) remove list in the Text body F

[R] How can I generate a random order?

2008-11-12 Thread Stuart Leask
Feeling very stupid here. I just want to randomly-ordered some integers, e.g. the numbers 1 to 100, with each element present once only in a random order. I suspect I need to randomly sample a population 1-100, remove that number, then randomly sample what is left until they've all gone, but I c

Re: [R] Fitting data to a sigmoidal curve

2008-11-12 Thread Rubén Roa-Ureta
Greg Snow wrote: Sarah, Doing: RSiteSearch('gompertz', restrict='functions') At the command prompt gives several promising results. Hope this helps, -- Gregory (Greg) L. Snow Ph.D. And you can also do: nobs <- length(data$salam.size.observed) fn<-function(p){ salam.size.mod

Re: [R] different results with plot.lm vs. plot.lm(which=c(2))

2008-11-12 Thread Greg Snow
The same thing is affecting plot 2 as well. Basically in the code there is line early on: r <- residuals(x) which gets the residuals and by default for glm models those are the deviance residuals. A bit latter is the code (after some optional modifications to r): if (any(show[2:3])) {

Re: [R] Outer, kronecker, etc.

2008-11-12 Thread baptiste auguie
you may want to look into Hadley's new package plyr for this kind of operation. baptiste On 12 Nov 2008, at 17:51, Stavros Macrakis wrote: By-the-way^2: is there some Xapply function that maps a function over all the elements of a structure (vector, matrix, list, ...) and preserves the origi

Re: [R] Fitting data to a sigmoidal curve

2008-11-12 Thread Greg Snow
Sarah, Doing: > RSiteSearch('gompertz', restrict='functions') At the command prompt gives several promising results. Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare [EMAIL PROTECTED] 801.408.8111 > -Original Message- > From: [EMAIL PR

Re: [R] An example of the boxplot thickness problem

2008-11-12 Thread Deepayan Sarkar
On 11/12/08, Kenneth Roy Cabrera Torres <[EMAIL PROTECTED]> wrote: > Dr. Sarkar: > > Thank you very much for your help! > > Is there any problem that it shows this warning message? > > Warning messages: > 1: In levels.fos - blist.height/2: > Length of object is greater or is not multiple >

Re: [R] Fitting data to a sigmoidal curve

2008-11-12 Thread Gabor Grothendieck
Try this command from within R: RSiteSearch("gompertz") On Wed, Nov 12, 2008 at 1:50 PM, sarahkm <[EMAIL PROTECTED]> wrote: > > Hi- > I'm a biologist trying to figure out the growth rate of salamanders in > different ponds. I collected individuals from various populations at > different dates, an

[R] USAR2009 ***R/R-PLUS/S Conference Announcement & Call For Papers - Las Vegas, USA

2008-11-12 Thread [EMAIL PROTECTED]
== USAR2009 R/R-PLUS/S CONFERENCE ANNOUNCEMENT & CALL FOR PAPERS == The 2009 R/R-PLUS/S Conference will take place in Las Vegas,USA April 26-30, 2009 The meeting is open to al

Re: [R] [R-SIG-Mac] rimage doesn't install on Mac OS X 10.4

2008-11-12 Thread Simon Urbanek
Scott, can you, please, include sessionInfo() in your output? Without knowing what machine you're running on (and incomplete output you sent) I can only guess that you simply don't have universal binary of your dependent libraries so you cannot build a universal package (somewhat likely g

Re: [R] Fitting data to a sigmoidal curve

2008-11-12 Thread Rolf Turner
On 13/11/2008, at 7:50 AM, sarahkm wrote: Hi- I'm a biologist trying to figure out the growth rate of salamanders in different ponds. I collected individuals from various populations at different dates, and using the size and date collected, I want to figure out the growth curve of each popu

[R] Computation for specific 2^k factorial designs

2008-11-12 Thread Kenneth Roy Cabrera Torres
Hi R users: I want to know if there is any package that makes the specific computation 2^k factorial designs as in: George E. P. Box, J. Stuart Hunter and William G. Hunter. Statistics for Experimenters. Second Edition. 2005. John Wiley & Sons. They advice about the misuse of the ANOVA table in

Re: [R] different results with plot.lm vs. plot.lm(which=c(2))

2008-11-12 Thread Effie Greathouse
There's also a big difference in plot 2 (Normal Q-Q) in my real data, but I don't see a real difference in plot 2 for the example I sent, except that some of the outlier labels are different. Would the residuals being plotted likely be the cause of the difference in plot 2 as well? Dr. Snow, woul

[R] Fitting data to a sigmoidal curve

2008-11-12 Thread sarahkm
Hi- I'm a biologist trying to figure out the growth rate of salamanders in different ponds. I collected individuals from various populations at different dates, and using the size and date collected, I want to figure out the growth curve of each population. My question is: How do I fit my data to

Re: [R] different results with plot.lm vs. plot.lm(which=c(2))

2008-11-12 Thread Greg Snow
>From a quick look at the code it looks like when you ask for plot number 5 >(included in default when 'which' is not specified), then the deviance >residuals are replaced by the pearson residuals to be used in later >computations. So the difference that you are seeing is that one of the plots

[R] How fast of a desktop can I buy?

2008-11-12 Thread Stephen Collins
I currently run simulations on an IBM x31 Thinkpad (laptop), with an Intel Pentium M, 1.3GHz processor. I am planning to buy a desktop to help speed up my work, but I am wondering if R is compatible with some of the newer technology that has come to market (i.e., Intel Core 2 Duo, Quad Core pr

Re: [R] apply() just loops ?

2008-11-12 Thread Greg Snow
Markus, You may also want to read the Help Desk article in the 8/1 R-News newsletter. It discusses the similarities and differences of *apply and loops and also shows the slowdowns from some common loops (that *apply tend to avoid). Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical

Re: [R] data which has different size of elements in each row

2008-11-12 Thread Marc Schwartz
This was the scenario that Phoebe posted about. Her data was: 2.93290e-06 1.17772e-06 -0.645205 rs2282755 3.07521e-06 3.14000e-04 0.412997 rs1336838 4.84017e-06 2.18311e-01 0.188669 rs2660664 rs967785 9.77861e-06 7.04740e-02 0.294653 rs2660664 1.22767e-05 1.56325e-05 0.569826 rs6870519 2.

Re: [R] different results with plot.lm vs. plot.lm(which=c(2))

2008-11-12 Thread Effie Greathouse
Hi Dr. Ripley--Sorry for the repost everybody. The original message I sent never showed up in my inbox, so I thought it didn't get sent to the list. I'm running R 2.8.0, installed from a pre-compiled version, on Windows XP. When I type Sys.getlocale() at the R prompt, it returns: "LC_COLLATE=Eng

Re: [R] Outer, kronecker, etc.

2008-11-12 Thread Prof Brian Ripley
See ?Vectorize. sqrt() works on a matrix, and so does A <- matrix(1:4^2,2,2) A[] <- sapply(A, sqrt) On Wed, 12 Nov 2008, Stavros Macrakis wrote: `outer` (and related functions like kronecker) require that their functional argument operate elementwise on arrays. This means for example that

[R] Outer, kronecker, etc.

2008-11-12 Thread Stavros Macrakis
`outer` (and related functions like kronecker) require that their functional argument operate elementwise on arrays. This means for example that outer( 1:2, 3:4, list) or outer(1:2,3:4,function(a,b){1}) gives an error. Is there a version of `outer`/`kronecker`/etc. that takes arbitr

[R] rimage doesn't install on Mac OS X 10.4

2008-11-12 Thread Waichler, Scott R
Hi, I'm trying to install rimage on a Mac OS X 10.4 machine. I followed the advice in previous R-help threads and got over the hurdles of having the header files in the right places, among other things. But I can't figure out what to do with this error. ice.pnl.gov:/home/waichler<949>system_pro

Re: [R] Having R (not the OS) redirect stderr() to stdout()

2008-11-12 Thread Prof Brian Ripley
See ?sink (and heed the warnings). Depending on what the connections are, the stdout and stderr may or may not interleave correctly. On Wed, 12 Nov 2008, David Dahl wrote: R users, I am aware that R can be invoked such that the operating system redirects standard error (stderr) to standard

Re: [R] what does negative indexing in a matrix mean?

2008-11-12 Thread Stephan Kolassa
"take all of the matrix *except* those indices", so XW4[,-2] is the matrix XW4 with the 2nd column *deleted*. Cheers, Stephan Itziar Frades Alzueta schrieb: Hi, Does anyone know what the negative indexing of a matrix mean? I am using the RWeka and this evaluate classifier does not work

Re: [R] apply() just loops ?

2008-11-12 Thread Mark Lyman
Markus Loecher gmail.com> writes: > > Dear R users, > I have been diligently using the apply() family in order to avoid explicit > for loops and speed up computation. > However, when I finally inspected the source code for apply, it appears that > the core computation is a simple loop as well. >

Re: [R] different results with plot.lm vs. plot.lm(which=c(2))

2008-11-12 Thread Prof Brian Ripley
Instead of re-posting the same message, please study the posting guide and supply the information asked for, including a reproducible example. There is no way we can help you unless you help us to help you. On Wed, 12 Nov 2008, Effie Greathouse wrote: I am running GLM models using the gamma f

Re: [R] odfweave

2008-11-12 Thread Sarah Goslee
Your input file should be an OpenOffice document; is it? rnw is not an OO extension. The second file should likely have an odt rather than odf extension as well, but that woudn't cause the error you're getting. Sarah On Wed, Nov 12, 2008 at 11:01 AM, Irina Ursachi <[EMAIL PROTECTED]> wrote: > Dea

[R] what does negative indexing in a matrix mean?

2008-11-12 Thread Itziar Frades Alzueta
Hi, Does anyone know what the negative indexing of a matrix mean? I am using the RWeka and this evaluate classifier does not work on new data like this e <- evaluate_Weka_classifier(m1235,newdata=XW4, complexity = FALSE,class = FALSE) while it work with negative indexing: e <- eva

Re: [R] data which has different size of elements in each row

2008-11-12 Thread yanniliu
I have the same problem. If the first row has more columns than later rows, the fill=TRUE works; however when the first row has LESS columns than later rows, R won't read in more columns than the length of the first row. Anyone has solutions? Yanni Marc Schwartz wrote: > > on 11/11/2008 03:39

[R] R code to generate Sweave input ? Sweave squared ?

2008-11-12 Thread Kem Phillips
Dirk, I came upon your message below in searching for a different Sweave topic. Have you pursued this? I'm new to R (9 months). Recently have been doing data analysis in R and have started pondering the same question, but don't have any ideas yet. I did do something related to this in SAS, th

[R] savage scores

2008-11-12 Thread Júlia Teles
Hi, I need to use the Savage scores to calculate a concordance coefficient. Does anybody know a package that computes these scores? Thank you, Júlia Teles [[alternative HTML version deleted]] __ R-help@r-project.org mailing list htt

[R] different results with plot.lm vs. plot.lm(which=c(2))

2008-11-12 Thread Effie Greathouse
I am running GLM models using the gamma family. For example: model <-glm(y ~ x, family=Gamma(link="identity")) I am getting different results for the normal Q-Q plot and the Scale-Location plot if I run the diagnostic plots without specifying the plot vs. if I specify the plot ... e.g., "plot(mod

Re: [R] R- transform data frame into matrix

2008-11-12 Thread Thorsten Raff
Thank you very much, looks rather simple when viewed from behind :( > Try this also: > xtabs(values ~ diagnosis + marker, data=dataframe) > You can make your examples self-running by providing fake data for > diagnosis, e.g. using letters[] instead of diagnosis. In addition, note that > your cb

Re: [R] R- transform data frame into matrix

2008-11-12 Thread Henrique Dallazuanna
Try this also: xtabs(values ~ diagnosis + marker, data=dataframe) On Wed, Nov 12, 2008 at 2:31 PM, Thorsten Raff <[EMAIL PROTECTED]>wrote: > Hello > > I have the problem that I want to transform a dataframe as generated by > > diagnosis <- rep(diagnosis[1:3], 3) > marker <- gl(3,3) > values <- r

[R] apply() just loops ?

2008-11-12 Thread Markus Loecher
Dear R users, I have been diligently using the apply() family in order to avoid explicit for loops and speed up computation. However, when I finally inspected the source code for apply, it appears that the core computation is a simple loop as well. What am I missing ? Why the often found advice to

Re: [R] any alternatives for complex for-loops?

2008-11-12 Thread Greg Snow
Here is one more approach (just to give more options): > x <- 1:10 > xx <- embed(x, 2) > rowMeans(xx) Or > complexFn(xx[,2], xx[,1]) Or other variants. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare [EMAIL PROTECTED] 801.408.8111 > -Original Message---

Re: [R] R- transform data frame into matrix

2008-11-12 Thread Dieter Menne
Thorsten Raff med2.uni-kiel.de> writes: > I have the problem that I want to transform a dataframe as generated by > > diagnosis <- rep(diagnosis[1:3], 3) > marker <- gl(3,3) > values <- rnorm(9) > dataframe <- cbind(diagnosis, marker, values) > dataframe <- dataframe[c(1:5, 7:9), ] > > into a m

[R] Having R (not the OS) redirect stderr() to stdout()

2008-11-12 Thread David Dahl
R users, I am aware that R can be invoked such that the operating system redirects standard error (stderr) to standard output (stdout), but I want to have R itself (not the OS) redirect the connection given by stderr() to connection given by stdout(). Is that possible? Perhaps equivalently, can

[R] Making R Package (how to include a library)

2008-11-12 Thread Vidhu Choudhary
Hi All, I am making a R package which uses some C code. and existing library.My src folder has some .c files. and a Makevars.in Makevars.in contains export PKG_LIBS="-L. -lbz2" R CMD SHLIB bed2vector.C R CMD SHLIB wdl.C R CMD SHLIB peaks.C R CMD SHLIB cdensum.c When I try library(libraryname). It

Re: [R] function that uses a variable name as the parameter

2008-11-12 Thread Greg Snow
David, Having a function that changes global variables is very frowned on with few exceptions. It falls into the category of things that you should never do unless you fully understand why you should never do them (also see fortune(36)). However, what you want to do may be more of a macro than

Re: [R] Crosstabs Output

2008-11-12 Thread Greg Snow
I don't know anything about RKWard, so I will leave that question to others (though my answer to the other questions may help, or may not). A couple of ways to mix text with plots when using pdf() (or other graphics output to files) are the textplot function in the gplots package and the addtab

Re: [R] creating a file of p.values

2008-11-12 Thread Peter Dalgaard
jim holtman wrote: > Try something like this (untested): > > Pvalues <- lapply(1:25, function(x)get(paste("A", i, sep=""))$p.value) He probably wants to start one level earlier, with the X1, etc. How about nm <- paste("X", 1:9, sep="") fml <- lapply(nm, function(nm)eval(bquote(.(as.name(nm))~t

Re: [R] odfweave

2008-11-12 Thread Shige Song
You are probably using Windows and do not have a compatible unzip program on your path. Shige On Wed, Nov 12, 2008 at 8:01 AM, Irina Ursachi < [EMAIL PROTECTED]> wrote: > Dear all, > > I am trying to use the function odfWeave. Unfortunately I cannot get > beyond the folllowing error message: > "

Re: [R] creating a file of p.values

2008-11-12 Thread Erik Iverson
Hello - [EMAIL PROTECTED] wrote: Hi all, I am performing hundreds of kruskal wallis tests and trying to figure out how to create a file of the p.values I obtain. This is the code I use for the tests: A2<-kruskal.test(X2~treatment) A3<-kruskal.test(X3~treatment) A4<-kruskal.test(X4~treatment)

Re: [R] Citing R in journal articles (or the failure to)

2008-11-12 Thread Achim Zeileis
On Wed, 12 Nov 2008, Michael Friendly wrote: One could complement that by a url = {http://CRAN.R-project.org/package=tweedie} In two recent in press articles where I cited R packages, I was asked by the copy-editor to add a location or url to the references. Could I suggest that citation()

Re: [R] Please help me about the regress models!

2008-11-12 Thread Greg Snow
I think what you need is a good consultant, and with that deadline don't expect any bargains. You have not specified your problem with enough detail yet, 2 options (there are probably many more) include: Use the nls function with the model as stated Use the lm function starting as lm( log( 100

Re: [R] Accessing Results from cenmle function in NADA package

2008-11-12 Thread Tom La Bone
This is very nice also. I am going to use this approach in the future when I use lm. However, I can't seem to get to work the way I want with cenmle. I will continue to experiment. Thanks folks for the suggestions. Tom David Winsemius wrote: > > > On Nov 12, 2008, at 8:48 AM, Tom La Bone wro

[R] R- transform data frame into matrix

2008-11-12 Thread Thorsten Raff
Hello I have the problem that I want to transform a dataframe as generated by diagnosis <- rep(diagnosis[1:3], 3) marker <- gl(3,3) values <- rnorm(9) dataframe <- cbind(diagnosis, marker, values) dataframe <- dataframe[c(1:5, 7:9), ] into a matrix where levels(diagnosis) is indicating the rows

Re: [R] creating a file of p.values

2008-11-12 Thread jim holtman
Try something like this (untested): Pvalues <- lapply(1:25, function(x)get(paste("A", i, sep=""))$p.value) On Wed, Nov 12, 2008 at 11:15 AM, <[EMAIL PROTECTED]> wrote: > Hi all, > I am performing hundreds of kruskal wallis tests and trying to figure out > how to create a file of the p.values I o

[R] creating a file of p.values

2008-11-12 Thread lave0083
Hi all, I am performing hundreds of kruskal wallis tests and trying to figure out how to create a file of the p.values I obtain. This is the code I use for the tests: A2<-kruskal.test(X2~treatment) A3<-kruskal.test(X3~treatment) A4<-kruskal.test(X4~treatment) A5<-kruskal.test(X5~treatment) A6<

Re: [R] exponential of a matrix

2008-11-12 Thread Vincent Goulet
Le mar. 11 nov. à 17:20, Terry Therneau a écrit : Is the matrix exponential available in some package? You may also have a look at the expm package for a very straightforward operator: http://r-forge.r-project.org/projects/expm/ Disclaimer: although entirely usable, the package i

Re: [R] Enquiries about time plots in R

2008-11-12 Thread Philipp Pagel
> I am trying to do some time plots with R but it seems that it > is not working. The problem is that the time is not regular, > for example, a small dataset can be seen below: > Date pH > 1/02/1998 5.5 > 5/03/1998 5 > 8/12/1998 6 > 1/02/1999 6.1 > ... > 08/10/200

[R] odfweave

2008-11-12 Thread Irina Ursachi
Dear all, I am trying to use the function odfWeave. Unfortunately I cannot get beyond the folllowing error message: " Error in odfWeave("Example3.rnw", "Example3.odf") : Error unzipping odt file " Can anybody tell me, how to use this function? Thanks, Irina Ursachi. ___

Re: [R] Enquiries about time plots in R

2008-11-12 Thread Gabor Grothendieck
Try this (in reality you would use the commented line in place of the subsequent line) and then read the three zoo vignettes and R News 4/1. library(zoo) library(chron) Lines <- "Date pH 1/02/1998 5.5 5/03/1998 5 8/12/1998 6 1/02/1999 6.1 08/10/20007.2" # z <-

Re: [R] read SAS file

2008-11-12 Thread Gabor Grothendieck
To be precise even if you don't use dep = TRUE you get the packages that are listed in that package's DESCRIPTION file on the "Depends:" and "Imports:" lines but if you use dep = TRUE you also get the ones in the "Suggests:" line (and recursively for dependencies of dependencies). On Wed, Nov 12,

[R] Enquiries about time plots in R

2008-11-12 Thread Lathouri, Maria
Dear all, My name is Maria Lathouri and I am currently doing a PhD at Imperial College of London about time series of environmental variables in surface waters. I am trying to do some time plots with R but it seems that it is not working. The problem is that the time is not regular, for exampl

Re: [R] Retrieving x argument name from a trellis object in R 2.8.0

2008-11-12 Thread vincenzo . 2 . di-iorio
Dear Deepayan, thanks for you quick response. The main idea is to use trellis_object$call$x as a label in a tcltk interface to choose one among several plots and perform a given task (e.g. print on screen, export as pdf etc.). I've a script that works just fine in R 2.4.1 for instance, but no

Re: [R] read SAS file

2008-11-12 Thread Philip Twumasi-Ankrah
If you are using the windows version, installing packages can be done easily from the prompt in the R work space by the following statement: install.packages("name_of_package", dep=TRUE) the part of dep=TRUE is to allow associated dependencies of packages tp be installed along side. This saves

[R] anova with ordered groups

2008-11-12 Thread Michele Pinelli
Hi, I have to do a comparison among three groups of genetic transcription levels. I have a situation like this: group 0: baseline group 1: first treatment group 2: second treatment In the first group, I have only 2 samples, in the second one 4 samples and in the last group I have 10 samples. I w

Re: [R] Generating Data for Simulation

2008-11-12 Thread Ben Bolker
Brett Magill sbcglobal.net> writes: > > Are there any R packages that could be used to generate random data given a > set of parameters? Or, if not a package, how would one generate such data? > What I would like to do is simulate some sample data for a regression model > given a set of populat

Re: [R] Accessing Results from cenmle function in NADA package

2008-11-12 Thread David Winsemius
On Nov 12, 2008, at 8:48 AM, Tom La Bone wrote: I figured it out. In case anyone else ever has this question -- given the following output from cenmle: fit.cen <- cenmle(obs, censored, groups) fit.cen Value Std. Errorz p (Intercept) 1.19473 0.0772 15.4

Re: [R] Accessing Results from cenmle function in NADA package

2008-11-12 Thread Tom La Bone
Oh, I like your answer better than mine! Thanks. Tom Richard Cotton wrote: > >> I figured it out. In case anyone else ever has this question -- given > the >> following output from cenmle: >> >> >fit.cen <- cenmle(obs, censored, groups) >> > fit.cen >>Value Std. Error

Re: [R] Make one vector from matrix comparison

2008-11-12 Thread Stavros Macrakis
You can just call `c` on your result to flatten the matrix into a vector. You could also eliminate the for-loops by using the `apply` function: pairwise_setequal <- function(a,b) c(apply(a, 1, function(r){ apply(b, 1, setequal, r ) } )) But are you sure that is what you want to do? In the ca

Re: [R] Citing R in journal articles (or the failure to)

2008-11-12 Thread hadley wickham
> Along similar lines, someone recently posted a script to generate > a .bib file for all packages installed. It would be useful if someone > were to implement that script for CRAN and make the resulting > R-packages.bib file available on the CRAN site. It would also be useful if citation() added

Re: [R] R: R: Hidden Markov Models

2008-11-12 Thread Ingmar Visser
Dear Maura, On 12 Nov 2008, at 00:53, <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> wrote: > Thank you for your prompt answer. > The breathing signal observations are the amplitude values as a > function of time and phase. > According to our model the hidden states are the different > breathing typ

Re: [R] Citing R in journal articles (or the failure to)

2008-11-12 Thread Michael Friendly
Achim Zeileis wrote: ... [ snip ] ... R> citation("tweedie") To cite package 'tweedie' in publications use: Peter K Dunn (2007). tweedie: Tweedie exponential family models. R package version 1.5.2. A BibTeX entry for LaTeX users is @Manual{, title = {tweedie: Tweedie exponential fam

Re: [R] standard errors for predict.nls?

2008-11-12 Thread Ben Bolker
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 That does seem reasonable. But: the boot package has several fancy (or at least let's just say non-naive) methods for computing confidence intervals that are different from the simple quantile approach. I haven't read the Davison and Hinkley book t

Re: [R] Accessing Results from cenmle function in NADA package

2008-11-12 Thread Richard . Cotton
> I figured it out. In case anyone else ever has this question -- given the > following output from cenmle: > > >fit.cen <- cenmle(obs, censored, groups) > > fit.cen >Value Std. Errorz p > (Intercept) 1.19473 0.0772 15.4695 5.58e-54 > groups1 0.00208

Re: [R] standard errors for predict.nls?

2008-11-12 Thread R Heberto Ghezzo, Dr
Sorry if I am being too naive but if: after puro.boot=boot(rs,puro.bf2,R=1000) # # we do # qq <- apply(puro.boot$t,2,quantile) matplot(t(qq),type="l") points(st$conc,st$rate) points(st$conc,predict(puro1),pch=2,col="red") # isn't that what we want graphically and t(qq) gives us the values obviousl

Re: [R] choice of an HMM package

2008-11-12 Thread Ingmar Visser
Dear Maura, On 9 Nov 2008, at 02:24, Maura E Monville wrote: > We are trying to build a human respiration model. > Preliminary analysis of some breathing signals has shown that > humans breathe > through switching among > a finite number of patterns. > Hidden Markov seems to be the right approa

Re: [R] any alternatives for complex for-loops?

2008-11-12 Thread Kinoko
Gentlemen, Thank you for all your help. This list is really amazing. Following Erik's hint I have managed to find the answer: complexFn <- function(a,b){ c <- (a+b)/2 return(c) } x <- zoo(1:10) rollapply(x,width=2, function(xx) complexFn(xx[1],xx[2])) _

  1   2   >