Re: [R] global optimisation with inequality constraints

2011-11-15 Thread Dennis Murphy
(1) Please do not hijack another thread to ask an off-topic question - start a new one instead. (2) Your question refers to a topic called 'restricted least squares'. Search the R-help archives on that subject and you should get a number of answers. Someone answered a similar question here within t

Re: [R] plotting a double y axis when x and y lengths differ

2011-11-15 Thread Rolf Turner
Any time you use ``par(new=TRUE)'', you're probably doing something wrong. Avoid it like the plague. Following up on Michael Weylandt's post: plotCI() indeed has an xlim argument (i.e. the "..." arguments which get passed to plot.default() can include xlim). Note that plotCI() also has an ***

Re: [R] global optimisation with inequality constraints

2011-11-15 Thread geeknick
Please advice on the package I should use to run a linear regression model (weighted least squared) with linear equality constraint. I initially tried "constrOptim" but it turned out that it only supported http://solve-graph-linear-inequalities.blogspot.com/2011/11/blog-post.html linear inequality

Re: [R] fitted.values in lm function

2011-11-15 Thread Joshua Wiley
log(x1+1) just like your formula best, Josh On Tue, Nov 15, 2011 at 9:54 PM, arunkumar wrote: > Hi > >  i have few clarification regarding the output from the fitted(object). > > I'm creating a object using the following formula > dataset  <- read.csv("~/data.csv") > > obj = lm (formula="lo

Re: [R] R forum for only Statistics

