[R] condition and function

2013-05-13 Thread catalin roibu
Hello all! I want to create a new variable in a dataframe, and this variable is based on a regression equation. For example for example for the hc=10, the values of the new variable(d0.3) is obtained by d0.3=15.9122+0.2105*dc, for hc=30, d0,3 values are obtained by d0.3=1.4781+0.8827*dc. Thank

Re: [R] condition and function

2013-05-13 Thread Berend Hasselman
On 13-05-2013, at 08:16, catalin roibu catalinro...@gmail.com wrote: Hello all! I want to create a new variable in a dataframe, and this variable is based on a regression equation. For example for example for the hc=10, the values of the new variable(d0.3) is obtained by

Re: [R] prediction in a loop with only one sample

2013-05-13 Thread PIKAL Petr
Hi Without reproducible example you probably do not persuade us to go through your almost unreadable code. From what you say I think you need split your file to two - training and testing The approach I would use is sampling a row index. ind- sample(1:nrow(some.data), 300) testing -

Re: [R] Fit a standardized generalized hyperbolic distribution to my data?

2013-05-13 Thread Enrico Schumann
On Thu, 09 May 2013, Neuman Co neumanc...@gmail.com writes: Hi, I want to fit a standardized generalized hyperbolic distribution to my data, I am using the dsgh command of the fBasics package and the optim command. I tried the following:

Re: [R] Automatic way to embed fonts into all pdf output?

2013-05-13 Thread Pascal Oettli
Hello, I don't know whether it is what you are looking for, but cairo_pdf seems to embed the fonts automatically, if I am not mistaken. pdf(russian1.pdf, width=3, height=0.8) grid.text(\u0417\u0434\u0440\u0430\u0432\u0441\u0442\u0432\u0443\u0439\u0442\u0435 is 'hello' in Russian (Cyrillic))

[R] help: R GUI front-end has stopped working

2013-05-13 Thread irene castro conde
Hello, I'm using the function nlminb of the package stats inside a loop and when the number of trials grows, R crashes and says R GUI front-end has stopped working. Could you help me with this problem? I have try in versions 2.15.1,2.15.2 and 3.0.0. sessionInfo() R version 2.15.2

Re: [R] help: R GUI front-end has stopped working

2013-05-13 Thread PIKAL Petr
Hi Works for me without error. However are you sure your code does what you suppose it does? It does not return anything visible BB is list 3000x13 with all values same except last element in each node. AA is list 3000x13 with various values. ro is a vector with 2997 values 0.001 one value

Re: [R] help: R GUI front-end has stopped working

2013-05-13 Thread PIKAL Petr
Hi Try to make crashes reproducible. As I said it works on my machine without any problem. sessionInfo() R Under development (unstable) (2013-02-13 r61942) Platform: i386-w64-mingw32/i386 (32-bit) locale: [1] LC_COLLATE=Czech_Czech Republic.1250 LC_CTYPE=Czech_Czech Republic.1250 [3]

Re: [R] scatter plot matrix with different x-y variables

2013-05-13 Thread adel daoud
Greg, the pairs2 function was exactly what I wanted. Thanks for a very useful function. May I ask a follow up question, is it possible to draw a correlation line with R2 values for each graph – on each graph, or on the side of the graph. I am sure this is possible somehow, but I am new to R

[R] help

