Re: [R] sum data from data.frame in a matrix

2011-02-23 Thread Dennis Murphy
Hi: df - read.table(textConnection( + xloc yloc yield + 1 101295 + 2 111081 + 3 121120 + 4 121110), header = TRUE) with(df, xtabs(yield ~ yloc + xloc)) xloc yloc 10 11 12 10 0 81 0 11 0 0 30 12 95 0 0 HTH, Dennis On Tue, Feb 22, 2011 at

[R] Fwd: Re: sum data from data.frame in a matrix

2011-02-23 Thread Nicolas Gutierrez
Hi Dennis, Thanks for your quick response and sorry for not being clear. That helped, but I need an actual matrix of e.g., 12 x 12 and those functions give me a matrix with only the filled locations. I need a 12 by 12 matrix with sums (0 if there's not data and the actual sum where there is)

Re: [R] sum data from data.frame in a matrix

2011-02-23 Thread Dennis Murphy
Hi: df$xloc - factor(df$xloc, levels = 1:12) df$yloc - factor(df$yloc, levels = 1:12) with(df, xtabs(yield ~ xloc + yloc)) yloc xloc 1 2 3 4 5 6 7 8 9 10 11 12 1 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 3 0 0 0 0 0 0 0 0 0 0 0

[R] list multiplied by a factor / mapply

2011-02-23 Thread Patrick Hausmann
Dear list, this works fine: x - split(iris, iris$Species) x1 - lapply(x, function(L) transform(L, g = L[,1:4] * 3)) but I would like to multiply each Species with another factor: setosa by 2, versicolor by 3 and virginica by 4. I've tried mapply but without success. Any thoughts? Thanks for

Re: [R] Null values from DBI connection

2011-02-23 Thread Raji
Hi Albert, Did u get the answer for this problem? I am connecting to a mysql database through RJDBC and i am facing the same problem? Regards, Raji -- View this message in context: http://r.789695.n4.nabble.com/Null-values-from-DBI-connection-tp2954845p3320611.html Sent from the R help mailing

Re: [R] Plot Stepped Line chart with multiple lines

2011-02-23 Thread Techni X
Hi Ista, David, your answers indeed helped me to solve the problem! So thanks to you and have a good day! Stephan --- On Wed, 2/23/11, David Winsemius dwinsem...@comcast.net wrote: From: David Winsemius dwinsem...@comcast.net Subject: Re: [R] Plot Stepped Line chart with multiple lines To:

[R] Transfer function observed vs predicted values graph problem

2011-02-23 Thread mdc
Hi, I am trying to make a palaeoenvironmental transfer function using the R package rioja that predicts the water-table (measured as depth to the water table) of an area given the testate amoebae that are found there. I've carried out weighted averaging of the data and am trying to produce a

[R] Ubuntu Maverick and revoIPC/doSMP

2011-02-23 Thread Costas
Hello, I am having trouple installing doSMP and revoIPC from: https://r-forge.r-project.org/R/?group_id=950 My Linux system: Linux 2.6.35-25-generic #44-Ubuntu SMP Fri Jan 21 17:40:44 UTC 2011 x86_64 GNU/Linux Ubuntu 10.10 \n \l I get this reply: costas@ELEPHANT:~/Downloads$ sudo R CMD

[R] Problem with Mclust

2011-02-23 Thread Lorenzo Isella
Dear All, I fear I am badly misunderstanding something fundamental about the mclust package. Please considered the dataset pasted at the end of the email (you can also have a look at http://dl.dropbox.com/u/5685598/dataedges.csv ). Now, I would like to use the info on columns 1,2 and 4

[R] Bonnet-Price CI for difference between two medians

2011-02-23 Thread Wilson, Andrew
I was wondering if anyone has produced any R code for the Bonnet-Price 95% confidence interval for the difference between two medians? Refs: Price, R.M. Bonnet, D.G. 2002. Distribution-free confidence intervals for difference and ratio of medians. J. Statist. Comput. Simul. 72(2), 119-124.

[R] MLE

2011-02-23 Thread dpender
Hi, I am having problems carrying out a mle for 3 parameters in a non-homogenous poisson process. I am trying to use the optim function to minimise the -ve log-likelihood. When I use assumed values of my three parameters (20,1,1) the -ve log-likelihood function returns a value of 1309122 but I

[R] Fuzzy Discriminant Analysis (DA)

2011-02-23 Thread Jay
Hello all, as the combination DA and R is rather new to me I would like to know: are there packages that implement a fuzzy version of Discriminant Analysis? Thanks! __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help

[R] lattice.wireframe missing wireframe

2011-02-23 Thread Michael Bach
Hello Everyone, I am using R ver. 2.10.1 (2009-12-14). I installed lattice today via install.packages. I am doing this minimal example: M = read.csv(/path/to/csv) cloud(x ~ y * z, data = M) this correctly gives me a scatterplot of the csv data which has 3 columns. Every column contains 1800

[R] can you extract predictions for gaussian process in using lme, can you fit matern class in lme

2011-02-23 Thread Taylor-Robinson, David
Dear R users group I have a couple of questions: 1. I'm fitting a linear mixed effects model using lme (package nlme) with gaussian errors (using exponential correlation structure at the moment): Is it possible to extract predictions for the gaussian process? exp1 -

Re: [R] mgcv: beta coefficient and 95%CI

2011-02-23 Thread David Winsemius
On Feb 22, 2011, at 11:34 PM, clc wrote: Hi i am doing an environmental research The equation is as follow: gam(y1 ~ x1 + s(x2) + s(x3) + s(x4), family = gaussian, fit = true) I would like to obtain the beta coefficient and 95CI of x4 (or s(x4)), what should I do? You should re-think

Re: [R] mgcv: beta coefficient and 95%CI

2011-02-23 Thread clc
Thanks a lot. In many papers, they reported the changes and 95% ci in the interquartile range, how can I obtain such figure using gam? Thanks! -- View this message in context: http://r.789695.n4.nabble.com/mgcv-beta-coefficient-and-95-CI-tp3320491p3320922.html Sent from the R help mailing list

Re: [R] Set size of plot: in pdf() or par() ?

2011-02-23 Thread Matthieu Stigler
Dear R List Could I ask again my question about where the size of a plot should be specified (in par or pdf?). I still did not figure out, and any help would be much appreciated!! Thanks a lot! Matthieu Le 22. 02. 11 13:53, Matthieu Stigler a écrit : Hi I want to have a rectangular plot

[R] building zipped package with windows

2011-02-23 Thread Jannis
Dear list, i would like to build an own package using: R CMD INSTALL --html --build --auto-zip -l folder spectral.methods it seems to succeed as I get the following messages: * installing *source* package 'spectral.methods' ... ** R ** data Warning: empty 'data' directory ** preparing package

Re: [R] list multiplied by a factor / mapply

2011-02-23 Thread David Winsemius
On Feb 23, 2011, at 4:11 AM, Patrick Hausmann wrote: Dear list, this works fine: x - split(iris, iris$Species) x1 - lapply(x, function(L) transform(L, g = L[,1:4] * 3)) but I would like to multiply each Species with another factor: You will probably confuse yourself by not adopting R

Re: [R] mgcv: beta coefficient and 95%CI

2011-02-23 Thread David Winsemius
On Feb 23, 2011, at 7:32 AM, clc wrote: Thanks a lot. In many papers, they reported the changes and 95% ci in the interquartile range, how can I obtain such figure using gam? Thanks! I suppose I could be wrong (not being an avid user of GAMs), but reporting a 95% CI for the

Re: [R] Set size of plot: in pdf() or par() ?

2011-02-23 Thread Ista Zahn
It should be specified in pdf() as you did. If you try pdf(try.pdf, height=2, width=2) par(pin=c(0.5, 0.3),mai=rep(0.1,4), omi=rep(0.01,4), mar=c(5,4,4,2)) plot(runif(100)) dev.off() I think the problem will become apparent. best, Ista On Wed, Feb 23, 2011 at 12:39 PM, Matthieu Stigler

Re: [R] Set size of plot: in pdf() or par() ?

2011-02-23 Thread Matthieu Stigler
Dear Ista Thanks a lot for your help! However, when I spedify the right size I wish (the same as specified in par() ) I get an error: pdf(try.pdf, height=0.5, width=0.3) par(pin=c(0.5, 0.3),mai=rep(0.1,4), omi=rep(0.01,4), mar=c(5,4,4,2)) plot(runif(100)) dev.off() I don't see why my

Re: [R] building zipped package with windows

2011-02-23 Thread Prof Brian Ripley
On Wed, 23 Feb 2011, Jannis wrote: Dear list, i would like to build an own package using: R CMD INSTALL --html --build --auto-zip -l folder spectral.methods it seems to succeed as I get the following messages: * installing *source* package 'spectral.methods' ... ** R ** data Warning: empty

Re: [R] building zipped package with windows

2011-02-23 Thread Jannis
Thanks for your reply. I was puzzled as well with the message that a zipped file was (said to be) created, but I could not find any zipped file. Running the command only creates an unpacked folder with the package name at the specified path. Jannis --- Prof Brian Ripley rip...@stats.ox.ac.uk

[R] Using string to call/manipulate an object

2011-02-23 Thread Kushan Thakkar
I am using getSymbols function from quantmod package to get price data from internet. Currently I have: my.ticker - IBM getSymbols(my.ticker,src=google) This creates an xts object named my.ticker which contains historical price data for IBM. How can I call and manipulating this xts object

[R] Over-constrained? gamma mixtures using R: mix{mixdist}

2011-02-23 Thread Roger Humphry
Dear R-help, my aim is to fit a constrained 2 component gamma mixture using mix within package mixdist. The constraints being fixing both of the means and both of the sigmas. Thus the only unconstrained parameter I wish to fit is pi the proportions of the mixtures. This is the code I used:

Re: [R] Set size of plot: in pdf() or par() ?

2011-02-23 Thread David Winsemius
On Feb 23, 2011, at 8:32 AM, Matthieu Stigler wrote: Dear Ista Thanks a lot for your help! However, when I spedify the right size I wish (the same as specified in par() ) I get an error: pdf(try.pdf, height=0.5, width=0.3) par(pin=c(0.5, 0.3),mai=rep(0.1,4), omi=rep(0.01,4),

[R] Conflict with Impulse Response Function

2011-02-23 Thread CALEF ALEJANDRO RODRIGUEZ CUEVAS
Hello buddies. I'm trying to use the granger.test function wich is included in MSBVAR package, but I'm also using the package var in order to develop vector autorregresion analysis. Everything is well behaved...but when I'm trying to use the irf function when I have both libraries open there is

Re: [R] building zipped package with windows

2011-02-23 Thread Jannis
Sorry, it seems as this was my mistake. I did not set the PATH environment correctly. Now it works perfectly! As the status messages told me that a zip file was created I thought that rtools was integrated correctly. Thanks for your help Jannis --- Prof Brian Ripley rip...@stats.ox.ac.uk

Re: [R] Using string to call/manipulate an object

2011-02-23 Thread David Winsemius
On Feb 23, 2011, at 8:55 AM, Kushan Thakkar wrote: I am using getSymbols function from quantmod package to get price data from internet. Currently I have: my.ticker - IBM getSymbols(my.ticker,src=google) This creates an xts object named my.ticker which contains historical price data

[R] Plot confidence intervals

2011-02-23 Thread Iker Vaquero Alba
   Hello, list:    I'm not sure about where to send this question. I have several repeatability calculations, together with their 95% confidence intervals, and I would like to plot them, in a way similar to error bars. I was wondering if there is any specific function to do this, or any

Re: [R] Using string to call/manipulate an object

2011-02-23 Thread Kushan Thakkar
@Scott: I can't just use colnames(IBM) - c(open,high,low,close,vol) I have nearly 100 tickers stored in an vector and I am looping through them. Its not a good idea to hardcode all of them. @David: Column names is just an example. I have a long script that takes in an xts object and performs

[R] GLM, how to get an R2 to explain how much of data explained by one variable?

2011-02-23 Thread Céline Geiser
__ 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-guide.html and provide commented, minimal, self-contained, reproducible code.

Re: [R] Set size of plot: in pdf() or par() ?

2011-02-23 Thread Mark Difford
On Feb 23, 2011; 03:32pm Matthieu Stigler wrote: I want to have a rectangular plot of size 0.5*0.3 inches. I am having surprisingly a difficult time to do it... ...snip... If I specifz this size in pdf(), I get an error... pdf(try.pdf, height=0.3, width=0.5) par(pin=c(0.5,

Re: [R] mgcv: beta coefficient and 95%CI

2011-02-23 Thread clc
In one of the papers... We developed core models with a generalized additive Poisson regression allowing for over-dispersion in the model (Wood, 2006). For each mortality outcome, variations in seasonality, trends, mean temperature, and mean humidity of current and previous days (lag 0–1) were

Re: [R] Using string to call/manipulate an object

2011-02-23 Thread Scott Chamberlain
this works: colnames(IBM) - c(open,high,low,close,vol) scott On Wednesday, February 23, 2011 at 7:55 AM, Kushan Thakkar wrote: colnames(my.ticker) - c(open,high,low,close,vol) [[alternative HTML version deleted]] __ R-help@r-project.org

[R] (no subject)

2011-02-23 Thread michele tettamanzi
dear R-utents, does anybody of you knows if there are some specific function, already stored in some libraries, which allow me to calculate straightforward McFadden-R^2,,pseudo-R^2, p-hat (the ML estimator for p) and the goodness of fit R^2p? thanks in advance! michi

Re: [R] Transforming relational data

2011-02-23 Thread mathijsdevaan
Thanks Matthew that worked great. What a great forum this is: I am learning a lot! PS. I am now running both solutions on two similar computers. Let's see which is fastest. -- View this message in context: http://r.789695.n4.nabble.com/Re-Transforming-relational-data-tp3307449p3321214.html

[R] Don't know which model indrc package is to be used to find EC values.

2011-02-23 Thread Syamkumar R
Hi every one, I am using the package 'drc' to model root elongation using dose response data. I don't know which model I should use. Though I don't know which model I should use, I tried the following codes given below. But it produced the error messages.Can any one tell me the code in 'drc'

[R] The L Word

2011-02-23 Thread Gene Leynes
I've been wondering what L means in the R computing context, and was wondering if someone could point me to a reference where I could read about it, or tell me what it's called so that I can search for it myself. (L by itself is a little too general for a search term). I encounter it in strange

Re: [R] Plot confidence intervals

2011-02-23 Thread Mohamed Lajnef
Hi Iker, matlines function to plot 956 % confidence intervals after using predict function. barplot function for errors bars. hope this help M Regards Le 23/02/11 16:00, Iker Vaquero Alba a écrit : Hello, list: I'm not sure about where to send this question. I have several

Re: [R] building zipped package with windows

2011-02-23 Thread Prof Brian Ripley
On Wed, 23 Feb 2011, Jannis wrote: Sorry, it seems as this was my mistake. I did not set the PATH environment correctly. Now it works perfectly! As the status messages told me that a zip file was created I thought that rtools was integrated correctly. I don't see a mention of your R

Re: [R] The L Word

2011-02-23 Thread Erik Iverson
Gene, it's described in ?NumericConstants HTH, Erik Gene Leynes wrote: I've been wondering what L means in the R computing context, and was wondering if someone could point me to a reference where I could read about it, or tell me what it's called so that I can search for it myself. (L by

Re: [R] Using string to call/manipulate an object

2011-02-23 Thread Jonathan P Daily
If you are looping through and have the names of the files as characters, say in ticker.names - c(IBM, ...), you may be able to do this using: for(nam in ticker.names) { [snip...] eval(parse(text = paste('colnames(', nam, ') - c( open,high,low,close,vol)', sep = ''))) } HTH, Jon

Re: [R] The L Word

2011-02-23 Thread Claudia Beleites
On 02/23/2011 05:08 PM, Gene Leynes wrote: I've been wondering what L means in the R computing context, and was wondering if someone could point me to a reference where I could read about it, or tell me what it's called so that I can search for it myself. (L by itself is a little too general

Re: [R] Using string to call/manipulate an object

2011-02-23 Thread Gabor Grothendieck
On Wed, Feb 23, 2011 at 8:55 AM, Kushan Thakkar ktha...@gmail.com wrote: I am using getSymbols function from quantmod package to get price data from internet. Currently I have: my.ticker - IBM getSymbols(my.ticker,src=google) This  creates an xts object named my.ticker which contains

Re: [R] The L Word

2011-02-23 Thread Tsjerk Wassenaar
Hi Gene, It means 'Literal integer'. So 1L is a proper integer 1, and 0L is a proper integer 0. Hope it helps, Tsjerk On Wed, Feb 23, 2011 at 5:08 PM, Gene Leynes gleyne...@gmail.com wrote: I've been wondering what L means in the R computing context, and was wondering if someone could point

Re: [R] Set size of plot: in pdf() or par() ?

2011-02-23 Thread Matthieu Stigler
Thanks Mark! But how does the resulting plot look like on your machine? For me, it is terrible... I tried then removing the mai par (to 0.01), and then got huge circles... It looks like there are many more parameters, I changed then cex, got better but still many adjustments... seems a

Re: [R] Using string to call/manipulate an object

2011-02-23 Thread David Winsemius
On Feb 23, 2011, at 10:23 AM, Kushan Thakkar wrote: @Scott: I can't just use colnames(IBM) - c(open,high,low,close,vol) Well, you can. I have nearly 100 tickers stored in an vector and I am looping through them. Its not a good idea to hardcode all of them. Perhaps putting the ticker

Re: [R] mgcv: beta coefficient and 95%CI

2011-02-23 Thread Simon Wood
Isn't the point here that they used smooths for the other terms but a linear effect (or several) for (lagged) visibility. So you do have a beta in this case, and the gam summary would tell you what it is estimated to be and what the associated standard error is. The 'coef' and 'vcov' functions

Re: [R] The L Word

2011-02-23 Thread jim holtman
The notation '1L' mean to interprete the data as an 'integer'. str(1) num 1 str(1L) int 1 str(0xaa) num 170 str(0xaaL) int 170 On Wed, Feb 23, 2011 at 11:08 AM, Gene Leynes gleyne...@gmail.com wrote: I've been wondering what L means in the R computing context, and was wondering if

[R] svm(e1071) and scaling of weights

2011-02-23 Thread Juergen Rose
I expected, that I will get the same prediction, if I multiply the weights for all classes with a constant factor, but I got different results. Please look for the following code. library(e1071) data(Glass, package = mlbench) index - 1:nrow(Glass) testindex - sample(index,

Re: [R] Set size of plot: in pdf() or par() ?

2011-02-23 Thread Peter Ehlers
Matthieu, A couple of points that you may be misunderstanding: 1. your 'mar' setting overwrites the 'mai' setting; use one or the other. 2. pdf(width=0.5, height=0.3) sets the *device* region dimensions, not the *plot* region. The thing to remember is that device contains figure contains plot.

[R] repeated execution of svm(e1071) gives different results, if probability = TRUE is set

2011-02-23 Thread Juergen Rose
I called svm and predict three times with the same data and got three differing predictions: library(e1071) Lade nötiges Paket: class data(Glass, package = mlbench) index - 1:nrow(Glass) testindex - sample(index, trunc(length(index)/5)) testset - Glass[testindex, ] trainset -

Re: [R] mgcv: beta coefficient and 95%CI

2011-02-23 Thread David Winsemius
In addition to Simon Wood's reading of the methods I am adding a minor note on terminology: What was reported was the ratio in risk per a difference equal to the interquartile range (of the predictor variable), and the 95% CI for such an estimate. They were not reporting a 95% CI for the

Re: [R] The L Word

2011-02-23 Thread Gene Leynes
Thank you everyone, that makes a lot more sense now. It's not at all what I would have guessed! (I thought that it might have to do with scope) It's one of those little things would add just enough confusion that I would sort of tune out whenever I saw it. So, I really appreciate having this

Re: [R] Transforming relational data

2011-02-23 Thread Gabor Grothendieck
On Wed, Feb 23, 2011 at 10:46 AM, mathijsdevaan mathijsdev...@gmail.com wrote: Thanks Matthew that worked great. What a great forum this is: I am learning a lot! PS. I am now running both solutions on two similar computers. Let's see which is fastest. If your data is small its pointless to

[R] conditional seq

2011-02-23 Thread mathijsdevaan
Hi, I have two questions: 1. How do I combine DF$F = and DF$G = into one function? (The original dataset contains many more columns for which I want to execute the same operation) 2. How do I improve the ave function so that the value DF(12,G) = 0 instead of 1 (see bold font)? Both

[R] Using R to calculate ICC by two-way mixed model with absolute agreement

2011-02-23 Thread timan
I am helping someone calculate ICC using R. I know R has several packages like irr, psy etc which provide options to calculate ICC (intraclass correlation coefficient). When getting ICC, we need to use the model: two-way mixed model with absolute agreement. I only found that in irr package, it

Re: [R] conditional seq

2011-02-23 Thread Joshua Wiley
On Wed, Feb 23, 2011 at 8:32 AM, mathijsdevaan mathijsdev...@gmail.com wrote: Hi, I have two questions: 1. How do I combine DF$F = and DF$G = into one function? (The original dataset contains many more columns for which I want to execute the same operation) Just define a function that can

Re: [R] lattice.wireframe missing wireframe

2011-02-23 Thread David Winsemius
On Feb 23, 2011, at 5:47 AM, Michael Bach wrote: Hello Everyone, I am using R ver. 2.10.1 (2009-12-14). I installed lattice today via install.packages. I am doing this minimal example: M = read.csv(/path/to/csv) cloud(x ~ y * z, data = M) this correctly gives me a scatterplot of the csv

Re: [R] list multiplied by a factor / mapply

2011-02-23 Thread Henrique Dallazuanna
Try this: x1 - transform(iris, g = iris[-ncol(iris)] * (as.numeric(iris$Species) + 1 )) On Wed, Feb 23, 2011 at 6:11 AM, Patrick Hausmann patrick.hausm...@uni-bremen.de wrote: Dear list, this works fine: x - split(iris, iris$Species) x1 - lapply(x, function(L) transform(L, g = L[,1:4] *

[R] negative binomial latent class regression in package flexmix

2011-02-23 Thread Carson Farmer
Hello list, Has anyone had any luck creating an M-step driver for negative binomial regression for use with package flexmix? I've had a look here: http://cran.r-project.org/web/packages/flexmix/vignettes/flexmix-intro.pdf as well as poking around in the flexmix source, but I haven't had much luck

[R] parallel bootstrap linear model on multicore mac

2011-02-23 Thread Anthony Dick
People of R(th), I have been ramming my head against this problem, and I wondered if anyone could lend a hand. I want to parallelize a bootstrap of a linear model on my 8-core mac. Below is the process that I want to parallelize (namely, the m2.ph.rlm.boot-boot(m2.ph,m2.ph.fun, R = nboot)

[R] integer constraint

2011-02-23 Thread Chun Wang
Dear R users, I have a question about optimization. Is that possible set a constraint that only integer values are allowed for the optim in the R base and some other optimizers such as psoptim in the package pso? For instance, my lower bound is 0 and upper bound is 100 and I only want integer

Re: [R] conditional seq

2011-02-23 Thread mathijsdevaan
Thanks, learned something new again. About my second question: You're right, the input rows are similar, but cumsum(z) - z generates dissimilar output rows. The rule I want to define is: if input rows are repeated, replace the output row with the minimum value of the output row. So (the

Re: [R] Plotting individual trajectories from individual growth model

2011-02-23 Thread dadrivr
Thanks guys, I had to change two things to get it to work: 1. As Dennis pointed out, all of the variables in the model had to be variable names in the preds data frame. 2. I had to use na.pass in the following statement to be able to merge the predicted values with the preds data frame because

Re: [R] Removing elements ..., NO bug in which() function

2011-02-23 Thread Martin Maechler
RK == Rumen Kostadinov rkost...@gmail.com on Sun, 13 Feb 2011 12:46:52 -0500 writes: RK Thanks Sarah, RK Yes, the function behaves Exactly as documented: RK check this out: a = c(1,2,3,4,5) a[which(a!=6)] RK [1] 1 2 3 4 5 a[!which(a==6)] RK numeric(0)

[R] Which glm familiy to choose with a skewed distribution of residuals, gaussian?

2011-02-23 Thread Céline Geiser
__ 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-guide.html and provide commented, minimal, self-contained, reproducible code.

Re: [R] integer constraint

2011-02-23 Thread Petr Savicky
On Wed, Feb 23, 2011 at 08:02:16PM +0100, Chun Wang wrote: Dear R users, I have a question about optimization. Is that possible set a constraint that only integer values are allowed for the optim in the R base and some other optimizers such as psoptim in the package pso? For instance, my

Re: [R] Which glm familiy to choose with a skewed distribution of residuals, gaussian?

2011-02-23 Thread Joshua Wiley
Dear Céline, First of all, this list is primarily for questions related to using R, not statistical questions. Regardless, you would receive better feedback if you provided more information and details. What type of data are you modelling? You say your distribution is skewed---how is it

Re: [R] copy values from one dataframes into another

2011-02-23 Thread D Sonderegger
What you want to do is create a new dataframe that includes all the years. newdata - data.frame( Year=1981:1988 ) merge(fire, newdata, all=TRUE) If you don't include the all=TRUE, then you only get the rows that are contained in both datasets. -- View this message in context:

[R] Weighted Mean By Factor Using BY

2011-02-23 Thread Mike Schumacher
Hello R folks, Reproducible code below - I'm trying to do a weighted mean by a factor and can't figure it out. Thanks in advance for your assistance. Mike data-data.frame(c(5,5,1,1,1), c(10,8,9,5,3), c(A,A,A,B,B))

Re: [R] Weighted Mean By Factor Using BY

2011-02-23 Thread Mike Schumacher
I withdraw this question, I was able to accomplish this by creating a new function. Now if only I could get the by output into a dataframe... Mike On Wed, Feb 23, 2011 at 2:25 PM, Mike Schumacher mike.schumac...@gmail.comwrote: Hello R folks, Reproducible code below - I'm trying to do a

[R] copy values from one dataframes into another

2011-02-23 Thread saba
Hello everyone, I have the following problem, I have a dataframes that looks like this: fire$Year fire$Size 1 19811738.0 2 19842228.1 3 1985 38963.3 4 19862223.4 5 19873594.6 6 19881520.0 ... What I would like to do is copy the values from

Re: [R] Weighted Mean By Factor Using BY

2011-02-23 Thread Bill.Venables
Here is the party line, perhaps by(data, data$TYPE, function(dat) with(dat, weighted.mean(MEASURE, COUNT))) -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Mike Schumacher Sent: Thursday, 24 February 2011 9:40 AM To:

[R] Basic NLME syntax

2011-02-23 Thread nrm2010
Hello, I'm trying to use NLME for a non-linear model with one random effect that is the same as the one grouping level (chamber). Using the following statement: test - nlme(flux ~ b0 * exp((b1*soiltemp) - (b2*soiltemp^2)) * vpd^b3 * mstsoil2^b4 * airtemp^b5, data = ac5, fixed = list(b0 + b1 +

[R] Nested logit

2011-02-23 Thread Luis Felipe Parra
Hello. Does anybody know how to estimate nested logit models in R? I know that the package mlogit does it, but It doesn´t report the logsum parameters. I would like to have the logsum parameters, and the elasticites if possible. Thank you Felipe Parra [[alternative HTML version

[R] split the data

2011-02-23 Thread yf
x-data.frame(id=c(1,1,2,2,3,3,4,4), v1=c(1:8), V2=c(9:16)) x id v1 V2 1 1 1 9 2 1 2 10 3 2 3 11 4 2 4 12 5 3 5 13 6 3 6 14 7 4 7 15 8 4 8 16 1) I want to split the data into 2 group with one unique ID. I should use the split function but i don't know how to write it out. 2)

[R] Group rows by common ID and plot?

2011-02-23 Thread DB1984
Suspect that this is easier than I realize, but taking some figuring out currently. Any help would be appreciated. I have a data frame (testhm) with many rows such as: ProbeSet.ID.F ProbeSet.ID Feature.ID G.S X0030V120810.14 X0143V120110.14 X0258V111710.14 X0283V111710.14 X0430V120710.14

Re: [R] copy values from one dataframes into another

2011-02-23 Thread Scott Chamberlain
Hi Sandra, Terribly ugly, but this way at least you don't have to know which years are missing, etc.: dat - data.frame(year = c(1981,1984,1985,1986), size = c(1,2,3,4)) year_ - data.frame(year = seq(1981,1986,1)) year_dat - merge(year_, dat, by = year, all=T) na_s - subset(year_dat,

[R] how to plot equalprobable error ellipse?

2011-02-23 Thread Jie TANG
hi,R users, Now I have some scatter figures, is there some method can plot equalprobable error ellipse ? -- TANG Jie Email: totang...@gmail.com Tel: 0086-2154896104 Shanghai Typhoon Institute,China [[alternative HTML version deleted]] __

Re: [R] Removing elements ..., NO bug in which() function

2011-02-23 Thread Henrik Bengtsson
On Wed, Feb 23, 2011 at 1:02 PM, Martin Maechler maech...@stat.math.ethz.ch wrote: RK == Rumen Kostadinov rkost...@gmail.com     on Sun, 13 Feb 2011 12:46:52 -0500 writes:    RK Thanks Sarah,    RK Yes, the function behaves Exactly as documented:    RK check this out:     a = c(1,2,3,4,5)

Re: [R] how to plot equalprobable error ellipse?

2011-02-23 Thread David Winsemius
On Feb 23, 2011, at 10:06 PM, Jie TANG wrote: hi,R users, Now I have some scatter figures, is there some method can plot equalprobable error ellipse ? Consider searching?

Re: [R] split the data

2011-02-23 Thread Dennis Murphy
Hi: Is this what you want? x$gpvar - rep(c(1, 2), 4) split(x, x$gpvar) $`1` id v1 V2 gpvar 1 1 1 9 1 3 2 3 11 1 5 3 5 13 1 7 4 7 15 1 $`2` id v1 V2 gpvar 2 1 2 10 2 4 2 4 12 2 6 3 6 14 2 8 4 8 16 2 HTH, Dennis On Wed, Feb 23, 2011 at 5:16

Re: [R] mgcv: beta coefficient and 95%CI

2011-02-23 Thread clc
Thanks a lot for David and Simon! Got it~ -- View this message in context: http://r.789695.n4.nabble.com/mgcv-beta-coefficient-and-95-CI-tp3320491p3322037.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing

[R] Removing -Inf values from all the colums in a dataframe

2011-02-23 Thread Ramya
Hi there, b is my dataframe. I have a dataframe. I am trying to get rid of the -INF values but didnt have much luck b[which(is.finite(b))] I can get rid of it for a single column b[,1][which(is.finite(b[,2]))] but not for all dataframe I used it inside of a sapply but still no dice my guess

[R] Colors in bwplot with drop.unused.levels=F

2011-02-23 Thread Cram Rigby
Hi, I see an inconsistency with how color vectors are handled in bwplot. I wanted to create side-by-side boxplots with alternating colors so I used the interaction command to create an interaction of two factors. bwplot(value ~ interaction(response,dose), data=test,