Re: [R] N'th of month working day problem

2010-04-11 Thread Research
Dear Gabor, Thanks for your reply. however: > tail(DJd) ^DJI.Close 2010-04-01 10927.07 2010-04-05 10973.55 2010-04-06 10969.99 2010-04-07 10897.52 2010-04-08 10927.07 *2010-04-09 10997.35* > tail(ag) 2009-11-30 10344.84 2009-12-31 10428.05 2010-01-31 10067.33 2010-02-28

Re: [R] simple question about contrasts, lm and factors

2010-04-11 Thread Dieter Menne
David.Epstein wrote: > > I have a data frame with two variables that are factors. One is actually a > TRUE/FALSE factor, and I have coded it as 1/0, a continuous variable, but > I could turn it back into a factor. The second is an ordered factor and > consists of five timepoints. There are sever

[R] make.groups function of laatice is not working?

2010-04-11 Thread newbie_2010
I almost wasted 3 hours to make lattice functions work. :(. Phew! I installed package lattice, lattice extra and other supportive packages to use functions 1.make.groups 2.forplot 3.xyplot. I also tried local installing. They are installing very well but not working? Any one have any idea why R

[R] two problems on R in Ubuntu linux

2010-04-11 Thread Mao Jianfeng
Dear R-helpers I want to express my respect and thankfulness to all of you. I just switch from windows xp to Ubuntu linux platform. I am facing two problems when I run R in Ubuntu. I need your helps and advice, thanks in advance. -

Re: [R] MCMC results into LaTeX

2010-04-11 Thread Dieter Menne
Shige Song wrote: > > > What is the preferred way to get Bayesian analysis results (such as > those from MCMCpacki, MCMCglmm, and DPpackage) into LaTeX table > automatically? > It depends on what you want as output. Let's assume the summary of an MCMCpack function: First direct it to a variab

[R] can not execute two functions - env() and profile()

2010-04-11 Thread Mao Jianfeng
Dear R-helpers I want to express my respect and thankfulness to all of you. When I tried to follow a draft book on lme4 authored by Prof. Doug. Bates (http://lme4.r-forge.r-project.org/book/) to learn how to fit mixed-effects model, I found I can not execute two functions which listed in the book

Re: [R] library sets: A & EMPTY does not work; gset_intersection(A,EMPTY) works

2010-04-11 Thread Peter Ehlers
Thanks, David. On 2010-04-11 15:12, David Meyer wrote: Peter, Ryszard, I just put a new version on CRAN (1.0-6) which fixes the problem occuring with operators and mixed classes, so, e.g., > gset(1,2) & set() {} now works. I also made sure that X == X is always TRUE, and fixed the all.equal-

Re: [R] using double loops and saving the data

2010-04-11 Thread ChinChin
David Winsemius wrote: > > > >>I am guessing that the first time through when i= 5200 that i+1 is >>indexing an entry that does not exist. What does str( Price[[1]] >>[5200+1] ) return? What about str(Ca)? > > >>So what is supposed to happen when you try "Ca[5200+1] <- "... anything? > >

Re: [R] plm package twoways effect problem

2010-04-11 Thread yves croissant
It's difficult to guess what the pb is without the data. Try to estimate a 'simple' model, ie without the dummies (something like : dsnfi3LP=plm(lnLP~lnC+lnL+lnM +lnE,data=newdata,effect="twoways",model="within") Try also pdim(newdata) to check if you don't have 1 observation for some individua

[R] WMTSA "wavCWTPeaks" : Error in if (time.start < times.range[1]) time.start <- times.range[1]

2010-04-11 Thread mauede
I have attached the signal that causes the error message in this email subject. Only columns 1 and 3 have to be considered. It is the work trajectory of a molecule migrating between two equilibrium conformations. The curve has 2 peaks, as shown in its plot. But I keep missing the 2nd one. Here is

Re: [R] using double loops and saving the data

2010-04-11 Thread David Winsemius
On Apr 11, 2010, at 8:23 PM, ChinChin wrote: Hi, I am the first R user, I have met some problem and I am seeking for help. I am estimating the wealth of a shareholder. First, I simulated 1 set of price, each set of price contains 5200 prices which reflect the price goes up and down th

[R] how to calculate a table

2010-04-11 Thread Bernd Dittmann
Hi R-Group, I am stuck with the following problem: I am constructing a portfolio of 2 variables x and y x <- rnorm(100, mean=100, sd=4) y <- rnorm(100, mean=120, sd=10) which I am combining as follows to a portfolio for sampling purposes: portfolio <- c(rep(x, 8), rep(y, 2)) In this case I ha

[R] using double loops and saving the data

2010-04-11 Thread ChinChin
Hi, I am the first R user, I have met some problem and I am seeking for help. I am estimating the wealth of a shareholder. First, I simulated 1 set of price, each set of price contains 5200 prices which reflect the price goes up and down through out the year. Price # consists of all set th

[R] Advice on variable color stacked bar graphs?

2010-04-11 Thread Adam Almo
Hello, I'm trying to create a stacked bar graph with variable coloring in each stacked bar; that is, one bar has say blue on top of red, the next one red on top of purple, etc. I also wanted to preserve the ability to stack graphs. Currently, the values for each bar, that is, the bottom values and

[R] Matrix is not symmetric under lme4

2010-04-11 Thread izod3izod3
Dear all, My code is presented as the following. library(MASS) library(rmutil) library(repeated) library(lme4) library(arm) #install.packages("Zelig", repos = "http://gking.harvard.edu";) library(Zelig) rm(list = ls()) beta0<-2.5 beta1<--0.3 sigs2<-0.5 I<-4 #numberpatients<-c(40,100,160,200,4

[R] CRAN (and crantastic) updates this week

2010-04-11 Thread Crantastic
CRAN (and crantastic) updates this week New packages * AIM (1.01) Rob Tibshirani http://crantastic.org/packages/AIM R functions for adaptively constructing index models for continuous, binary and survival outcomes. Implementation requires loading R-pacakge "survival" * BL

[R] using varFunc in gnls to replicate Wedderburn-style variance?

2010-04-11 Thread Seth
Hi, I'm fitting a gnls on a response that varies from 0 to 1 using a basic logistic equation (1/(1+e^-bx)). I'm using gnls because this is spatial data with correlation in residuals well described by corSpher. Residual variance is compressed for fitted values near 0 and 1, and realtively consta

Re: [R] Unable to load EBImage

2010-04-11 Thread Gregoire Pau
Hello Lamke, EBImage is a Bioconductor package: please post on the Bioconductor mailing list. The issue you are reporting is due to a recent modification of the ImageMagick API, on which EBImage relies to read/write images. We are currently fixing this issue. In the meanwhile, please use a p

Re: [R] Statistical test for stationarity-how

2010-04-11 Thread David Scott
Velappan Periasamy wrote: How to find out if EURGBP is stationary? Post the R codes for the same. You have posted three similar messages which basically say, do my work for me, I'm not prepared to even bother explaining my problem or situation. You are unlikely to get any help without more

Re: [R] library sets: A & EMPTY does not work; gset_intersection(A,EMPTY) works

2010-04-11 Thread David Meyer
Peter, Ryszard, I just put a new version on CRAN (1.0-6) which fixes the problem occuring with operators and mixed classes, so, e.g., > gset(1,2) & set() {} now works. I also made sure that X == X is always TRUE, and fixed the all.equal-bug: > gset(1, 0.5 - 0.3) == gset(1, 0.3 - 0.1) [1] F

Re: [R] .Call function crashes initializing matrix

2010-04-11 Thread William Dunlap
> -Original Message- > From: Erik Wright [mailto:eswri...@wisc.edu] > Sent: Sunday, April 11, 2010 1:59 PM > To: William Dunlap > Cc: r help > Subject: Re: [R] .Call function crashes initializing matrix > > Hi Bill, > > You were right, thanks! > > Now I have: > > int size = 5000; > dou

Re: [R] perhaps regular expression bug with | sign ??

2010-04-11 Thread David.Epstein
William Dunlap wrote: > > >> > sub(x='>|t|',pattern = '\|t',replacement='zz') >> [1] "zz>|t|" >> Warning messages: >> 1: '\|' is an unrecognized escape in a character string >> 2: unrecognized escape removed from "\|t" >> How can \| be an unrecognized escape? This flatly contradicts >> help('

Re: [R] ".Rhistory in Mac OS X"

2010-04-11 Thread Charles C. Berry
On Sun, 11 Apr 2010, Fredrik Lundgren wrote: Dear R'ers, I use R version 2.10.1 (2009-12-14) Copyright (C) 2009 The R Foundation for Statistical Computing ISBN 3-900051-07-0 and Mac OS X 10.5.8 And should therefore post questions like this to R-sig-mac. and use to work in different dierect

Re: [R] Read data in sequences

2010-04-11 Thread Gabor Grothendieck
Here it is in function form: > # DF is data frame > # k is number of levels > # ids is a vector of column numbers of id variables > > read.reps <- function(DF, k = 2, ids = 1) { + n <- prod(dim(DF[-ids])) / k # no of rows of output + m <- ncol(DF[-ids])/k # no of reps per line + data.frame(id =

Re: [R] .Call function crashes initializing matrix

2010-04-11 Thread Erik Wright
Hi Bill, You were right, thanks! Now I have: int size = 5000; double *matrix = (double *) R_alloc(size^2, sizeof(double)); Which works for larger sizes! But now I have discovered a new problem with it. When I go to set the value of the elements it *sometimes* crashes: for (i = 0; i < (size

[R] converting a ts object to an xts object: please ignore this message

2010-04-11 Thread Erin Hodgess
It's very simple indeed: to.quarterly(as.xts(ibm$ts)) Sorry for the imposition. Erin -- Erin Hodgess Associate Professor Department of Computer and Mathematical Sciences University of Houston - Downtown mailto: erinm.hodg...@gmail.com __ R-help@r-p

[R] Peculiar behaviour with MatchIt and a function

2010-04-11 Thread Ajay Shah
Folks, I have a strange situation where: library(MatchIt) f <- function(d) { m <- matchit(treatment ~ lsales + major.industry, data=d, method="nearest", discard="hull.treat") treatmentfirms <- match.data(m, group="treat") list(m=m, treatmentfirms=treatmentfirms)

[R] converting a ts object to an xts object

2010-04-11 Thread Erin Hodgess
Dear R People: This is probably is very simple question. I have a monthly time series, ibm$ts , that I would like to convert to a quarterly series. I know that I could use "aggregate", but I am interested in the to.quarterly conversion, please. Here is my example: > str(ibm$ts) Time-Series [1:1

Re: [R] Help me with writing function sort()

2010-04-11 Thread Barry Rowlingson
On Sun, Apr 11, 2010 at 2:30 PM, maslakos wrote: > > Hello everyone, i`m new here.. I just started with learning R language and i > have hard "homework". I need to write function like sort().. Anyone know how > to do it? Can u give me algorithm for sorting vector? x=c(1,2,-1,1,3,4) or > something

[R] cluster analysis :: urgent

2010-04-11 Thread karine heerah
hi, how can i do cluster analysis on spatial data? (longitude & latitude) Because i used the function clust of the clustTool package and it did'nt work at all: cl <- clust(dv,3,method="hclustAverage",distMethod="euclidean") thanks a lot Karine HEERAH Master 2 , océanographie

[R] MCMC results into LaTeX

2010-04-11 Thread Shige Song
Dear All, What is the preferred way to get Bayesian analysis results (such as those from MCMCpacki, MCMCglmm, and DPpackage) into LaTeX table automatically? I have been using the "apsrtable" package and similar functions in "memisc" package, but neither seems to handle MCMC output directly. Many t

Re: [R] Read data in sequences

2010-04-11 Thread RockO
Gabor's elegant method works as well indeed where gl(number of factor level,number of replications): > data.frame(id = dat[gl(3,4),1], t(matrix(t(dat[-1]), 2))) Rock DRF-MRNF, Quebec -- View this message in context: http://n4.nabble.com/Read-data-in-sequences-tp1819487p1836285.html Sent from t

Re: [R] Read data in sequences

2010-04-11 Thread RockO
Hi, Thank you very much for your help! Here is the coding I used to make it work: x <- textConnection("A 2.5 3.4 2.7 5.6 5.7 5.4 10.1 9.4 B 5.3 5.4 6.5 7.5 1.3 4.5 10.5 4.1 C 2.1 2.3 2.1 5.4 9.0 4.5 20.1 3.7") dat <- read.table(x) nv <- 2 # Number of variables that are repe

[R] ".Rhistory in Mac OS X"

2010-04-11 Thread Fredrik Lundgren
Dear R'ers, I use R version 2.10.1 (2009-12-14) Copyright (C) 2009 The R Foundation for Statistical Computing ISBN 3-900051-07-0 and Mac OS X 10.5.8 and use to work in different dierectories. When doing so it appears as if the .Rhistory file from my home directory always is loaded even when I

Re: [R] Help me with writing function sort()

2010-04-11 Thread Martin Morgan
On 04/11/2010 06:30 AM, maslakos wrote: > > Hello everyone, i`m new here.. I just started with learning R language and i > have hard "homework". I need to write function like sort().. Anyone know how > to do it? Can u give me algorithm for sorting vector? x=c(1,2,-1,1,3,4) or > something like that

Re: [R] Help me with writing function sort()

2010-04-11 Thread GlenB
http://lmgtfy.com/?q=sort+algorithm -- View this message in context: http://n4.nabble.com/Help-me-with-writing-function-sort-tp1836063p1836181.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://s

[R] Help me with writing function sort()

2010-04-11 Thread maslakos
Hello everyone, i`m new here.. I just started with learning R language and i have hard "homework". I need to write function like sort().. Anyone know how to do it? Can u give me algorithm for sorting vector? x=c(1,2,-1,1,3,4) or something like that.. I`m sorry for my english.. -- View this messag

Re: [R] minimization function

2010-04-11 Thread Gabor Grothendieck
It works for me: > x <- 2*c(1,0.5,0.8,0.5,1,0.9, 0.8,0.9,1) > Dmat <- matrix(x, byrow=T, nrow=3, ncol=3) > dvec <- numeric(3) > Amat <- matrix(0,3,4) > Amat[,1 ] <- c(1,1,1) > Amat[,2:4 ]<- t(diag(3)) > bvec <- c(3,0,0,0) > > solve.QP(Dmat,dvec,Amat,bvec=bvec, meq=1) $solution [1] 1.5 1.5 0.0 $va

Re: [R] minimization function

2010-04-11 Thread Patrick Burns
You have merely found a little used entry point into Circle 1 of 'The R Inferno'. The third element of your answer is zero to the precision of the QP algorithm. So it is obeying the non-negative constraints that you put on the problem to the best of its ability. You should not expect numerical e

Re: [R] formatting data???

2010-04-11 Thread David Winsemius
On Apr 10, 2010, at 8:40 PM, Barb Tomlin wrote: I am just learning and only know the bare basics of R. The data looks like this: YearJan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec 1973 2.785 2.723 2.673 2.631 2.68 2.82 3.155 3.316 3.349 3.203 3

Re: [R] minimization function

2010-04-11 Thread li li
Hi, thanks! I added meq=1 and it did not seem to work. The result is the same as before. > x <- 2*c(1,0.5,0.8,0.5,1,0.9, 0.8,0.9,1) > Dmat <- matrix(x, byrow=T, nrow=3, ncol=3) > dvec <- numeric(3) > Amat <- matrix(0,3,4) > Amat[,1 ] <- c(1,1,1) > Amat[,2:4 ]<- t(diag(3)) > bvec <- c(3,0,0,0) >

Re: [R] using BLAT in r

2010-04-11 Thread Uwe Ligges
If this is the mail tools called blat: I use it with shell() calls all the time even for sending out automatical notifications for the CFAN build service. Note that there is also the "sendmailR" package gthat can send out messages without need for some additional 3rd party software... Uwe Li

Re: [R] minimization function

2010-04-11 Thread Gabor Grothendieck
Add meq=1 to the arguments. On Sun, Apr 11, 2010 at 9:50 AM, li li wrote: > Hi, thank you very much for the reply! > > Consider minimize quadratic form w'Aw with A be the following matrix. >> Dmat/2 > [,1] [,2] [,3] > [1,]  1.0  0.5  0.8 > [2,]  0.5  1.0  0.9 > [3,]  0.8  0.9  1.0 > I need t

Re: [R] How to assign variable name (of a vector, matrix, array) from element of another vector or by using paste?

2010-04-11 Thread Jorge Ivan Velez
Hi Samir, Try this: varname <- c("age","sex","edu","mrt") varstates <- c(10,2,4,3) for(i in 1:4) { nam <- paste("nr", varname[i], sep="") assign(nam, varstates[i]) } nrage nrsex nredu nrmrt See ?assign for more information. HTH, Jorge On Sun, Apr 11, 2010 at 5:33 AM, Samir K.C. <> wrote:

Re: [R] minimization function

2010-04-11 Thread li li
Hi, thank you very much for the reply! Consider minimize quadratic form w'Aw with A be the following matrix. > Dmat/2 [,1] [,2] [,3] [1,] 1.0 0.5 0.8 [2,] 0.5 1.0 0.9 [3,] 0.8 0.9 1.0 I need to find w=(w1,w2,w3), a 3 by 1 vector, such that sum(w)=3, and wi>=0 for all i. Below is th

[R] How to assign variable name (of a vector, matrix, array) from element of another vector or by using paste?

2010-04-11 Thread Samir K.C.
Dear All, My problem is the following > varname <- c("age","sex","edu","mrt") > varstates <- c(10,2,4,3) # 10 age groups, 2 sexes, 4 education group and 3 marital status.. Now, I want four variables (vector with length1) named nrage, nrsex, nredu, nrmrt and assing some values > for (i in 1:4) pas

[R] simple question about contrasts, lm and factors

2010-04-11 Thread David.Epstein
I have a data frame with two variables that are factors. One is actually a TRUE/FALSE factor, and I have coded it as 1/0, a continuous variable, but I could turn it back into a factor. The second is an ordered factor and consists of five timepoints. There are several continuous variables as well.

Re: [R] using BLAT in r

2010-04-11 Thread Paul Hiemstra
Fahim wrote: I am trying to use blat in R. I couldn't find any package in CRAN or bioconductor. I downloaded the windows executable from Jim Kent's (from ucsc) webpage. I was wondering how to use/call these executables or functions embedded in these executables. I am seeking for some direction o

Re: [R] Adding country boundaries on field map plots

2010-04-11 Thread Paul Hiemstra
zow...@ncst.go.ke wrote: Hi R users, What is the command for adding (or how do we add) country boundaries on r-spatial plots. Thanks ZABLONE OWITI GRADUATE STUDENT Nanjing University of Information, Science and Technology College of International Education Add: 219 Ning Liu Rd, Nanjing,

Re: [R] str: how to use "no list" recursively?

2010-04-11 Thread Jeff Brown
Wow, those are cool functions!  Thanks! --- On Sat, 4/10/10, Henrique Dallazuanna [via R] wrote: From: Henrique Dallazuanna [via R] Subject: Re: str: how to use "no list" recursively? To: "Jeff Brown" Date: Saturday, April 10, 2010, 12:02 PM Try this: cat(gsub(":List of .*", "", captu

Re: [R] selecting certain columns or rows from a .csv

2010-04-11 Thread doconnor
Thank you On Sat, Apr 10, 2010 at 7:24 PM, Fahim [via R] < ml-node+1835760-173770432-226...@n4.nabble.com > wrote: > dataFile = read.csv("filename.csv",header= TRUE); > #suppose u want col 1, col 9 and col 15 > col1 = 1; > col9 = 9; > col15 = 15; > modifiedDataFile1 = dataFile[,c(col1, col9,

[R] formatting data???

2010-04-11 Thread Barb Tomlin
I am just learning and only know the bare basics of R. The data looks like this: YearJan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec 19732.785 2.723 2.673 2.631 2.682.823.155 3.316 3.349 3.203 3.037 2.9451974 2.8

[R] Adding country boundaries on field map plots

2010-04-11 Thread zow...@ncst.go.ke
Hi R users, What is the command for adding (or how do we add) country boundaries on r-spatial plots. Thanks ZABLONE OWITI GRADUATE STUDENT Nanjing University of Information, Science and Technology College of International Education Add: 219 Ning Liu Rd, Nanjing, Jiangsu, 21004, P.R. China

[R] Calculating the half-life for mean-reversion

2010-04-11 Thread Velappan Periasamy
How to compute the half-life of mean-reversion for GLD-GDX?. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, se