2013-05-13 Thread masumeh akhgar
Hi deer all I want to analysis of covariance with R software. What should I do? [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

[R] question about poisson regression

2013-05-13 Thread meng
Hi all: I have a question about poisson regression. My data: drug result count 1 1 8 1 254 2 1 20 2 2 44 My model: model- glm(count ~ drug*result, family = poisson) My result: summary(model) Coefficients: Estimate Std. Error z

[R] grepl

2013-05-13 Thread Francesco Isotta
Hello, it is not clear to me, how to search if in a string there is a . (full stop). Using: grepl(.,string) doesn't work because the full stop it is a metacharacter (it gives TRUE also if no full stop is in the character). I tried also to insert \. but it does not work. grepl(\.,string) Error:

Re: [R] help: R GUI front-end has stopped working

2013-05-13 Thread Duncan Murdoch
On 13-05-13 3:58 AM, irene castro conde wrote: Hello, I'm using the function nlminb of the package stats inside a loop and when the number of trials grows, R crashes and says R GUI front-end has stopped working. Could you help me with this problem? I have try in versions 2.15.1,2.15.2 and

Re: [R] grepl

2013-05-13 Thread Duncan Murdoch
On 13-05-13 4:19 AM, Francesco Isotta wrote: Hello, it is not clear to me, how to search if in a string there is a . (full stop). Using: grepl(.,string) doesn't work because the full stop it is a metacharacter (it gives TRUE also if no full stop is in the character). Use grepl(., string,

Re: [R] question about poisson regression

2013-05-13 Thread Achim Zeileis
On Mon, 13 May 2013, meng wrote: Hi all: I have a question about poisson regression. My data: drug result count 1 1 8 1 254 2 1 20 2 2 44 My model: model- glm(count ~ drug*result, family = poisson) My result: summary(model) Coefficients:

Re: [R] help

2013-05-13 Thread Rui Barradas
Hello, You should start by reading the file R-intro.pdf that comes with your installation of R, Chapter 11 Statistical models in R. Type the following at an R prompt: ?lm ?anova Hope this helps, Rui Barradas Em 13-05-2013 05:23, masumeh akhgar escreveu: Hi deer all I want to analysis of

Re: [R] grepl

2013-05-13 Thread arun
You may also try: grepl([.],c(ad.1,ads,ad.2)) #[1]  TRUE FALSE  TRUE A.K. - Original Message - From: Francesco Isotta isot...@hotmail.com To: r-help@r-project.org Cc: Sent: Monday, May 13, 2013 4:19 AM Subject: [R] grepl Hello, it is not clear to me, how to search if in a string there

Re: [R] Return a vector in Fibonacci sequence function

2013-05-13 Thread Michael Dewey
At 20:51 10/05/2013, Tomos_D wrote: That's great thanks There is a closed form expression for the nth Fibonacci number. See Wikipedia for details. --- Original Message --- From: arun kirshna [via R] ml-node+s789695n4666758...@n4.nabble.com Sent: May 10, 2013 3:34 PM To: Tomos_D

[R] Anova und Tukey HSD

2013-05-13 Thread Jochen Schreiber
Hallo zusammen, ich mache zuerst mittels eine Anova eine Überprüfung ob in den Daten ein signifikanter Unterschied exisitiert. Danach will ich mittels des TukeyHSD rausfinden, zwischen welchen Gruppe der Unterschied vorliegt. Allerdings weiß ich nicht wie ich die Daten interpretieren soll.

Re: [R] grepl

2013-05-13 Thread Francesco Isotta
Thanks so much for your help, now I could solve the problem (using [.])! 2013/5/13 arun smartpink...@yahoo.com You may also try: grepl([.],c(ad.1,ads,ad.2)) #[1] TRUE FALSE TRUE A.K. - Original Message - From: Francesco Isotta isot...@hotmail.com To: r-help@r-project.org

[R] Anova und Tukey HSD

2013-05-13 Thread Jochen Schreiber
Hallo zusammen, ich mache zuerst mittels eine Anova eine Überprüfung ob in den Daten ein signifikanter Unterschied exisitiert. Danach will ich mittels des TukeyHSD rausfinden, zwischen welchen Gruppe der Unterschied vorliegt. Allerdings weiß ich nicht wie ich die Daten interpretieren soll.

[R] reduce three columns to one with the colnames

2013-05-13 Thread David Studer
Hello everybody, I have three variables blue, green and red containing values 0 (no) and 1 (yes). How can I easily create another variable colors with the values blue, green and red? I hope that you can understand my question and appreciate any solutions or hints! Thank you! David

Re: [R] reduce three columns to one with the colnames

2013-05-13 Thread Pascal Oettli
Hi, ?rgb HTH Pascal 2013/5/13 David Studer stude...@gmail.com Hello everybody, I have three variables blue, green and red containing values 0 (no) and 1 (yes). How can I easily create another variable colors with the values blue, green and red? I hope that you can understand my

[R] Fwd: need an assistance

2013-05-13 Thread Iut Tri Utami
Hi, i am tryng to run Bagging SVM but I have a problem. I do Bagging SVM based on algoritm bagging Trees by Breiman. I get the following error and I think I am wrong in calculating err.mean and err.vote. I also have difficulty in making the plot. library(e1071) gendata -

Re: [R] reduce three columns to one with the colnames

2013-05-13 Thread Bert Gunter
Cute answer, Pascal. It may even be the answer to the question the OP should have asked, but I don't think it answered the question that was asked. That might be: c(red[red], green[green], blue[blue]) Cheers, Bert On Mon, May 13, 2013 at 7:36 AM, Pascal Oettli kri...@ymail.com wrote: Hi,

Re: [R] reduce three columns to one with the colnames

2013-05-13 Thread Bert Gunter
No -- my answer is wrong. I'll leave it to others to correct. Obvious question to OP: What if more than one of your colors variables simultaneously have a 1? -- Bert On Mon, May 13, 2013 at 8:09 AM, Bert Gunter bgun...@gene.com wrote: Cute answer, Pascal. It may even be the answer to the

[R] How can I make a loop to do multiple regression for more than 3000 dependent variables?

2013-05-13 Thread Kristi Glover
Hi R- User, I am just wondering how I can make a loop to repeat multiple regression. I do have more than 3000 dependent variables (example S1, S2..Sn) and put in different columns but the explanatory variables are the same for all these dependent variables. I have given an example below. In

Re: [R] reduce three columns to one with the colnames

2013-05-13 Thread David Studer
OK, seems like nobody understood my question ;-) Let's make another example: I have three variables: data$male and data$female and data$transsexuals All the three of them contain the values 0 and 1. Now I'd like to create another variable data$sex. Now in all cases where data$female==1 the