2011-11-15 Thread geeknick
Hi there I need some [URL=http://calculate-conditional-and-distributio.blogspot.com/2011/11/blog-post.html]Statistics Help[/URL]!! What statistical tests should i use/consider (pref in SPSS) in regards to an invertebrate survey i have carried out comparing urban street trees to urban park t

[R] fitted.values in lm function

2011-11-15 Thread arunkumar1111
Hi i have few clarification regarding the output from the fitted(object). I'm creating a object using the following formula dataset <- read.csv("~/data.csv") obj = lm (formula="log(y+1)~log(x1+1)+(log(x2+1)+log(x3+1)", data=dataset) fitted(obj) here the output of the fitted(obj) considers th

[R] Determining second coordinate from distance

2011-11-15 Thread Hadassa Brunschwig
Hi, I am looking for a function which takes as input the spatial coordinate in longitute/latitude and the distance in metric and returns the second coordinate (of course depending on an angle as well). So far I have only found functions which calculate the distance between two coordinates. Thank

[R] Theil decomposition

2011-11-15 Thread Kitty Lee
I came across the package 'ineq' that computes a variety of inequality measures (e.g. gini, theil etc). I want to compute the Theil index (racial segregation) and decompose the total into sub-components (by geog levels). I think the package doesn't report the decomposition (correct me if I'm wro

Re: [R] Convert full matrix back to lower triangular matrix

2011-11-15 Thread Dennis Murphy
Hi: (1) Here is why your e-mails look mangled on this list: [[alternative HTML version deleted]] R-help is a text-only list, so please change your mailer's settings to send ASCII text rather than HTML. (2) The print method you see displayed in dd1 is equivalent to the following: ddm * low

Re: [R] plotting a double y axis when x and y lengths differ

2011-11-15 Thread R. Michael Weylandt
Does plotCI take an xlim argument? Something like plotCI(..., xlim=range(Data1$Year, Data2$Year)) Michael On Nov 15, 2011, at 11:51 PM, Vinny Moriarty wrote: > Hello All, > > Many thanks to the help I have received so far. > > > Here is an example data set I hope to plot > > Data1 > Year

Re: [R] equal spacing of the polygons in levelplot key (lattice)

2011-11-15 Thread Dennis Murphy
Hi: Does this work? # library('lattice') levs <- as.vector(quantile(volcano,c(0,0.1,0.5,0.9,0.99,1))) levelplot(volcano, at = levs, colorkey = list(labels = list(at = levs, labels = levs) )) HTH, Dennis On Tue, Nov 15, 2011 at 1:12

[R] plotting a double y axis when x and y lengths differ

2011-11-15 Thread Vinny Moriarty
Hello All, Many thanks to the help I have received so far. Here is an example data set I hope to plot Data1 Year Data SE 1 20052 0.01 2 20064 0.01 3 20075 0.01 4 20082 0.01 5 20093 0.01 6 20106 0.01 Data2 Year Data SE 1 2006 32 1 2 2007 100 2 3 2008 60 4

Re: [R] Help with "error: no acceptable C compiler found in $PATH"

2011-11-15 Thread R. Michael Weylandt
Yes, you probably need some sort of C compiler, but why can't you just download the appropriate binary directly? I just did on OS X 10.5.8 (admittedly for R 2.13.2, not 2.14) with no problems. The output of sessionInfo() install.packages("RCurl") if you don't mind please. Thanks, Michael On Tu

Re: [R] Difference between two time series

2011-11-15 Thread R. Michael Weylandt
Can you post working examples of your data using the dput() function? There are so many types of time series in R and so many different things you could mean that it's just easier to work with real data. Michael On Tue, Nov 15, 2011 at 4:28 PM, Sarwarul Chy wrote: > Hello Michael, > Thanks for y

Re: [R] Conversion of symmetry matrix into a vector

2011-11-15 Thread R. Michael Weylandt
Try something like this: X = matrix(rnorm(25), 5); colnames(X) <- rownames(X) <- letters[1:5] Y <- dist(X) library(reshape) melt(as.matrix(Y)) Michael On Tue, Nov 15, 2011 at 7:03 PM, ram basnet wrote: > Dear R users, > > I am not good in R-language programming. So, i need your help. > > I wa

[R] knn density estimation in R

2011-11-15 Thread lyh123985458
How to do the nearest neighbor density estimation in R? Is there any function/package to perform k-Nearest Neighbor based density estimation in R Thank you very much! Thanks to a dozen of volunteer moderators! [[alternative HTML version deleted]] _

Re: [R] Create a function with multiple object as an output

2011-11-15 Thread Ben Bolker
PRI gmail.com> writes: > > Write an R program to draw 10,000 random samples using the Polya Urn Scheme > where the initial contents of the urn is one white ball and one black ball. > Accumulate the proportion of white balls after each draw into one vector. > Upload your R script file. > HINT: Yo

Re: [R] Question on exercise

2011-11-15 Thread R. Michael Weylandt
Copying David W from another thread: We don't do homework here. In fact, your instructor is probably watching. That said, try googling or, even better, using the rseek search. (Or even better-er RSiteSearch() in your terminal) Michael On Nov 15, 2011, at 4:16 PM, Jan Kraner wrote: > Dear Si

Re: [R] Question on exercise

2011-11-15 Thread Ben Bolker
Jan Kraner gmx.ch> writes: > > Dear Sir/Madam: > > Could you please help me with this exercise and how I could solve it in R?: > > Attachment (PastedGraphic-1.pdf): application/pdf, 84 KiB > > I especially have problems with the selection of the 40 datasets, > once taken the 110 (because the

Re: [R] pairs(), no axis labels/values for upper panel?

2011-11-15 Thread B77S
Steffen, Did you ever have luck getting rid of the tick marks?... I like your idea and have modified it, but yes, the tick marks need to go. Steffen Fleischer wrote: > > Dear all, > > I want to draw a graph that contains the scatterplot matrix in the lower > panel and coefficients in the u

Re: [R] Create a function with multiple object as an output

2011-11-15 Thread Rolf Turner
On 16/11/11 10:10, anaraster wrote: I've seen some questions regarding the output of multiple objects from a function, however the suggestions all end up suggesting the use of return(list(result1=result1, result2=result2 , result3=result3)). How can I return multiple objects that are 2 big to b

Re: [R] Problem with substr

2011-11-15 Thread Sarah Goslee
Hi, On Tue, Nov 15, 2011 at 4:31 PM, sophy1987 wrote: > Hi, everyone > When I ran this cript,  There is Error in substring(tmp.subject, tmp.end[ex] > + 1, tmp.start[ex + 1] - 1) : >  invalid substring argument(s) > > Could someone figure out what the problem is? Not without a reproducible exampl

Re: [R] Reading data/variables

2011-11-15 Thread Sarah Goslee
Hi, The obvious answer is don't use attach() and you'll never have that problem. And see further comments inline. On Tue, Nov 15, 2011 at 6:05 PM, Steven Yen wrote: > Can someone help me with this variable/data reading issue? > I read a csv file and transform/create an additional variable (calle

Re: [R] Create a function with multiple object as an output

2011-11-15 Thread Sarah Goslee
Hi, On Tue, Nov 15, 2011 at 4:10 PM, anaraster wrote: > I've seen some questions regarding the output of multiple objects from a > function, however the suggestions  all end up suggesting the use of > return(list(result1=result1, result2=result2 , result3=result3)). > > How can I return multiple

Re: [R] gsDesign

2011-11-15 Thread Dongli Zhou
Thank you so much for the help! It is really appreciated! Dongli On Nov 15, 2011, at 9:19 AM, Marc Schwartz wrote: > Hi Dongli, > > Sorry for the delay in following up. > > You might want to read the dsDesignManual.pdf document, which is available in > the 'inst/doc' folder in the package so

[R] Reading data/variables

2011-11-15 Thread Steven Yen
Can someone help me with this variable/data reading issue? I read a csv file and transform/create an additional variable (called y). The first set of commands below produced different sample statistics for hw11$y and y In the second set of command I renameuse the variable name yy, and sample st

[R] Problem with substr

2011-11-15 Thread sophy1987
Hi, everyone When I ran this cript, There is Error in substring(tmp.subject, tmp.end[ex] + 1, tmp.start[ex + 1] - 1) : invalid substring argument(s) Could someone figure out what the problem is? for(i in 1:length(genebody[,1])){ tmp.id<-as.vector(genebody[i,1])

Re: [R] if/else scope

2011-11-15 Thread P.B. Lecavalier
On 11/15/2011 06:46 PM, Kevin Burton wrote: What is wrong with the following? x<- 1:2 if(x[1]> 0) { if(x[2]> 0) { print("1& 2> 0") } else {

Re: [R] Difference between two time series

2011-11-15 Thread Sarwarul Chy
Hello Michael, Thanks for your reply. What I want to do is something like this? For example, I have a continuous time series y=x(t), and another discrete time series z=w(t). Xdiff(i)=Max. difference between x(t) and w(t) in interval i Ndiff(i)=Min. difference between x(t) and w(t) in interval

Re: [R] R Program

2011-11-15 Thread David Winsemius
On Nov 15, 2011, at 3:57 PM, PRI wrote: Can someone help me out with this problem? Write an R program to draw 10,000 random samples using the Polya Urn Scheme where the initial contents of the urn is one white ball and one black ball. Accumulate the proportion of white balls after each dra

Re: [R] Create a function with multiple object as an output

2011-11-15 Thread PRI
Write an R program to draw 10,000 random samples using the Polya Urn Scheme where the initial contents of the urn is one white ball and one black ball. Accumulate the proportion of white balls after each draw into one vector. Upload your R script file. HINT: You can simulate sampling one ball from

[R] Create a function with multiple object as an output

2011-11-15 Thread anaraster
I've seen some questions regarding the output of multiple objects from a function, however the suggestions all end up suggesting the use of return(list(result1=result1, result2=result2 , result3=result3)). How can I return multiple objects that are 2 big to be added to a list? -- View this mess

Re: [R] Reading data/variables

2011-11-15 Thread Steven Yen
A follow-up on the data/variable issue I posted earlier: Here was what I did, which might was obviously causing the problem: I inserted the following line in my file "Rprofile.site": setwd("z:/R") Then, as soon as I run R (before I read any data) I issue summary(mydata) I get summary statis

[R] R Program

2011-11-15 Thread PRI
Can someone help me out with this problem? Write an R program to draw 10,000 random samples using the Polya Urn Scheme where the initial contents of the urn is one white ball and one black ball. Accumulate the proportion of white balls after each draw into one vector. Upload your R script file. HI

[R] Conversion of symmetry matrix into a vector

2011-11-15 Thread ram basnet
Dear R users, I am not good in R-language programming. So, i need your help. I want to convert my lower-triangle value of symmetry matrix into a vector with their row and column name. I found a function called "sm2vec" in "corpcor" package but it give only a vector of values but not row and col

Re: [R] grid.arrange, grid.layout - legend, global y axis title

2011-11-15 Thread baptiste auguie
Hi, Please don't cross post. It seems that ggplotGrob has been replaced by new functions. You can define it as ggplotGrob <- function(x) ggplot2:::gtable_gTree(ggplot2:::ggplot_gtable(x)) and it seems to work as before with grid.arrange(). HTH, baptiste On Wed, Nov 16, 2011 at 3:26 AM, Joha

[R] Forescasting using predict() in an object of class arimax when there is an outlier IO in the model.

2011-11-15 Thread roman_elessar1
Forescasting using predict() in an object of class arimax when there is an outlier IO in the model. Hi R users I have a problem when a use the predict() method in an object of class arimax ( These objects are the results of the implementation of the function arimax() from the TSA library) . The obj

Re: [R] if/else scope

2011-11-15 Thread Ben Tupper
Hi, Check out this R-help thread from 2007. http://tolstoy.newcastle.edu.au/R/e2/help/07/06/19513.html Cheers, Ben On Nov 15, 2011, at 6:46 PM, Kevin Burton wrote: > What is wrong with the following? > > > > x <- 1:2 > > if(x[1] > 0) > > { > >if(x[2] > 0) > >

Re: [R] if/else scope

2011-11-15 Thread Peter Langfelder
On Tue, Nov 15, 2011 at 3:46 PM, Kevin Burton wrote: > What is wrong with the following? AFAIK the else needs to follow the end brace of if {} on the same line, at least at the main level. Peter > > > > x <- 1:2 > > if(x[1] > 0) > > { > >                if(x[2] > 0) > >                { > >  

[R] if/else scope

2011-11-15 Thread Kevin Burton
What is wrong with the following? x <- 1:2 if(x[1] > 0) { if(x[2] > 0) { print("1 & 2 > 0") } else { print("1 > 0") } } els

Re: [R] Convert back to lower triangular matrix

2011-11-15 Thread Bert Gunter
1. Please post in plain text, not HTML (as the posting guide asks!) 2. This might actually be an R question -- is ?lower.tri what you want? -- Bert On Tue, Nov 15, 2011 at 2:50 PM, Jeff Newmiller wrote: > This is R-help, not the linear algebra hotline. Please stay on topic. > --

Re: [R] Convert back to lower triangular matrix

2011-11-15 Thread Peter Langfelder
On Tue, Nov 15, 2011 at 2:38 PM, Juliet Ndukum wrote: > Given a vector;> ab = seq(0.5,1, by=0.1)> ab[1] 0.5 0.6 0.7 0.8 0.9 1.0 > The euclidean distance between the vector elements is given by the lower > triangular matrix > dd1 = dist(ab,"euclidean")> dd1    1   2   3   4   52 0.1 >            

Re: [R] Convert back to lower triangular matrix

2011-11-15 Thread David Winsemius
On Nov 15, 2011, at 5:38 PM, Juliet Ndukum wrote: Given a vector;> ab = seq(0.5,1, by=0.1) > ab[1] 0.5 0.6 0.7 0.8 0.9 1.0 The euclidean distance between the vector elements is given by the lower triangular matrix > dd1 = dist(ab,"euclidean") > dd11 2 3 4 5 2 0.1 3 0.2

[R] Convert full matrix back to lower triangular matrix

2011-11-15 Thread Juliet Ndukum
Given a vector;> ab = seq(0.5,1, by=0.1)> ab[1] 0.5 0.6 0.7 0.8 0.9 1.0 The euclidean distance between the vector elements is given by the lower triangular matrix > dd1 = dist(ab,"euclidean")> dd1    1   2   3   4   52 0.1                3 0.2 0.1            4 0.3 0.2 0.1        5 0.4 0.3 0.2 0.

Re: [R] Convert back to lower triangular matrix

2011-11-15 Thread Jeff Newmiller
This is R-help, not the linear algebra hotline. Please stay on topic. --- Jeff NewmillerThe . . Go Live... DCN:Basics: ##.#. ##.#. Live Go...

[R] Convert back to lower triangular matrix

2011-11-15 Thread Juliet Ndukum
Given a vector;> ab = seq(0.5,1, by=0.1)> ab[1] 0.5 0.6 0.7 0.8 0.9 1.0 The euclidean distance between the vector elements is given by the lower triangular matrix > dd1 = dist(ab,"euclidean")> dd1    1   2   3   4   52 0.1                3 0.2 0.1            4 0.3 0.2 0.1        5 0.4 0.3 0.2 0.1

Re: [R] R development master class: NYC, Dec 12-13

2011-11-15 Thread Thomas Levine
Hmm... you know I'd love to run a study on how software and other information displays affect the speed, accuracy and reliability with which people make insights about data. Tom On Tue, Nov 15, 2011 at 4:44 PM, Stavros Macrakis wrote: > > Last time, I was told that I couldn't list my R package a

[R] [R-pkgs] mvProbit -- Multivariate Probit Models

2011-11-15 Thread Arne Henningsen
Dear R users, I am happy to announce the initial release of the "mvProbit" package on CRAN (version 0.1-0). This package provides tools for econometric analysis with Multivariate Probit Models. While these models can be estimated also by several other statistical software packages (e.g. LIMDEP/NLO

Re: [R] R development master class: NYC, Dec 12-13

2011-11-15 Thread Stavros Macrakis
> Last time, I was told that I couldn't list my R package and associated papers as a research activity with > substantial impact because it was outside my official scope of work. (Even though I wrote it so I could > *do* my work.) That seems wrong. My impression is that "method" papers were frequ

Re: [R] how to include integrate in a function that can be solved with uniroot?

2011-11-15 Thread Gerrit Draisma
Thanks Michael, Op 11/14/2011 3:30 PM, R. Michael Weylandt schreef: You need to explicitly pass th to your function with the ... argument of integrate. That was a point I was missing! Thanks again, This solved my problems for this time. Gerrit. E<- function(th){ integrate(function(x,th)

Re: [R] Upgrade R?

2011-11-15 Thread John C Frain
Generally I have several versions of R installed on any PC running Windows 7 and have never had any problem choosing which version of R was to be the default one. In the past the updated version did not always register as the default but there was and is a utility RSetReg.exe in the bin directory

[R] equal spacing of the polygons in levelplot key (lattice)

2011-11-15 Thread Andy Bunn
Given the example: R> (levs <- quantile(volcano,c(0,0.1,0.5,0.9,0.99,1))) 0% 10% 50% 90% 99% 100% 94 100 124 170 189 195 R> levelplot(volcano,at=levs) How can I make the key categorical with the size of the divisions equally spaced in the key? E.g., five equal size rectangles wit

Re: [R] using tapply() with the quantile function?

2011-11-15 Thread Bert Gunter
David: You need to re-read ?tapply _carefully_.  Note that: FUN the function to be applied, or NULL. In the case of functions like +, %*%, etc., the function name must be backquoted or quoted. Now note that in tapply(whatever, byfactor, mean), "mean" _is_ a function. However in tapply (what

Re: [R] using tapply() with the quantile function?

2011-11-15 Thread R. Michael Weylandt
There's a slight variant that might be even more helpful if you need to line the data up with how you started: ave(). I'll let you work out the details, but the key difference is that it returns a vector that has the 90th percentile for each group, each time that group appears, instead of the summa

Re: [R] using tapply() with the quantile function?

2011-11-15 Thread R. Michael Weylandt
1) tapply will work for quantile, but the syntax was a little off: try this tapply(Cape $ ResponseTime, Cape $ Grid_ID, quantile, c(0.05, 0.95)) The fourth argument is additional parameters passed to the function FUN which here is quantile. You could also do this tapply(Cape $ ResponseTime, Cape

[R] using tapply() with the quantile function?

2011-11-15 Thread Kulpanowski, David
Hi: Summary: I am trying to determine the 90th percentile of ambulance response times for groups of data. Background: A fire chief would like to look at emergency response times at the 90th percentile for 1 kilometer grids in Cape Coral, Florida. I have mapped out ambulance response times on a

Re: [R] Difference between two time series

2011-11-15 Thread R. Michael Weylandt
It's not clear what it means for the differences to be "of increasing order" but if you simply mean the differences are increasing, perhaps something like this will work: library(caTools) X = cumsum( 2*(runif(5e4) > 0.5) - 1) # Create a random Walk Y = runmean(X, 30, endrule = "mean", align = "rig

Re: [R] correlations between columns for each row

2011-11-15 Thread Rob Griffin
Excellent, as.matrix() didn't work but switched it to as.numeric() around the definition of both variables in the function and it did work: rF <- function(x, a, b) cor(as.numeric(x[a]), as.numeric(x[b]), use = "complete.obs") maindata$rFcor<-apply(maindata,1,FUN=rF,a=174:213,b=214:253) Thanks

Re: [R] package installtion

2011-11-15 Thread Scott Raynaud
OK, I think I see the problem.  Rather than setting method="nAGQ" I need nAGQ=1.  Doing so throws the following error: "Warning messages: 1: glm.fit: algorithm did not converge 2: In mer_finalize(ans) : gr cannot be computed at initial par (65) Error in diag(vcov(fitmodel)) :   error in evaluat

Re: [R] correlations between columns for each row

2011-11-15 Thread R. Michael Weylandt
Is the whole thing a data frame? Then any multi-column subset is also a data frame. Try adding a as.matrix() wrapper in the definition of rF. Michael On Nov 15, 2011, at 3:14 PM, "Rob Griffin" wrote: > Error in cor(x[a], x[b], use = "complete.obs") : 'x' must be numeric > > This is strange,

Re: [R] Plot alignment with mtext

2011-11-15 Thread Kevin Burton
I hadn't considered altering the font. Thank you I will try that. -Original Message- From: Sarah Goslee [mailto:sarah.gos...@gmail.com] Sent: Tuesday, November 15, 2011 1:53 PM To: Kevin Burton Cc: r-help@r-project.org Subject: Re: [R] Plot alignment with mtext Hi Kevin, On Tue, Nov 15,

Re: [R] Extract pattern from string

2011-11-15 Thread syrvn
Wow, that is a very clever way to do it. Thank you very much! Cheers, Syrvn -- View this message in context: http://r.789695.n4.nabble.com/Extract-pattern-from-string-tp4073432p4074023.html Sent from the R help mailing list archive at Nabble.com. _

Re: [R] correlations between columns for each row

2011-11-15 Thread Rob Griffin
Error in cor(x[a], x[b], use = "complete.obs") : 'x' must be numeric This is strange, it works on your example (and you've understood what I'm trying to do perfectly), but then when I use it on the original data it comes up with the error above I've checked str() and the columns are all numeri

Re: [R] package installtion

2011-11-15 Thread Scott Raynaud
Never mind-I fixed it. My script is throwing the following error: "Error in glmer(formula = modelformula, data = data, family = binomial(link = logit),  :   Argument ‘method’ is deprecated. Use ‘nAGQ’ to choose AGQ.  PQL is not available." I remember hearing somewhere that PQL is no longer av

Re: [R] Reading a specific column of a csv file in a loop

2011-11-15 Thread Jan van der Laan
Yet another solution. This time using the LaF package: library(LaF) d<-c(1,4,7,8) P1 <- laf_open_csv("M1.csv", column_types=rep("double", 10), skip=1) P2 <- laf_open_csv("M2.csv", column_types=rep("double", 10), skip=1) for (i in d) { M<-data.frame(P1[, i],P2[, i]) } (The skip=1 is needed as l

Re: [R] Remove names and more from list with capture.output()

2011-11-15 Thread David Winsemius
On Nov 15, 2011, at 2:43 PM, Sverre Stausland wrote: Thanks David - this is pretty close to what I am looking for. However, the output of vec[2] now includes the row number [1] and quotations marks at the endpoints of the row. Is there an easy way to exclude those? The usual method is to use

Re: [R] Plot alignment with mtext

2011-11-15 Thread Sarah Goslee
Hi Kevin, On Tue, Nov 15, 2011 at 2:36 PM, Kevin Burton wrote: > I would like the text plotted with 'mtext' to be alighned like it is for > printing on the console. Here is what I have: You don't provide any of the info in the posting guide (OS may be important here), or a reproducible example,

[R] package installtion

2011-11-15 Thread Scott Raynaud
I'm getting the following error in a script: "Error: could not find function "lmer."    I'm wondering of my lme4 package is installed incorrectly.  Can someone tell me the installation procedure?  I looked at the support docs but couldn't translate that into anything that would work. __

Re: [R] Estimating model parameters for system of equations

2011-11-15 Thread David Stevens
This problem is not for the faint of heart. Doug Bates, author of nls(...) has said that a general purpose implementaion of R code for multiresponse nonlinear regression is unlikely in the near future. You have a large set of issues to deal with here. First, you have a system of differential eq

Re: [R] Remove names and more from list with capture.output()

2011-11-15 Thread Sverre Stausland
Thanks David - this is pretty close to what I am looking for. However, the output of vec[2] now includes the row number [1] and quotations marks at the endpoints of the row. Is there an easy way to exclude those? Thanks Sverre On Tue, Nov 15, 2011 at 8:11 AM, David Winsemius wrote: > > On Nov 14

[R] Plot alignment with mtext

2011-11-15 Thread Kevin Burton
I would like the text plotted with 'mtext' to be alighned like it is for printing on the console. Here is what I have: > print(emt) ME RMSE MAE MPE MAPE MASE original -1.034568e+07 1.097695e+08 2.433160e+07 -31.30554 3

Re: [R] Difference between two time series

2011-11-15 Thread Sarwarul Chy
Hello, Can you please help me with this? I am also stack in the same problem. Sam -- View this message in context: http://r.789695.n4.nabble.com/Difference-between-two-time-series-tp819843p4073800.html Sent from the R help mailing list archive at Nabble.com. __

[R] ANNOUNCEMENT: 20% discount on the most recent R books from Chapman & Hall/CRC!

2011-11-15 Thread Thorne, Melanie
Take advantage of a 20% discount on the most recent R books from Chapman & Hall/CRC! We are pleased to offer our latest R books at a 20% discount through our website. To take advantage of this offer, simply visit www.crcpress.com, choose your titles and insert code AZL02 in the 'Promotion C

[R] Help with "error: no acceptable C compiler found in $PATH"

2011-11-15 Thread Hari Easwaran
Dear all, I am trying to install a package from bioconductor (biomaRt) for which I need the RCurl package. I get the following main error message when I try to install RCurl (and its dependencies). configure: error: no acceptable C compiler found in $PATH See `config.log' for more details. ERROR:

Re: [R] points() colored by value

2011-11-15 Thread Sarah Goslee
Hi Chris, On Tue, Nov 15, 2011 at 1:47 PM, Chris82 wrote: > Hi R users, > > I want to colored points by their value > > for example: > > x <- c(1,2,3,4) > y <- c(1,2,3,4) > z <- c(2,3,4,9) > > y and x are coordinates > > z is the value of the coordinates > > points(x,y,col= rainbow(z)) In the ge

Re: [R] points() colored by value

2011-11-15 Thread R. Michael Weylandt
Try either col=z or col=rainbow(max(z))[z] depending on what color scheme you want. Michael On Nov 15, 2011, at 1:47 PM, Chris82 wrote: > Hi R users, > > I want to colored points by their value > > for example: > > x <- c(1,2,3,4) > y <- c(1,2,3,4) > z <- c(2,3,4,9) > > y and x are coord

Re: [R] Help

2011-11-15 Thread R. Michael Weylandt
I'm not sure your request completely makes sense: marginal means and variances are not sufficient to give the joint distribution; even if you can be assured it is bivariate normal, you still need a correlation. Just a heads up Michael. PS - next time would you please use a slightly more nuance

Re: [R] Estimating model parameters for system of equations

2011-11-15 Thread Arne Henningsen
Dear Louise On 15 November 2011 19:03, lstevenson wrote: > Hi all, > > I'm trying to estimate model parameters in R for a pretty simple system of > equations, but I'm having trouble.  Here is the system of equations (all > derivatives): > eqAlgae <- (u_Amax * C_A) * (1 - (Q_Amin / Q_A)) > eqQuota

[R] Estimating model parameters for system of equations

2011-11-15 Thread lstevenson
Hi all, I'm trying to estimate model parameters in R for a pretty simple system of equations, but I'm having trouble. Here is the system of equations (all derivatives): eqAlgae <- (u_Amax * C_A) * (1 - (Q_Amin / Q_A)) eqQuota <- (p_max * R_V) / (K_p + R_V) - ((Q_A-Q_Amin)*u_Amax) eqResource <- -C

Re: [R] Lower bounds on selfStart function not working

2011-11-15 Thread Schatzi
I was able to solve this problem by going back to nls and obtaining the initial parameter estimates through optim. When I used nlsList with my dataset, it took 2 minutes to solve and was not limited by the bounds. Now I have the bounds working and it takes 45 seconds to solve. Here is the new code:

[R] points() colored by value

2011-11-15 Thread Chris82
Hi R users, I want to colored points by their value for example: x <- c(1,2,3,4) y <- c(1,2,3,4) z <- c(2,3,4,9) y and x are coordinates z is the value of the coordinates points(x,y,col= rainbow(z)) something like that But haven't found any solution at the moment. Thanks. Chris -- View

Re: [R] Putting directory path as a parameter

2011-11-15 Thread Henrik Bengtsson
file.path() is much better for this than paste(), e.g. dir <- "C:/Users/Desktop" pathname <- file.path(dir, "bs_dev_segment_file.csv") temp_data <- read.csv(pathname) /Henrik On Tue, Nov 15, 2011 at 10:08 AM, R. Michael Weylandt wrote: > Try pasting them together like > > paste(dir, "...") > >

Re: [R] Help

2011-11-15 Thread David Winsemius
On Nov 15, 2011, at 11:21 AM, Gyanendra Pokharel wrote: Hi all, I have the mean vector mu<- c(0,0) and variance sigma <- c(10,10), now how to sample from the bivariate normal density in R? Can some one suggest me? I did not fine the function "mvdnorm" in R. But when you typed ?mvdnorm R sh

Re: [R] correlations between columns for each row

2011-11-15 Thread Joshua Wiley
Hi Rob, Here is one approach: ## define a function that does the calculations ## (the covariance of two vectors divided by the square root of ## the products of their variances is just a correlation) rF <- function(x, a, b) cor(x[a], x[b], use = "complete.obs") set.seed(1) bigdata <- matrix(rno

Re: [R] Putting directory path as a parameter

2011-11-15 Thread R. Michael Weylandt
Try pasting them together like paste(dir, "...") You may need to use the collapse argument. Alternatively, change your working directory to dir with setwd(). M On Nov 15, 2011, at 9:12 AM, aajit75 wrote: > Hi List, > > I am new to R, this may be simple. > > I want to store directory path

Re: [R] Putting directory path as a parameter

2011-11-15 Thread Joshua Wiley
Hi Aajit, try using the ?paste function to combine the variable with your directly and the filename into one string, and then pass that to read.csv() or whatever paste(dir, "/bs_dev_segment_file.csv", sep = '') HTH, Josh On Tue, Nov 15, 2011 at 6:12 AM, aajit75 wrote: > Hi List, > > I am new

Re: [R] correlations between columns for each row

2011-11-15 Thread robgriffin247
Just as an update on this problem: I have managed to get the variance for the selected columns Now all I need is the covariance between these 2 selections - the two target columns are and the aim is that a new column contain a covariance value between these on each row: maindata[,c(174:213)] an

[R] Help

2011-11-15 Thread Gyanendra Pokharel
Hi all, I have the mean vector mu<- c(0,0) and variance sigma <- c(10,10), now how to sample from the bivariate normal density in R? Can some one suggest me? I did not fine the function "mvdnorm" in R. Best Gyan [[alternative HTML version deleted]]

[R] Putting directory path as a parameter

2011-11-15 Thread aajit75
Hi List, I am new to R, this may be simple. I want to store directory path as parameter which in turn to be used while reading and writing data from csv files. How I can use dir defined in the below mentioned example while reading the csv file. Example: dir <- "C:/Users/Desktop" #location of

Re: [R] Extract pattern from string

2011-11-15 Thread Justin Haynes
take a look at the structure of what Sys.time returns. str(Sys.time) and now at ?strptime! > format(Sys.time(),format='%d-%H-%M-%S') [1] "15-09-55-55" > format(Sys.time(),format='%Y') [1] "2011" > format(Sys.time(),format='%m') [1] "11" > Hope that helps, Justin On Tue, Nov 15, 2011 at 9:48

[R] Extract pattern from string

2011-11-15 Thread syrvn
Hello, with Sys.time() you get the following string: "2011-11-15 16:25:55 GMT" How can I extract the following substrings: year <- 2011 month <- 11 day_time <- 15_16_25_55 Cheers, Syrvn -- View this message in context: http://r.789695.n4.nabble.com/Extract-pattern-from-string-tp4073432p4

Re: [R] Regular expressions in R

2011-11-15 Thread Joshua Wiley
Hi Michael, Your strings were long so I made a bit smaller example. Sarah made one good point, you want to be using gsub() not sub(), but when I use your code, I do not think it even works precisely for one instance. Try this on for size, you were 99% there: ## simplified cases form1 <- c('produ

[R] mlpowsim

2011-11-15 Thread Scott Raynaud
I'm using Bill Browne's MLPowSim to do some sample size estimation for a multilevel model.  It creates an R program to carry out the estimation using lmer in the lme4 library.  When there are predictors with more than two categories one has to modify the code generated to account for the multino

Re: [R] Regular expressions in R

2011-11-15 Thread Sarah Goslee
Hi Michael, You need to take another look at the examples you were given, and at the help for ?sub(): The two ‘*sub’ functions differ only in that ‘sub’ replaces only the first occurrence of a ‘pattern’ whereas ‘gsub’ replaces all occurrences. If ‘replacement’ contains backreferen

[R] Regular expressions in R

2011-11-15 Thread Michael Griffiths
Good afternoon list, I have the following character strings; one with spaces between the maths operators and variable names, and one without said spaces. form<-c('~ Sentence + LEGAL + Intro + Intro / Intro1 + Intro * LEGAL + benefit + benefit / benefit1 + product + action * mean + CTA + help + me

Re: [R] Controlling the precision of the digits printed

2011-11-15 Thread Kevin Burton
Thank you. I mainly didn't know about the vector/matrix printing rules. Kevin -Original Message- From: William Dunlap [mailto:wdun...@tibco.com] Sent: Tuesday, November 15, 2011 10:43 AM To: Kevin Burton; r-help@r-project.org Subject: RE: [R] Controlling the precision of the digits prin

Re: [R] Models with ordered and unordered factors

2011-11-15 Thread Paul Johnson
On Tue, Nov 15, 2011 at 9:00 AM, Catarina Miranda wrote: > Hello; > > I am having a problems with the interpretation of models using ordered or > unordered predictors. > I am running models in lmer but I will try to give a simplified example > data set using lm. > Both in the example and in my rea

Re: [R] With an example - Re: rbind.data.frame drops attributes for factor variables

2011-11-15 Thread Sammy Zee
Thanks. Yes, I meant nrow(dataset)+1 (typo...) Sammy On Mon, Nov 14, 2011 at 1:29 AM, Petr PIKAL wrote: > > > > dataset[ nrow(dataset), ] <- c ("Male", 5, "bad") > > > > The above seems to have worked to append a row in place of a rbind(). > This > > No. It overwrites your last row. You maybe m

Re: [R] Controlling the precision of the digits printed

2011-11-15 Thread William Dunlap
When you print a vector R uses a single format for the whole vector and tries to come up with one format that displays all the values accurately enough. For a matrix (or data.frame) it uses a different format for each column, so perhaps you would like the output of: > matrix(a, nrow=1, dimnames

Re: [R] Models with ordered and unordered factors

2011-11-15 Thread Bert Gunter
... In addition, the following may also be informative. > f <- paste("day", 1:3) > contrasts(ordered(f)) .L .Q [1,] -7.071068e-01 0.4082483 [2,] -7.850462e-17 -0.8164966 [3,] 7.071068e-01 0.4082483 > contrasts(factor(f)) day 2 day 3 day 1 0 0 day 2 1

  1   2   >