Re: [R] Spline Question

2012-02-15 Thread Jeff Newmiller
What part of read the posting guide did you not understand? The provide commented, minimal, self-contained, reproducible code part? --- Jeff NewmillerThe . . Go Live...

Re: [R] matching a sequence in a vector?

2012-02-15 Thread Petr Savicky
On Wed, Feb 15, 2012 at 02:17:35PM +1000, Redding, Matthew wrote: Hi All, I've been trawling through the documentation and listserv archives on this topic -- but as yet have not found a solution. I'm sure this is pretty simple with R, but I cannot work out how without resorting to

Re: [R] Spline Question

2012-02-15 Thread Michael Bedward
On 15 February 2012 19:00, Jeff Newmiller jdnew...@dcn.davis.ca.us wrote: What part of read the posting guide did you not understand? The provide commented, minimal, self-contained, reproducible code part? Off topic: why is there so much unfriendliness on this thread ? Both the above and DW's

Re: [R] matching a sequence in a vector?

2012-02-15 Thread Rainer M Krug
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 15/02/12 05:17, Redding, Matthew wrote: Hi All, I've been trawling through the documentation and listserv archives on this topic -- but as yet have not found a solution. I'm sure this is pretty simple with R, but I cannot work out how

Re: [R] Spline Question

2012-02-15 Thread Berend Hasselman
On 14-02-2012, at 22:14, Hasan Diwan wrote: dput(sensor.sample) structure(c(1328565718.65, 1328566608.9, 1328566162.65, 1328566571.1, 1328566598.85, 1328565634.3, 1328566513.95, 1328565123.65, 1328565827.1, .. What I'd like to do is get a spline through all the points. I'm thinking the

Re: [R] matching a sequence in a vector?

2012-02-15 Thread chuck.01
this is ugly, but... l -length(patrn) l2 -length(exmpl) out - vector(list) for(i in 1:(l2-l+1)) { exmpl[i:(i+l-1)] patrn==exmpl[i:(i+l-1)] if(all(patrn==exmpl[i:(i+l-1)])) { out[[i]] - i } else { out[[i]] - NA} } out - do.call(c, out) as.numeric(out[which(out!=NA)]) ## Cheers and

[R] Error while doing T-test

2012-02-15 Thread deepak balakrishnan
hi, i am using R for first time. i am trying to do T-test for a sample set with three variables. i attached my data set as CSV file. but when i do t.test(data$Day.1,data$Day.2,var.equal=T) i get this following error. Can anyone please help e identify the problem. Error in if (stderr 10 *

[R] help in run if

2012-02-15 Thread arunkumar1111
hi My data looks like x=c(0,0,0,0,0) y=c(10,20,30,40,50) i want to generate 5 random numbers between x and y keeping x values as min and y value as max using apply it takes time when it is run using for - Thanks in Advance Arun -- View this message in context:

[R] Differences between Factors in Non-Linear Data

2012-02-15 Thread David O'Keeffe
I have a dataset which has a predictor (Temperature), a response (Developmental Time) and two separate factors Species ( A B) and Population (High, Low, Middle). I want to compare whether the populations and the species differ from each other (is A different from B or is low A different to high

Re: [R] Spline Question

2012-02-15 Thread Rolf Turner
On 15/02/12 21:25, Michael Bedward wrote: On 15 February 2012 19:00, Jeff Newmillerjdnew...@dcn.davis.ca.us wrote: What part of read the posting guide did you not understand? The provide commented, minimal, self-contained, reproducible code part? Off topic: why is there so much

Re: [R] matching a sequence in a vector?

2012-02-15 Thread Rainer M Krug
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 15/02/12 05:17, Redding, Matthew wrote: Hi All, I've been trawling through the documentation and listserv archives on this topic -- but as yet have not found a solution. I'm sure this is pretty simple with R, but I cannot work out how

Re: [R] help in run if

2012-02-15 Thread Petr Savicky
On Wed, Feb 15, 2012 at 12:31:54AM -0800, arunkumar wrote: hi My data looks like x=c(0,0,0,0,0) y=c(10,20,30,40,50) i want to generate 5 random numbers between x and y keeping x values as min and y value as max using apply it takes time when it is run using for Hi. A

Re: [R] matching a sequence in a vector?

2012-02-15 Thread Berend Hasselman
On 15-02-2012, at 05:17, Redding, Matthew wrote: Hi All, I've been trawling through the documentation and listserv archives on this topic -- but as yet have not found a solution. I'm sure this is pretty simple with R, but I cannot work out how without resorting to ugly nested loops.

Re: [R] Filling out a data frame row by row.... slow!

2012-02-15 Thread Peter Meilstrup
On Tue, Feb 14, 2012 at 2:31 PM, William Dunlap wdun...@tibco.com wrote: If you must repeatedly append rows to a data.frame, try making the dataset you are filling in a bunch of independent vectors, perhaps in a new environment to keep things organized. One complication is I don't know the

[R] How to replace range of data in a dataframe

2012-02-15 Thread Camilo Mora
Hi: I wonder if anyone may know the answer to this question: COnsider the following data frame (DF): ColumnA ColumnB ColumnC a d d s s e e r e y w y t u i q e l What I need is to

Re: [R] How to replace range of data in a dataframe

2012-02-15 Thread jim holtman
Is this what you want: x - read.table(text = ColumnA ColumnB ColumnC + a d d + s s e + e r e + y w y + t u i + q e l, as.is = TRUE, header = TRUE) x$ColumnC[1:3] - runif(3) x ColumnA

Re: [R] help in run if

2012-02-15 Thread jim holtman
try this: x=c(0,0,0,0,0) y=c(10,20,30,40,50) mapply(runif, 1, x, y) [1] 3.6958437 0.1190025 23.1382387 35.8738653 28.6983410 On Wed, Feb 15, 2012 at 3:31 AM, arunkumar akpbond...@gmail.com wrote: hi My data looks like x=c(0,0,0,0,0) y=c(10,20,30,40,50) i want to generate 5

Re: [R] matching a sequence in a vector?

2012-02-15 Thread Petr Savicky
On Wed, Feb 15, 2012 at 10:26:44AM +0100, Berend Hasselman wrote: On 15-02-2012, at 05:17, Redding, Matthew wrote: Hi All, I've been trawling through the documentation and listserv archives on this topic -- but as yet have not found a solution. I'm sure this is pretty simple

[R] Odp: Error while doing T-test

2012-02-15 Thread Petr PIKAL
Hi hi, i am using R for first time. i am trying to do T-test for a sample set with three variables. i attached my data set as CSV file. but when i do t.test(data$Day.1,data$Day.2,var.equal=T) i get this following error. Can anyone please help e identify the problem. Error in if

Re: [R] Using readBin to read binary unformatted output files from Fortran?

2012-02-15 Thread Duncan Murdoch
On 12-02-14 10:58 PM, Jooil Kim wrote: Hello, I'm wondering if I can get some help with reading Fortran binary unformatted output files into R. The Fortran output files were generated in Ubuntu 10.04 LTS using gfortran4.4, on a 32bit Intel Core 2 Duo 3.16 GHz machine, with little-endian and

[R] Multiple linear Regression: Standardized Coefficients

2012-02-15 Thread David Studer
Hello everybody, Can anyone tell me, how to obtain standardized regression coefficients (betas) for my independent variables when doing a multiple linear regression? height-c(180,160,150,170,190,172) sex-c(1,2,2,1,1,2) age-c(40,20,30,40,20,25) fit-lm(height~age+sex) summary(fit) I already

Re: [R] Multiple linear Regression: Standardized Coefficients

2012-02-15 Thread Kenn Konstabel
It's a bit dangerous to call them betas in this list. Standardized regression coefficients sounds much better :) A simple way is to first standardize your variables and then run lm again. lm(scale(height)~scale(age) + factor(sex)) # or, depending on what you want:

Re: [R] Creating categories from a date-time object

2012-02-15 Thread Jose Bustos Melo
Dear Jim,   Thank you so much, I really apreciate you advice. That was what I was trying to do so much!!!. I just wanted to create a new variable depending of these criteria of office time. I realize in this issue the function format is good to understand well. Saludos,  José

Re: [R] question

2012-02-15 Thread R. Michael Weylandt
Sorry about that -- forgot the case where you might only have a certain entry once: try this, sapply(split(GS, rownames(GS)), function(x) colSums(as.matrix(x))) or sapply(split(GS, rownames(GS)), function(x) if(is.matrix(x)) colSums(x) else x) I'm not sure if there's a way to force split to

Re: [R] question

2012-02-15 Thread R. Michael Weylandt
Blah! Forget that first one -- the second one should be fine. (or at least, I don't see a problem with it immediately) sapply(split(GS, rownames(GS)), function(x) if(is.matrix(x)) colSums(x) else x) Michael On Wed, Feb 15, 2012 at 7:19 AM, R. Michael Weylandt michael.weyla...@gmail.com wrote:

Re: [R] standardized regression coefficients

2012-02-15 Thread Jo Reynaerts
Hi David This should do the trick: data - cbind(height, sex, age) data.scaled - data.frame(apply(data, 2, scale)) fit.scaled - lm(height ~ age + sex - 1, data = data.scaled) summary(fit.scaled) HTH Jo == Hello everybody,

[R] error

2012-02-15 Thread Soheila Khodakarim
Dear All, I have a function that it works in all of data. dim(data) 24(sample) 2600(variable) data [1][2] [3] [4] ... [2600] [1] 10.73140 9.89450 9.12233 8.33994 9.43412 [2] 10.58010 10.02023 8.69257 8.46640 9.05038 [3] 10.80644 9.59991 8.71311 8.64168

[R] working on a vector with named elements - unname

2012-02-15 Thread Alexander
Hi, I am working under R2.11.1 Windows. I work with a set of parameters which is save under a vector. I think it is easier to understand, which parameter is called in the vector by naming all vector elements. For example, we have a vector which the parameters a,b,c,d. Is it normal to allow, that

[R] R Cassandra

2012-02-15 Thread gdevitis
Hi, I wonder if there is a direct interface between R and Cassandra. According to my searches there isn't. Has anyone worked with Cassandra? I would appreciate to know if there is a work-around to the problem. Thanks Giuseppe -- View this message in context:

[R] question

2012-02-15 Thread Maryam Farhadi
Dear Sir/Madam it is my the first time in using R-help center. I would like to know how can I install DEA package on my R program. moreover, is there any example of using R for calculating Malmquist? and should I necessarily install DEA package for that reason? I have some problems in importing my

Re: [R] Plotting function image

2012-02-15 Thread uday
Hi , Thanks for reply My latitude and longitude contains 9-10 observations per file when I run coords - expand.grid(lat=1:5,long=1:5) then my computer *** caught segfault *** address 0x6951c20, cause 'memory not mapped' Traceback: 1: .C(spline_eval, z$method, nu = as.integer(n), x

[R] XML package: modify info of internal node

2012-02-15 Thread Moreno Coco
Dear All, I have a very simple question to which I did not find any answer online (apologize if it exists). I have an XML file (attached) on which I just want to modify the info of a node. So, I load my xml file: current = xmlTreeParse(file, useInternalNodes=T) and I want to change the

[R] Passing date as parameter while retrieving data from database using dbGetQuery

2012-02-15 Thread aajit75
Hi All, This might be simple question, I need to retrive data for modelling from the databases. Eveytime date values changes so I countnot fix date value in the code, it is required to pass as parameter. When I pass the date as parameter, it throws error. (ERROR: column start_dt does not exist

[R] source code of MARS

2012-02-15 Thread Elçin Kartal
Dear Sir/Madam, I am a phd student and I am trying to implement a new approach for the knot selection procedure in MARS algorithm. In order to apply and test the efficiency of my method, is it possible to get the code (sourse) of earth library? Thank you for your interest and concern. Best

[R] X11 fonts problems

2012-02-15 Thread carol white
Hello, I installed R--2-1.14.1.pkg on mac OS v 10.7.2 and when I wanted to invoke hist, I got the following error msg: Error in title(main = main, sub = sub, xlab = xlab, ylab = ylab, ...) :    could not find any X11 fonts Check that the Font Path is correct. In addition: Warning messages: 1: In

Re: [R] error

2012-02-15 Thread Petr Savicky
On Wed, Feb 15, 2012 at 02:13:28PM +0100, Soheila Khodakarim wrote: Dear All, I have a function that it works in all of data. dim(data) 24(sample) 2600(variable) data [1][2] [3] [4] ... [2600] [1] 10.73140 9.89450 9.12233 8.33994 9.43412 [2]

Re: [R] question

2012-02-15 Thread R. Michael Weylandt
1) The DEA package appears to have been removed from CRAN in 2008, so it is not likely to be readily available. Old versions are available from the CRAN archives though but I don't imagine you'll get much support if you try to use them: ftp://cran.r-project.org/pub/R/src/contrib/Archive/DEA/ 2)

Re: [R] source code of MARS

2012-02-15 Thread R. Michael Weylandt
http://cran.r-project.org/web/packages/earth/index.html Click on package source and have fun. Michael 2012/2/15 Elçin Kartal kartalel...@gmail.com: Dear Sir/Madam, I am a phd student and I am trying to implement a new approach for the knot selection procedure in MARS algorithm. In order to

Re: [R] Plotting function image

2012-02-15 Thread Etienne B. Racine
Uday, maybe you could have a look at the raster package. Etienne 2012/2/15 uday uday_143...@hotmail.com Hi , Thanks for reply My latitude and longitude contains 9-10 observations per file when I run coords - expand.grid(lat=1:5,long=1:5) then my computer *** caught segfault ***

Re: [R] X11 fonts problems

2012-02-15 Thread Prof Brian Ripley
On Wed, 15 Feb 2012, carol white wrote: Hello, I installed R--2-1.14.1.pkg on mac OS v 10.7.2 and when I wanted to invoke hist, I got the following error msg: Error in title(main = main, sub = sub, xlab = xlab, ylab = ylab, ...) :    could not find any X11 fonts Check that the Font Path is

Re: [R] question

2012-02-15 Thread David Winsemius
On Feb 15, 2012, at 7:19 AM, R. Michael Weylandt wrote: Sorry about that -- forgot the case where you might only have a certain entry once: try this, sapply(split(GS, rownames(GS)), function(x) colSums(as.matrix(x))) or sapply(split(GS, rownames(GS)), function(x) if(is.matrix(x))

Re: [R] question

2012-02-15 Thread R. Michael Weylandt
But that's dropping unused factor levels, not the drop of `[` Michael On Wed, Feb 15, 2012 at 9:16 AM, David Winsemius dwinsem...@comcast.net wrote: On Feb 15, 2012, at 7:19 AM, R. Michael Weylandt wrote: Sorry about that -- forgot the case where you might only have a certain entry once:

Re: [R] Passing date as parameter while retrieving data from database using dbGetQuery

2012-02-15 Thread Gabor Grothendieck
On Wed, Feb 15, 2012 at 7:24 AM, aajit75 aaji...@yahoo.co.in wrote: Hi All, This might be simple question, I need to retrive data for modelling from the databases. Eveytime date values changes so I countnot fix date value in the code, it is required to pass as parameter. When I pass the date

Re: [R] matching a sequence in a vector?

2012-02-15 Thread Martin Morgan
On 02/14/2012 11:45 PM, Petr Savicky wrote: On Wed, Feb 15, 2012 at 02:17:35PM +1000, Redding, Matthew wrote: Hi All, I've been trawling through the documentation and listserv archives on this topic -- but as yet have not found a solution. I'm sure this is pretty simple with R, but I

[R] assign same legend colors than in the grouped data plot

2012-02-15 Thread agent dunham
Dear community, I've plotted data and coloured depending on the factor variable v3. In the legend, I'd like to assign properly the same colors than in the factor (the factor has 5 levels). I've been trying this but it doesn't work. plot(var1, var2, xlab = var1, ylab = var2, col =var3 ,

[R] Finite mixtures of Generalized Linear Mixed models with random effects

2012-02-15 Thread mariastatistics
Hello to everybody !!! I am a student in the Mathematics department of the university of Milano. I am interested in an r -package or an available code for fitting two component mixtures of generalized linear mixed effects models for cluster correlated data. In particular with normal random

[R] spplot settings

2012-02-15 Thread uday
I want to use spplot function for plotting data on wold map spplot.points(obj, zcol = names(obj), ..., names.attr, scales = list(draw = FALSE), xlab = NULL, ylab = NULL, aspect = mapasp(obj,xlim,ylim), panel = panel.pointsplot, sp.layout = NULL, identify = FALSE, formula,

Re: [R] svm with GRASS GIS

2012-02-15 Thread Etienne B. Racine
Gab, Make sure you have variables for each training. training - data.frame(Training_2006, AST_L1B_1, AST_L1B_2, AST_L1B_3N) If you can't do that, then you don't have as many training observations than you have predictive informations. Make sure to create a line for each set of predictive pixels

[R] LaTeX and Sweave on windows

2012-02-15 Thread Bos, Roger
I am completely new to LaTeX and Sweave, so I am trying to follow the tutorial in the following link: http://www.r-bloggers.com/using-latex-r-and-sweave-to-create-reports-in- windows/ I installed MiKTeX 2.9 and TeXnicCenter, but I get a build error when compiler the example file: The two errors

Re: [R] save objects of own function to workspace

2012-02-15 Thread Marion Wenty
s_elternmz - function(Var=balt) { Dg_a-mz[,c(asbhh,apkz,Var)] colnames(Dg_a)[colnames(Dg_a)==apkz]-bpkzm colnames(Dg_a)[colnames(Dg_a)==Var]-paste(Var,_m,sep=) mz_int-merge(mz,Dg_a,by=c(asbhh,bpkzm),all.x=T) colnames(Dg_a)[colnames(Dg_a)==bpkzm]-bpkzv

Re: [R] matching a sequence in a vector?

2012-02-15 Thread Petr Savicky
On Wed, Feb 15, 2012 at 06:27:01AM -0800, Martin Morgan wrote: On 02/14/2012 11:45 PM, Petr Savicky wrote: On Wed, Feb 15, 2012 at 02:17:35PM +1000, Redding, Matthew wrote: Hi All, I've been trawling through the documentation and listserv archives on this topic -- but as yet have not

Re: [R] matching a sequence in a vector?

2012-02-15 Thread Berend Hasselman
On 15-02-2012, at 15:27, Martin Morgan wrote: On 02/14/2012 11:45 PM, Petr Savicky wrote: On Wed, Feb 15, 2012 at 02:17:35PM +1000, Redding, Matthew wrote: Hi All, I've been trawling through the documentation and listserv archives on this topic -- but as yet have not found a solution.

Re: [R] [fields] image.plot abends with NAs in image.plot.info

2012-02-15 Thread Tom Roche
Tom Roche Fri, Feb 3, 2012 at 11:16 AM summary: image.plot-ing two sets of netCDF data, with the second derived from the first. Should have noted that the data (atmospheric emissions) in * the second dataset is heavily positively-skewed. (This leads to a problem with the legend when

[R] Error in rep.int(boxwex, n) : negative length vectors are not allowed

2012-02-15 Thread carol white
Dear All, I tried to invoke plot for a matrix of 196475 x2 dimension. I loaded the data with read.table. On one dimension, there are strings (names) and on the other dimension, the floats between 0 and 1. When I invoked plot by setting x to names and y to floats and ylim = c(0,1), I got the

Re: [R] working on a vector with named elements - unname

2012-02-15 Thread Petr PIKAL
Hi Hi, I am working under R2.11.1 Windows. Rather old one, consider upgrading I work with a set of parameters which is save under a vector. I think it is easier to understand, which parameter is called in the vector by naming all vector elements. For example, we have a vector which the

[R] Fw: Error in rep.int(boxwex, n) : negative length vectors are not allowed-cont.

2012-02-15 Thread carol white
Sorry for the error: the first column is of the string type and the second column of float, respectively. - Forwarded Message - From: carol white wht_...@yahoo.com To: r-h...@stat.math.ethz.ch r-h...@stat.math.ethz.ch Cc: Sent: Wednesday, February 15, 2012 4:46 PM Subject: Error in

[R] Parameter estimation of gamma distribution

2012-02-15 Thread Yogs
Hi, I am trying to estiamte parameters for gamma distribution using mle for below data using fitdist fitdistr functions which are from fitdistrplus MASSpackages . I am getting errors for both functions. Can someone please let me know how to overcome this issue?? data y1- c(256656, 76376,

[R] smooth.spline() unique 'x' values error

2012-02-15 Thread Nicholas Reich
Hello. I'm getting an unexpected result when running smooth.spline(). Here is a simple example that replicates the error I'm getting: aa - c(1, 2, 3, 8, 8, 8, 8, 8, 8, 8, 8, 8, 12, 13, 14) bb - 1:length(aa) plot(aa, bb) smooth.spline(aa, bb) Error in smooth.spline(aa, bb) : need at least

[R] built a lower triangular matrix from dataframe

2012-02-15 Thread nymphita
Hello! I'm trying to build a lower triangular matrix (with zeros in the diagonal) from a particular dataframe. The matrix I have to construct has 203 rows and 203 columns and that makes 20503 values to be included within (that's why I can't do it manually). To illustrate the dataframe I have,

[R] function similar to ddply? + calculations based on previous row

2012-02-15 Thread Nerak
Hi all, I was wondering if there is a function kind of similar that splits a dataframe, applies a function to each row and returns in a data frame. I know ddply but this one isn’t useful in this situation. I have a dataframe with values for each day (rows) for different objects (columns). I have

Re: [R] built a lower triangular matrix from dataframe

2012-02-15 Thread Tsjerk Wassenaar
Hi Nymphita, ?upper.tri x - as.data.frame(matrix(1:6,6,6)) x[upper.tri(x,diag=TRUE)] - 0 x Cheers, Tsjerk On Wed, Feb 15, 2012 at 4:33 PM, nymphita nymph...@gmail.com wrote: Hello! I'm trying to build a lower triangular matrix (with zeros in the diagonal) from a particular dataframe.

Re: [R] working on a vector with named elements - unname

2012-02-15 Thread Alexander
Thanks for your help. I already considered using list. But as I want to put some constraints on the entries and the form of the vector, I thought it would be easier to verify them by using a vector instead of a list. -- View this message in context:

[R] R citation for the 2012

2012-02-15 Thread gianni lavaredo
Dear Reasearchers, I am writing a report and i need (and wish) cite R. somebody know the citation of R for the 2012? or the more actual? thanks in advance Gianni [[alternative HTML version deleted]] __ R-help@r-project.org mailing list

Re: [R] R citation for the 2012

2012-02-15 Thread Jorge I Velez
Hi gianni, Type citation() without quotes in the R console. You will get something like To cite R in publications use: R Development Core Team (2011). R: A language and environment for statistical computing. R Foundation for Statistical Computing, Vienna, Austria. ISBN 3-900051-07-0,

Re: [R] R citation for the 2012

2012-02-15 Thread Sarah Goslee
Typing citation() at an R prompt will provide you with complete citation information for the version of R you are using. Same goes for packages, with citation(pkgname). Sarah On Wed, Feb 15, 2012 at 11:29 AM, gianni lavaredo gianni.lavar...@gmail.com wrote: Dear Reasearchers, I am writing a

[R] bootstrapping quantile regression

2012-02-15 Thread Julia Lira
Dear all, I am currently running an experiment using quantile regression. In order to get more accurate results for a hypothesis test, I need to run a bootstrapping version of quantile regression and I need to find the estimated covariance matrix among all the coefficients for several

[R] integrate (error: evaluation of function gave a result of wrong length)

2012-02-15 Thread Dimitris.Kapetanakis
Dear all, I am trying to use the integrate function in R but it seems that it does not work in my example and I cannot figure out why. I create a function Mu1 (which works fine) and try to integrate by the code: n - 100 Ctrl- as.matrix(cbind(runif(n, -30, 30))) W

Re: [R] built a lower triangular matrix from dataframe

2012-02-15 Thread nymphita
Hi Tsjerk! Thanks for your quick reply! It's a nice way to built a lower triangular matrix with zeros in the diagonal, but what I can't work out is *how to include the values of the third column of the dataframe inside the matrix*. I just realized that I forgot to explain something about the

[R] ggplot rank stack bar automatically.

2012-02-15 Thread vd3000
Hi, all, I am currently trying to learn this example. http://learnr.wordpress.com/2009/03/17/ggplot2-barplots/ I created the stack bar easily. If I would like to rank the stack bar from the highest on the right, shortest on the left and eventually I could show the data 1991-00 on the left

Re: [R] Parameter estimation of gamma distribution

2012-02-15 Thread Prof Brian Ripley
On 15/02/2012 14:18, Yogs wrote: Hi, I am trying to estiamte parameters for gamma distribution using mle for below data using fitdist fitdistr functions which are from fitdistrplus MASSpackages . I am getting errors for both functions. Can someone please let me know how to overcome this

Re: [R] working on a vector with named elements - unname

2012-02-15 Thread William Dunlap
You could use [[ instead of [, as the latter drops the names. E.g., after v - c(a=3,a=4,c=5,d=6) change your c(n=v[a]+v[c],n1=v[d]*3) # n.a=8 n1.d=18 n.a n1.d 8 18 to c(n=v[[a]]+v[[c]],n1=v[[d]]*3) # n=8 n1=18 n n1 8 18 Bill Dunlap Spotfire, TIBCO Software wdunlap

Re: [R] built a lower triangular matrix from dataframe

2012-02-15 Thread nymphita
Sorry, I just realized that it's not a lower triangualr matrix, but an upper triangular matrix! But still the solution/s should be rather similar in both cases. http://r.789695.n4.nabble.com/file/n4391127/matrix2.png I apologize for creating confusion... Nymphita -- View this message in

Re: [R] working on a vector with named elements - unname

2012-02-15 Thread William Dunlap
Typo below, 'latter' - 'former'. namedVector[[i]] drops the names and namedVector[i] does not. Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of William Dunlap Sent:

Re: [R] built a lower triangular matrix from dataframe

2012-02-15 Thread R. Michael Weylandt
Perhaps ignore the lower-triangularity for a moment and do something like this: x - matrix(NA, ncol = max(j), nrow = max(i)) x[i, j] - k Your code will be clearer if you use with() rather than df$i constructs. Hope this helps, Michael On Wed, Feb 15, 2012 at 11:47 AM, nymphita

Re: [R] integrate (error: evaluation of function gave a result of wrong length)

2012-02-15 Thread R. Michael Weylandt
Integrate works on functions that are vectorized (i.e., the algorithm puts in N inputs and expects N outputs) -- your function is not vectorized (and I'm not sure what integrating it means, but I'm not looking too closely) but you can make it look vectorized with the Vectorize() HOF. Note that

Re: [R] integrate (error: evaluation of function gave a result of wrong length)

2012-02-15 Thread Uwe Ligges
On 15.02.2012 17:33, Dimitris.Kapetanakis wrote: Dear all, I am trying to use the integrate function in R but it seems that it does not work in my example and I cannot figure out why. I create a function Mu1 (which works fine) and try to integrate by the code: n - 100 Ctrl-

Re: [R] built a lower triangular matrix from dataframe

2012-02-15 Thread David Winsemius
On Feb 15, 2012, at 11:47 AM, nymphita wrote: Hi Tsjerk! Thanks for your quick reply! It's a nice way to built a lower triangular matrix with zeros in the diagonal, but what I can't work out is *how to include the values of the third column of the dataframe inside the matrix*. I just

Re: [R] R citation for the 2012

2012-02-15 Thread gianni lavaredo
Sorry I don't know the citation inside the report is corret The Analysis was done using a script written in the statistical computing environment of R (R Development Core Team, 2011) is It correct the form statistical computing environment ? Gianni On Wed, Feb 15, 2012 at 5:38 PM, Sarah

Re: [R] smooth.spline() unique 'x' values error

2012-02-15 Thread Prof Brian Ripley
On 15/02/2012 15:00, Nicholas Reich wrote: Hello. I'm getting an unexpected result when running smooth.spline(). Here is a simple example that replicates the error I'm getting: aa- c(1, 2, 3, 8, 8, 8, 8, 8, 8, 8, 8, 8, 12, 13, 14) bb- 1:length(aa) plot(aa, bb) smooth.spline(aa, bb) Error in

Re: [R] Plotting function image

2012-02-15 Thread ilai
Inline On Wed, Feb 15, 2012 at 3:04 AM, uday uday_143...@hotmail.com wrote: Hi , Thanks for reply My latitude and longitude contains 9-10 observations per file when I run coords - expand.grid(lat=1:5,long=1:5) then my computer You don't have to run this part. As your original post

Re: [R] help in run if

2012-02-15 Thread William Dunlap
runif's min and max argument may be vectors: x=c(0,0,0,0,0) y=c(10,20,30,40,50) runif(length(y), min=x, max=y) [1] 7.005180 14.035296 9.388089 22.094211 43.624606 This is equivalent to x + (y-x)*runif(length(y)) but such a transformation is not always so easy for nonuniform random

Re: [R] LaTeX and Sweave on windows

2012-02-15 Thread Yihui Xie
Please read the very last two lines in the footer of your email below. Regards, Yihui -- Yihui Xie xieyi...@gmail.com Phone: 515-294-2465 Web: http://yihui.name Department of Statistics, Iowa State University 2215 Snedecor Hall, Ames, IA On Wed, Feb 15, 2012 at 8:55 AM, Bos, Roger

Re: [R] Rpart decision tree

2012-02-15 Thread dlofaro
Dear R-Users, I'm a R beginner and I have a similar problem: I fitted a SurvivalTree with rpart and I'm tryng to plot with the partykit package by the funcion as.party but it sends me this error: plot(as.party(rpartSurv)) Error in plot.constparty(as.party(rpartSurv)) : node_surv not yet

Re: [R] built a lower triangular matrix from dataframe

2012-02-15 Thread Rui Barradas
Hello, I'm trying to build a lower triangular matrix (with zeros in the diagonal) from a particular dataframe. This example constructs a lower triangular matrix from a vector, not a data.frame. (In your example, you also use a vector, the last column of the DF.) x - runif(15) y - matrix(0,

[R] [R-pkgs] new package on CRAN: multivator

2012-02-15 Thread robin hankin
Dear list, The new package 'multivator' is now available on CRAN. This presents a multivariate generalization of the emulator package. The corresponding JSS article is: Robin K. S. Hankin (2012), Introducing multivator: A Multivariate Emulator, Journal of Statistical Software, 46(8), 1-20.

[R] [R-pkgs] New version: dclone 1.7-1 and dcmle 0.1-4 rolled out

2012-02-15 Thread Peter Solymos
Dear R Community, I am happy to introduce the next release of the *dclone* package (see R Journal, 2(2): 29-37, 2010) which now includes a suite of functions for parallel computations: - see functions parJagsModel, parUpdate, parCodaSamples using 'snow' type clusters; and the - jags.parfit

Re: [R] dotplots with error bars

2012-02-15 Thread Colin Wahl
Thank you, Its looking like your package will work for me. I have two questions. First, how do I rotate the plot 90 degrees so the group labels are on the x axis and the response value on the y axis? Second, I'm having trouble with the group labels. I need to order my groups into meaningful

Re: [R] Filling out a data frame row by row.... slow!

2012-02-15 Thread William Dunlap
environment[[names[j]]][i]-I does seem to take longer than environment$name[i]-I when looping over the length of the vector involved. Using a list instead of an environment seems to work better. Below are 4 functions that populate a data.frame row by row. f0 : the naïve approach f1 : use 3

[R] model fitting

2012-02-15 Thread Anthony Fristachi
Greetings, Any suggestions for approaching the fitting of the function y = b/exp(a*x) + c*x + y0 where a, b, c, and y0 are unknown constants and y and x are variables in a give dataset. Thanks Tony [[alternative HTML version deleted]]

Re: [R] model fitting

2012-02-15 Thread Tsjerk Wassenaar
Hi Tony, ?nls Cheers, Tsjerk On Feb 15, 2012 8:03 PM, Anthony Fristachi antak...@gmail.com wrote: Greetings, Any suggestions for approaching the fitting of the function y = b/exp(a*x) + c*x + y0 where a, b, c, and y0 are unknown constants and y and x are variables in a give dataset.

[R] Control number of assets in resulting portfolio with optimizations using package fPortfolio

2012-02-15 Thread Alexander Erbse
Dear All, I am using package fPortfolio to run minimum variance portfolio optimizations in R. I already know how to set portfolioSpecs, portfolio objects and constraints. Unfortunately I am not able to set the following type of constraints. I have a timeSeries object with returns data for

Re: [R] Rpart decision tree

2012-02-15 Thread Achim Zeileis
On Wed, 15 Feb 2012, dlofaro wrote: Dear R-Users, I'm a R beginner and I have a similar problem: I fitted a SurvivalTree with rpart and I'm tryng to plot with the partykit package by the funcion as.party but it sends me this error: plot(as.party(rpartSurv)) Error in

Re: [R] Filling out a data frame row by row.... slow!

2012-02-15 Thread ilai
First, in R there is no need to declare the dimensions of your objects before they are populated so couldn't you reduce some run time by not going through the double data.frame step ? df- data.frame() df data frame with 0 columns and 0 rows for(i in 1:100) for(j in 1:3) df[i,j]- runif(1)

[R] Plotting monthly maps from yearly data

2012-02-15 Thread uday
I have some data set which is available from 2005-2010 . I would like plot monthly maps out of it. So how I should write loop that can plot this yearly data to for every month and write title for individual months too. -- View this message in context:

Re: [R] question

2012-02-15 Thread peter dalgaard
On Feb 15, 2012, at 15:17 , R. Michael Weylandt wrote: But that's dropping unused factor levels, not the drop of `[` Is there a good reason that nobody has suggested looking at aggregate()? There would seem to be a little red tape to sort out, but, I mean, this is generally speaking what

Re: [R] Plotting monthly maps from yearly data

2012-02-15 Thread R. Michael Weylandt
. you don't really consider this a well formed question do you? (Among others:) http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example http://www.gerv.net/hacking/how-to-ask-good-questions/ What immediately comes to mind: i) Plotting engine? (base, lattice, or

[R] R Package example section of .Rd file question (think it's a non-ASCII issue, but not sure...)

2012-02-15 Thread Ben Ganzfried
Hey, I keep getting the following warning: data(GSE19829-GPL570_eset) Warning in data(GSE19829 - GPL570_eset) : data set ‘GSE19829 - GPL570_eset’ not found ## maybe str(GSE19829-GPL570_eset) ; plot(GSE19829-GPL570_eset) ... if(require(affy)){ + summary(GSE19829-GPL570_eset$vital_status)

Re: [R] R citation for the 2012

2012-02-15 Thread R. Michael Weylandt
I'm not sure what the official description of R is beyond that given in citation(), but the R FAQ gives this: [R] consists of a language plus a run-time environment. Part of R's personality, as far as I can tell, comes from the fact it straddles the general purpose language/domain specific

[R] Cannot use setClass() in Rscript

2012-02-15 Thread Jonathan Callahan
Greetings, I am creating a standalone executable script using Rscript and have run into problems when I define a new S4 class. Here is a small script that demonstrates my problem: #!/usr/bin/env Rscript # # toy.Rscript -- testing S4 class creation in an Rscript setClass(toy,

[R] neuralnet problem

2012-02-15 Thread Luc MOULINIER
Hello List ! I'm a bright new R user, and I encounter a problem when trying to use the neuralnet package. I have a training set with 8 inputs, and there are 3 outputs (I need 3 distinct neurones as output). Although I read the examples, and the package article, I don't know how to tell R

  1   2   >