Re: [R] Anova und Tukey HSD

2013-05-13 Thread Meyners, Michael
Jochen, a) this is an English-spoken mailing list; other languages are not encouraged nor will they typically generate a lot of replies... b) your code is fine, so this is not an R-issue; you are rather stuck with some of the stats background -- you might want to see a friendly local

Re: [R] reduce three columns to one with the colnames

2013-05-13 Thread arun
HI, May be: dat1- read.table(text= male female transsexuals 0 1 0 1 0 0 0 0 1 0 1 0 1 0 0 1 0 0 0 1 0 ,sep=,header=TRUE)  dat1$sex-colnames(dat1)[apply(dat1,1,function(x) which(x==1))]  dat1 #  male female transsexuals  sex #1    0  1    0   female #2    1  0   

Re: [R] reduce three columns to one with the colnames

2013-05-13 Thread Gabor Grothendieck
On Mon, May 13, 2013 at 10:24 AM, David Studer stude...@gmail.com wrote: Hello everybody, I have three variables blue, green and red containing values 0 (no) and 1 (yes). How can I easily create another variable colors with the values blue, green and red? Suppose blue - c(1, 0, 0, 1)

Re: [R] NMDS with missing data?

2013-05-13 Thread David Carlson
First. Do not use html messages. They are converted to plain text and your table ends up a mess. See below. It appears the variables are all numeric? If so, there are two standard approaches to handling multiple scales and magnitudes with cluster analysis: 1. Use z-scores. The scale() function

Re: [R] How can I make a loop to do multiple regression for more than 3000 dependent variables?

2013-05-13 Thread Jeff Newmiller
Please don't post In HTML. It mangles your code. Figure out how to adjust your email software. Your example is incomplete, in that you have not indicated how you are doing the regression manually (I.e what R code steps are you using?). If your model is linear, you could do: deps - as.matrix(

[R] Matching names with non-English characters

2013-05-13 Thread Spencer Graves
Hello: How can one match names containing non-English characters that appear differently in different but related data files? For example, I have data on Raúl Grijalva, who represents the third district of Arizona in the US House of Representatives. This first name appears as Raúl

Re: [R] reduce three columns to one with the colnames

2013-05-13 Thread William Dunlap
If the dataset is large you may prefer to process it by column instead of by row. E.g., m - matrix(0, nrow=1e6, ncol=3, dimnames=list(NULL,c(Red,Green,Blue))) m[cbind(seq_len(nrow(m)), sample(ncol(m), size=nrow(m), replace=TRUE))] - 1 head(d) Red Green Blue 1 0 0

Re: [R] Matching names with non-English characters

2013-05-13 Thread Jeff Newmiller
Build a lookup table for your data. I think it is a fools errand to think that you can automatically normalize arbitrary Unicode characters to an ASCII form that everyone will agree on. BTW: To avoid propagating open joins your data should probably have some kind of id for the term those

Re: [R] reduce three columns to one with the colnames

2013-05-13 Thread Bert Gunter
... and I could not resist adding (assuming the vectors are all in a data frame or matrix, yourdat): apply(yourdat,1,function(x)c(blue,green,red)[as.logical(x)]) Cheers, Bert On Mon, May 13, 2013 at 8:39 AM, Gabor Grothendieck ggrothendi...@gmail.com wrote: On Mon, May 13, 2013 at 10:24 AM,

[R] dotcharts next to boxplots

2013-05-13 Thread maggy yan
my dataset looks like this in the beginning: Dosis weight sex 1 06.62 m 2 06.65 m 3 05.78 m 4 05.63 m 5 06.05 m 6 06.48 m 7 05.50 m 8 05.37 m 9 1

Re: [R] attr vs attributes

2013-05-13 Thread luke-tierney
There is a certain logic to the behavior. In the complex assignment in the second line of x - 1 attributes(x)[[attrName]] - 2012 what happens is first the equivalent of a - attributes(x) ## a is NULL a[[attrName]] - 2012 ## a is now a numeric vector and then attributes(x)

Re: [R] Matching names with non-English characters

2013-05-13 Thread Duncan Murdoch
On 13/05/2013 12:05 PM, Spencer Graves wrote: Hello: How can one match names containing non-English characters that appear differently in different but related data files? For example, I have data on Raúl Grijalva, who represents the third district of Arizona in the US House of

Re: [R] Multinomial-Dirichlet using R

2013-05-13 Thread Anamika Chaudhuri
Hi David: My main goal is to be able to find the method/model that estimates the random effect of site on multiple binomial outcomes in multicenter clinical trial settings. The methods you have suggested are fixed effects models, right? Thanks Anamika On Sun, May 12, 2013 at 9:44 PM, David

Re: [R] Multinomial-Dirichlet using R

2013-05-13 Thread David Winsemius
On May 13, 2013, at 9:08 AM, Anamika Chaudhuri wrote: Hi David: My main goal is to be able to find the method/model that estimates the random effect of site on multiple binomial outcomes in multicenter clinical trial settings. The methods you have suggested are fixed effects models,

Re: [R] reduce three columns to one with the colnames

2013-05-13 Thread Gabor Grothendieck
On Mon, May 13, 2013 at 11:22 AM, David Studer stude...@gmail.com wrote: OK, seems like nobody understood my question ;-) Let's make another example: I have three variables: data$male and data$female and data$transsexuals All the three of them contain the values 0 and 1. Now I'd like to

Re: [R] dotcharts next to boxplots

2013-05-13 Thread David Carlson
Use dput() to send data to r-help: dput(Daten) structure(list(Dosis = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 1L), weight = c(6.62, 6.65, 5.78, 5.63, 6.05, 6.48, 5.5, 5.37, 6.25, 6.95, 5.61), sex = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = m, class = factor)), .Names

[R] melt in reshape2 destroying dates?

2013-05-13 Thread John Kane
When I melt a data frame with some dates I am getting some strange results. I seem to lose the date format with POSIXct and get a row of zeros with POSIXlt Any suggestions as to what I am messing up? Code and data below. Thanks, John Kane Kingston ON Canada mydata - structure(list(dd1 =

Re: [R] reduce three columns to one with the colnames

2013-05-13 Thread arun
With data.table(), this could be faster m - matrix(0, nrow=1e6, ncol=3, dimnames=list(NULL,c(Red,Green,Blue))) set.seed(24)  m[cbind(seq_len(nrow(m)), sample(ncol(m), size=nrow(m), replace=TRUE))] - 1 d- as.data.frame(m) library(data.table) dt1- data.table(d)  system.time(d$RGB- with(d,

Re: [R] melt in reshape2 destroying dates?

2013-05-13 Thread John Kane
Thanks very much. I could have sworn I had tried that but obviously I had not. So melt() is returning the correct value which is what I had suspected but I obiously did not convert it properly.I wonder if this buggy enough to mention the behaviour to the package maintainer? John Kane

Re: [R] melt in reshape2 destroying dates?

2013-05-13 Thread arun
In the first case:  mdat$value-.POSIXct(mdat$value,tz=EST)  mdat$value[1:3] #[1] 2012-01-01 01:00:00 EST 2012-01-01 02:00:00 EST #[3] 2012-01-01 03:00:00 EST  mydata$dd1[1:3] #[1] 2012-01-01 01:00:00 EST 2012-01-01 02:00:00 EST #[3] 2012-01-01 03:00:00 EST A.K. - Original Message -

Re: [R] melt in reshape2 destroying dates?

2013-05-13 Thread arun
Hi John, No problem If you look at the storage mode: storage.mode(mydata$dd1) #[1] integer I think during melt, it class(mdat$value) #[1] numeric  class(mydata$dd1) #[1] POSIXct POSIXt I guess during melting, this gets coerced to integer class. You can also do:  

[R] what does summary(polr(...)) really call?

2013-05-13 Thread ivo welch
dear R experts---how do I determine what summary(polr( y ~ x )) calls? it is not summary.lm(polr(y~x)) or summary.mlm or summary.glm, or stats:::summary.lm or ... in fact, none of the summaryesc methods seem to invoke what summary invokes. advice, as always, appreciated. regards, /iaw

Re: [R] what does summary(polr(...)) really call?

2013-05-13 Thread William Dunlap
Look at methods(summary) to get a list of the summary methods - it includes summary.polr when MASS is loaded. The starred ones are not in any exported namespace, so summaryesc (which I assume means name name completion in you UI) may not show them. Use MASS:::summary.polr to look at it. Bill

Re: [R] melt in reshape2 destroying dates?

2013-05-13 Thread John Kane
Amazingly enough I think i actually understand that albeit superficially. Thanks John Kane Kingston ON Canada -Original Message- From: smartpink...@yahoo.com Sent: Mon, 13 May 2013 11:22:35 -0700 (PDT) To: jrkrid...@inbox.com Subject: Re: [R] melt in reshape2 destroying dates?

[R] recover log of matrix

2013-05-13 Thread JiangZhengyu
Dear all, I have a matrix with all values being log transformed. I want them back to the values before the transformation. i.e. 2^matrix M. Is there any easy code to do this? Thanks,Zhengyu [[alternative HTML version deleted]]

Re: [R] what does summary(polr(...)) really call?

2013-05-13 Thread Achim Zeileis
On Mon, 13 May 2013, ivo welch wrote: dear R experts---how do I determine what summary(polr( y ~ x )) calls? it is not summary.lm(polr(y~x)) or summary.mlm or summary.glm, or stats:::summary.lm or ... in fact, none of the summaryesc methods seem to invoke what summary invokes.

Re: [R] recover log of matrix

2013-05-13 Thread Rui Barradas
Hello, Just use what you've written: m - matrix(1:12, ncol = 3) 2^m # it's a matrix Hope this helps, Rui Barradas Em 13-05-2013 19:41, JiangZhengyu escreveu: Dear all, I have a matrix with all values being log transformed. I want them back to the values before the transformation. i.e.

Re: [R] recover log of matrix

2013-05-13 Thread Berend Hasselman
On 13-05-2013, at 20:41, JiangZhengyu zhyjiang2...@hotmail.com wrote: Dear all, I have a matrix with all values being log transformed. I want them back to the values before the transformation. i.e. 2^matrix M. Is there any easy code to do this? Thanks,Zhengyu Please don't post in

[R] how to merge 2 data frame if you want to exclude mutual obs

2013-05-13 Thread ramoss
In the example below, I am merging 2 data frames I want everything in the first one(all) all2 - merge(all,spets, by.x=c(tdate,symbol), by.y=c(tdate,symbol),all.x=TRUE) What if I want to exclude everything in y? I tried below but doesn't seem to work. all2 - merge(all,spets, by.x=c(tdate,symbol),

[R] Select rasters in stack based on layer partial name match

2013-05-13 Thread Fabio Berzaghi
I have a stack of rasters (one per species) and then I have a data frame with lat/long columns along with a species name. |fls= list.files(pattern=median) s- stack(fls) df-c(x,y,species name)| I want to be able to just select one raster at a time to use with an extract function. I want the

Re: [R] recover log of matrix

2013-05-13 Thread arun
Hi,  mat1- matrix(log(1:20),ncol=5)  exp(mat1) # [,1] [,2] [,3] [,4] [,5] #[1,]    1    5    9   13   17 #[2,]    2    6   10   14   18 #[3,]    3    7   11   15   19 #[4,]    4    8   12   16   20 mat2- matrix(log2(1:20),ncol=5)  2^mat2 # [,1] [,2] [,3] [,4] [,5] #[1,]    1    5    9   13 

Re: [R] how to merge 2 data frame if you want to exclude mutual obs

2013-05-13 Thread ramoss
To clarify: So if in data frame A you have TdatesymbolTA 12/12/12 AX 123 12/11/12 ZZA4R 12/12/12 WQ B8R Data frame B TdatesymbolTA 12/12/12 AX 123 12/11/12 ZZ

[R] Creating Color Pallets

2013-05-13 Thread Nathan Barber - NOAA Federal
I am trying to create my own color pallet, consisting of 18 hexadecimal colors. I'm having trouble figuring out what to use to define/display them. ColorRampPallet can only take 3 colors so I was hoping to somehow create a palette then point to that pallet. Any suggestions? Thanks -- Nathan

Re: [R] how to merge 2 data frame if you want to exclude mutual obs

2013-05-13 Thread Sarah Goslee
A[!(A$symbol %in% B$symbol), ] maybe? # converted your email to a reproducible example, as you should # have done - use dput() to provide data, not just copy paste. A - structure(list(Tdate = c(12/12/12, 12/11/12, 12/12/12), symbol = c(AX, ZZ, WQ), TA = c(123, A4R, B8R)), .Names = c(Tdate,

Re: [R] what does summary(polr(...)) really call? --- and obscure buglet

2013-05-13 Thread ivo welch
thx, everyone. this helped me debug further. It turns out summary.polr was not my problem, though. instead, I ran into a weird buglet with the name of my data.frame screwing up summary.polr. library(MASS) N - 50 pairs - data.frame(y=as.factor(as.integer(rnorm(N)*10)),

Re: [R] how to merge 2 data frame if you want to exclude mutual obs

2013-05-13 Thread Adams, Jean
If you create a dummy variable for spets prior to merging, you can keep only those rows where this value is missing after merging. For example: # fake data all - data.frame(tdate=c(1, 3, 5, 7), symbol=c(2, 4, 6, 8)) spets - data.frame(tdate=c(1, 3, 5, 2), symbol=c(2, 8, 6, 6)) # create a dummy

Re: [R] Creating Color Pallets

2013-05-13 Thread Adams, Jean
Nathan, See the help file on the funciton palette() ?palette For example, for windows, you can do this ... windows() palette(c(#00, #E69F00, #56B4E9, #009E73, #F0E442, #0072B2, #D55E00, #CC79A7, #FF)) plot(1:9, 1:9, pch=16, cex=8, col=1:9) Jean On Mon, May 13, 2013 at 12:41 PM,

Re: [R] how to merge 2 data frame if you want to exclude mutual obs

2013-05-13 Thread ramoss
Thanks Adam your solution worked perfectly. Thank you all for your responses. -- View this message in context: http://r.789695.n4.nabble.com/how-to-merge-2-data-frame-if-you-want-to-exclude-mutual-obs-tp4666975p4666985.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] aggregate.data.frame with NAs and different types

2013-05-13 Thread Kenn Konstabel
or without plyr you could do, e.g., aggregate(df2aggregate[,-1], df2aggregate[id], function(..) if(is.numeric(..)) mean(..) else if(is.character(..)) ..[1]) Kenn On Mon, May 13, 2013 at 1:30 AM, Spencer Graves spencer.gra...@structuremonitoring.com wrote: Hi, Arun: Thanks. That's exactly

Re: [R] how to merge 2 data frame if you want to exclude mutual obs

2013-05-13 Thread arun
Hi, datA-read.table(text= Tdate    symbol    TA 12/12/12  AX  123 12/11/12  ZZ    A4R 12/12/12  WQ  B8R ,sep=,header=TRUE,stringsAsFactors=FALSE) datB- read.table(text= Tdate    symbol    TA 12/12/12  AX  123

Re: [R] Basic R question

2013-05-13 Thread arun
Hi, Try: integrate(Pareto,lower=0,upper=(MM-1)+0.5,x0=x0,alpha2=alpha2) #170.5065 with absolute error 0.016 A.K. For a homework assignment I'm constructing a simple code. R keeps returning that a x0 is missing in evaluating p2. I can't figure out why. lab1 - 50; mu - 1; sigma - 1 alpha1 -

[R] Math problem with xts objects

2013-05-13 Thread Noah Silverman
Hello, I coming across a strange problem doing math on an xts object. If I have an xts object of stock prices (perhaps 5 minute bars of open, high, low,close) and want to do some math, the results fail. For example: d$close[10] - d$open[10] works perfectly d$close[10] - d$open[9] fails. I

Re: [R] what does summary(polr(...)) really call? --- and obscure buglet

2013-05-13 Thread Duncan Mackay
Ivo I think you should read the help page. Firstly Y should be an ordered factor - you are fitting a proportional odds model as the name suggests Regards Duncan Duncan Mackay Department of Agronomy and Soil Science University of New England Armidale NSW 2351 Email: home:

[R] Fwd: ?on-consequitve # of lags in VAR (package 'vars)?

2013-05-13 Thread Dimitri Liakhovitski
Hello! I was wondering if it is at all possible (in vars or maybe outside of it?) to include non-consequite lags into the model, vor example lags 1 and 3. So far, it looks like when I set p = 3 under VAR, it includes all lags (1:3). Thank you very much! -- Dimitri Liakhovitski -- Dimitri

Re: [R] Math problem with xts objects

2013-05-13 Thread Joshua Ulrich
On Mon, May 13, 2013 at 6:47 PM, Noah Silverman noahsilver...@ucla.edu wrote: Hello, I coming across a strange problem doing math on an xts object. If I have an xts object of stock prices (perhaps 5 minute bars of open, high, low,close) and want to do some math, the results fail. For

[R] Sampling Weights and lmer() update?

2013-05-13 Thread Richard Blissett
Perhaps I am not looking in the right place, but I am looking for a way to use lmer() to run a multilevel model that incorporates sampling weights. I have used the Lumley survey package to use sampling weights in the past, but according to post I found online from Thomas Lumley in mid-2012, R is

[R] Boundaries of consecutive integers

2013-05-13 Thread Lizzy Wilbanks
Hi folks, I'm trying to accomplish something that seems like it should be straightforward, but I've gotten tied in knots trying to figure it out. A toy example of my issue is below. I've played with diff and can't seem to figure out a systematic solution that will give me the two column output

[R] How to capture the expression corresponding to the i param in the [ function

2013-05-13 Thread Nhan Vu Lam Chi
Hi everyone, I currently work on a S4 class that has the [ function. I want to capture the unevaluated expression corresponding to the i param using substitute() function and do a non-standard evaluation. However R automatically evaluates the expression and give me its value. For example: Given

Re: [R] Boundaries of consecutive integers

2013-05-13 Thread arun
May be:   matrix(c(test[c(TRUE,diff(test)1)],test[c(which(diff(test)1),length(test))]),ncol=2) # [,1] [,2] #[1,]    1    5 #[2,]   22   29 #[3,]   33   40 A.K. - Original Message - From: Lizzy Wilbanks egwilba...@ucdavis.edu To: r-help@r-project.org Cc: Sent: Monday, May 13, 2013

Re: [R] Boundaries of consecutive integers

2013-05-13 Thread arun
#or  indx- c(0,cumsum(diff(test)!=1)) aggregate(test,list(indx),function(x) c(min(x),max(x)))[,-1] # [,1] [,2] #[1,]    1    5 #[2,]   22   29 #[3,]   33   40 #or dat1- data.frame(test,indx) library(plyr)  ddply(dat1,.(indx),summarize, Min=min(test),Max=max(test))[,-1] #  Min Max #1   1   5

Re: [R] Matrix multiplication with scattered NA values

2013-05-13 Thread arun
Hi, Not sure if this is what you wanted:  mat1- as.matrix(read.table(text=   33    45    50   NA   NA   54 ,sep=,header=FALSE)) mat2- as.matrix(read.table(text= 24    0.000    0.000 0.000    14    0.000 0.000 0.000    10

Re: [R] How to capture the expression corresponding to the i param in the [ function

2013-05-13 Thread David Winsemius
On May 13, 2013, at 6:38 PM, Nhan Vu Lam Chi wrote: Hi everyone, I currently work on a S4 class that has the [ function. I want to capture the unevaluated expression corresponding to the i param using substitute() function and do a non-standard evaluation. However R automatically evaluates