Re: [R] ggplot2 customizing a plot

2013-02-21 Thread Alaios
Hello Ista, I would like to thank you for your reply! Your code is indeed an improvement. This is my code now and there are two things still missing. DataToPlot-matrix(data=runif(9),nrow=3,dimnames=list(seq(1,3),seq(4,6))) require(reshape) require(ggplot2) require(raster) cols-colours()

[R] Commercial or not?

2013-02-21 Thread Pancho Mulongeni
Hi All, Let's say someone uses an R package (prefer to not disclose which) that comes with two different distributions,the commercial and non-commercial license. Now the non commercial license has conditions,bit it never runs out. So if this person knows they should be using the commercial

Re: [R] (no subject)

2013-02-21 Thread Pascal Oettli
Q: how to sum columns in R? A: use a web search engine Le 21/02/2013 16:33, nandita srivastava a écrit : how to sum columns in R? __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

Re: [R] Getting htmlParse to work with Hebrew? (on windows)

2013-02-21 Thread Milan Bouchet-Valat
Le jeudi 21 février 2013 à 13:16 +0400, Lawr Eskin a écrit : Hello dear R-help mailing list. Looks like the same issue in Russian: library(RCurl) library(XML) u = http://www.cian.ru/cat.php?deal_type=2obl_id=1room1=1; a = getURL(u) a # Here - the Russian is fine. a2 -

Re: [R] (no subject)

2013-02-21 Thread PIKAL Petr
Hi ?ncol Regards Petr -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of nandita srivastava Sent: Thursday, February 21, 2013 8:34 AM To: r-help@r-project.org Subject: [R] (no subject) how to sum columns in R?

[R] Arimax with intervention dummy and multiple covariates

2013-02-21 Thread Jose Iparraguirre
Hi I'm trying to measure the effect of a policy intervention (Box and Tiao, 1975). This query has to do with the coding of the model rather than with the particulars of my dataset, so I'm not providing the actual dataset (or a simulated one) in this case, apart from some general description.

Re: [R] Commercial or not?

2013-02-21 Thread Barry Rowlingson
On Thu, Feb 21, 2013 at 9:52 AM, Pancho Mulongeni p.mulong...@namibia.pharmaccess.org wrote: Hi All, Let's say someone uses an R package (prefer to not disclose which) that comes with two different distributions,the commercial and non-commercial license. Now the non commercial license has

Re: [R] Fitting a gaussian distribution to a plot

2013-02-21 Thread Rui Barradas
Hello, You've got a bug, Arun, the parenthesis are not right in ((1/sd1)*sqrt(2*pi)). It should be (1/(sd1*sqrt(2*pi))). The requsted values can also be computed using ?dnorm. d1 - (1/(sd1*sqrt(2*pi)))*exp(-((x1-mean1)^2)/(2*(sd1^2))) d2 - dnorm(x1, mean = mean1, sd = sd1) all.equal(d1,

Re: [R] (no subject)

2013-02-21 Thread Michael Weylandt
?colSums MW On Feb 21, 2013, at 11:26 AM, PIKAL Petr petr.pi...@precheza.cz wrote: Hi ?ncol Regards Petr -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of nandita srivastava Sent: Thursday, February 21, 2013 8:34 AM

[R] using and event in deSolve

2013-02-21 Thread Jannetta Steyn
Hi All Having been pointed the use of events and roots in deSolve, I was able to implement the Izchikevich model of spiking neurons. However, I'm not too sure of defining the event. The deSolve documentation says: An event is triggered when the ball hits the ground (height = 0) Then velocity

Re: [R] (no subject)

2013-02-21 Thread Rui Barradas
Hello, http://lmgtfy.com/?q=sum+columns+in+R The first hit looks promising. Hope this helps, Rui Barradas Em 21-02-2013 07:33, nandita srivastava escreveu: how to sum columns in R? __ R-help@r-project.org mailing list

Re: [R] ggplot2 customizing a plot

2013-02-21 Thread Ista Zahn
Hi, On Thu, Feb 21, 2013 at 4:12 AM, Alaios ala...@yahoo.com wrote: Hello Ista, I would like to thank you for your reply! Your code is indeed an improvement. This is my code now and there are two things still missing.

Re: [R] ggplot2 customizing a plot

2013-02-21 Thread Alaios
Let me try to explain this then. I have numbers like  DataToPlot   4 5 6 1 0.4454995 0.4462009 0.4286807 2 0.3761550 0.5423205 0.6500785 3 0.3779496 0.4671437 0.1799601 and I want to have a color legend with each color that is mapped to the following printed values

[R] Benn Fine

2013-02-21 Thread Benn Fine
http://www.fischeredv.de/zxripc/3bg8jcmc9en1iqo46=lgyc8dv37ec694oxxqf2enjlgwsr70 [[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] Ask for help: find corresponding elements between matrix

2013-02-21 Thread JiangZhengyu
Dear R experts, I have two matrix (seq mat) I want to retrieve in a new matrix all the numbers from mat that =1 (corresponding to the same row/ column position) in seq, or all the numbers in mat that =-1 in seq. - Replace all the numbers with NA if it's not 1/-1 in seq. There are

Re: [R] Getting htmlParse to work with Hebrew? (on windows)

2013-02-21 Thread Milan Bouchet-Valat
Le jeudi 21 février 2013 à 18:31 +0400, Lawr Eskin a écrit : Hi Milan, a - getURL(con, .encoding = UTF-8) Encoding(a) [1] UTF-8 a # Here - the UTF-8 codes looks like fine. htmlParse(a, encoding = UTF-8) ###again same encoding issue And what if you try this: a2 -

Re: [R] Ask for help: find corresponding elements between matrix

2013-02-21 Thread arun
Hi, I guess this is what you wanted: seq1-matrix(c(1,-1,0,1,1,-1,0,0,-1,1,1,NA),3,4) seq1 # [,1] [,2] [,3] [,4] #[1,]    1    1    0    1 #[2,]   -1    1    0    1 #[3,]    0   -1   -1   NA set.seed(15) mat1-matrix(rnorm(12),3)  mat1 #   [,1]   [,2]   [,3]   [,4] #[1,] 

Re: [R] Ask for help: find corresponding elements between matrix

2013-02-21 Thread Jose Iparraguirre
Hi Zhengyu Surely not the most elegant piece of coding, but this should do the trick: m=rep(NA,nrow(seq)*ncol(seq)) mat1=matrix(m,3) for(i in 1:nrow(seq)){ + for(j in 1:ncol(seq)){ + ifelse((seq[i,j]==1 | seq[i,j]==-1), + mat1[i,j]-mat[i,j],mat1[i,j]-NA) + } + } mat1 e.g. With

Re: [R] ggplot2 customizing a plot

2013-02-21 Thread Ista Zahn
Hi, On Thu, Feb 21, 2013 at 9:21 AM, Alaios ala...@yahoo.com wrote: Let me try to explain this then. I have numbers like DataToPlot 4 5 6 1 0.4454995 0.4462009 0.4286807 2 0.3761550 0.5423205 0.6500785 3 0.3779496 0.4671437 0.1799601 and I want to have a color

[R] package ReadImages

2013-02-21 Thread PIKAL Petr
Dear all I prepared some image processing routine which depended on package ReadImages. Basically I imported image to R, changed rgb to grayscale, normalised an image made some selections and changed to image by imagematrix. Recently I learned that this package was removed from CRAN and can

Re: [R] Ask for help: find corresponding elements between matrix

2013-02-21 Thread Berend Hasselman
On 21-02-2013, at 15:39, JiangZhengyu zhyjiang2...@hotmail.com wrote: Dear R experts, I have two matrix (seq mat) I want to retrieve in a new matrix all the numbers from mat that =1 (corresponding to the same row/ column position) in seq, or all the numbers in mat that =-1 in seq. -

[R] Thank you! RE: Ask for help: find corresponding elements between matrix

2013-02-21 Thread JiangZhengyu
Dear Berend, Mark, Jose, Arun, Great! Thank you so much for all your replies with different codings. They all work well except one - because NAs in matrix A need to take care of. Best,Zhengyu Subject: Re: [R] Ask for help: find corresponding elements between matrix From: b...@xs4all.nl

Re: [R] Having trouble converting a dataframe of character vectors to factors

2013-02-21 Thread Lopez, Dan
Hi Bert, Thanks for drawing my attention to simplify argument and for the examples. I understand know. Thanks. Dan -Original Message- From: Bert Gunter [mailto:gunter.ber...@gene.com] Sent: Wednesday, February 20, 2013 4:25 PM To: Lopez, Dan Cc: R help (r-help@r-project.org) Subject:

Re: [R] Arimax with intervention dummy and multiple covariates

2013-02-21 Thread Mark Leeds
Hi: bierens has a paper on modelling beer sales in the netherland ( I'm pretty sure it's on the net. if not, I have a copy somewhere I think ) using an ARIMAX. why don't you take his paper and his data and see if you get the same estimates using R. That's one way if you'll know if you're doing

Re: [R] Having trouble converting a dataframe of character vectors to factors

2013-02-21 Thread William Dunlap
scs2-data.frame(lapply(scs2, factor)) Calling data.frame() on the output of lapply() can result in changing column names and will drop attributes that the input data.frame may have had. I prefer to modify the original data.frame instead of making a new one from scratch to avoid these

Re: [R] Arimax with intervention dummy and multiple covariates

2013-02-21 Thread Mark Leeds
to anyone who was mistakenly looking for the armax beer paper using Bierens as the author. I made a mistake and apologize because the author was franses and the paper is at the link below: http://repub.eur.nl/res/pub/2112/eur_franses_MR1.pdf On Thu, Feb 21, 2013 at 11:23 AM, Paul Bernal

Re: [R] Arimax with intervention dummy and multiple covariates

2013-02-21 Thread Jose Iparraguirre
Thanks Mark. I had looked up herman bierens beer netherlands but nothing came up, except the paper by Philip Hans Franses which I didn't know so I'll have a look at it. Thanks for letting others note about this. I had toyed with the idea of contacting the authors of the TSA package directly

Re: [R] generate variable y to produce excess zero in ZIP analysis

2013-02-21 Thread Jagat.K.Sheth
Also something like ## generate zero-inflated Poisson data n - 100 x1 - rnorm(n) x2 - rnorm(n) ind - rbinom(n,1,1/(1+exp(-1-0.1*x1))) y - ifelse(ind,rpois(n,lambda=exp(1+0.2*x2)),0) There is at least zeroinfl in the CRAN package pscl and fmr in Lindsey's non-CRAN package gnlm for fitting

Re: [R] loop

2013-02-21 Thread arun
Hi, Try this: You can save it as either individual jpeg files or as a single pdf document containing all the figures. set.seed(54) res- matrix(sample(20:60,25,replace=TRUE),ncol=5) res1- res[,-1] b- res[,1] #jpeg  mypath- file.path(/home/arunksa111/Trial, paste(myplot_,names1,.jpg,sep=)) for(i

Re: [R] Getting htmlParse to work with Hebrew? (on windows)

2013-02-21 Thread Lawr Eskin
Hi Milan! Encoding(a)[1] unknown 2013/2/21 Milan Bouchet-Valat nalimi...@club.fr Le jeudi 21 février 2013 à 13:16 +0400, Lawr Eskin a écrit : Hello dear R-help mailing list. Looks like the same issue in Russian: library(RCurl) library(XML) u =

[R] functional median polish

2013-02-21 Thread Francisco.Montes
Anybody knows about a library for functional median polish? Thanks -- Francisco Montes Dpt. d'Estadística i I. O. Universitat de València E-46100-Burjassot SPAIN Tlf: +34 963544306 Fax: +34 963544735 http://www.uv.es/~montes

Re: [R] error with bbox for k12hat (splancs) bivarite k-function

2013-02-21 Thread awooditc
I have tried removing a parenthesis to the right of poly and I get this error: Error in bboxx(bbox(as.points(poly)), nsim = 29, s = seq(5, 80, 5)) : unused argument(s) (nsim = 29, s = seq(5, 80, 5)) It looks like you have one comma for poly, one for as.points, and one for bbox. The original

Re: [R] Getting htmlParse to work with Hebrew? (on windows)

2013-02-21 Thread Lawr Eskin
iconv trued before in various try, same issue and result with encoding = unknown now try sub - same issue 2013/2/21 Milan Bouchet-Valat nalimi...@club.fr Le jeudi 21 février 2013 à 18:31 +0400, Lawr Eskin a écrit : Hi Milan, a - getURL(con, .encoding = UTF-8) Encoding(a) [1] UTF-8

Re: [R] Getting htmlParse to work with Hebrew? (on windows)

2013-02-21 Thread Lawr Eskin
Hi Milan, a - getURL(con, .encoding = UTF-8) Encoding(a) [1] UTF-8 a # Here - the UTF-8 codes looks like fine. htmlParse(a, encoding = UTF-8) ###again same encoding issue why didn't getURL() detect and set a's encoding correctly? I think there are page issue because another sites works fine

[R] total indirect effects in structural equation modeling using lavaan

2013-02-21 Thread Marios
Hi all, I am using package lavaan and have created a structural equation model with two exogenous and seven endogenous variables with the following relationships #specify the model m1 = ' # regressions D ~ ma + hs + b4 + b5 + b15 + b16 ma ~ hs + b4 + b5 + b15 + b16

Re: [R] Error in setwd(outDir) : cannot change working directory

2013-02-21 Thread Joanna Papakonstantinou
I only thought one was missing since it kept giving me error that it wasn't set. But all seems to working OK so I guess I don't need to create anything. Thank you for your help. On Wed, Feb 20, 2013 at 7:28 PM, S Ellison s.elli...@lgcgroup.com wrote: Should I create an output directory

Re: [R] duplicate 'row.names' are not allowed

2013-02-21 Thread Joanna Papakonstantinou
Thank you. I ended up converting the excel file to a csv file and using mytable-read.csv(myfile, header=T) and it worked so I abandoned using the tab delimited txt file. On Wed, Feb 20, 2013 at 9:29 PM, Jim Lemon j...@bitwrit.com.au wrote: On 02/21/2013 07:10 AM, Joanna Papakonstantinou wrote:

[R] remove rows in data frame by average

2013-02-21 Thread Johannes Brand
Dear all, I have a data frame, which looks like this: Subject | Block | Trial | Feature1 | Feature2 1 | 1 | 1 | ... | ... 1 | 1 | 2 | ... | ... 1 | 2 | 1 | ... | ... 1 | 2 | 2 | ... | ... 1 | 3 | 1 | ... | ... ...| ...| ...| ... | ... Can I remove the Trial column by averaging all the rows

Re: [R] Having trouble converting a dataframe of character vectors to factors

2013-02-21 Thread Mark Lamias
Great point, William.  I agree your approach is the one to take to preserve attributes. Thanks for following up. From: William Dunlap wdun...@tibco.com elp (r-help@r-project.org) r-help@r-project.org Sent: Thursday, February 21, 2013 11:32 AM Subject: RE:

Re: [R] Error in setwd(outDir) : cannot change working directory

2013-02-21 Thread Gabor Grothendieck
On Thu, Feb 21, 2013 at 10:46 AM, Joanna Papakonstantinou joanna.p...@gmail.com wrote: I only thought one was missing since it kept giving me error that it wasn't set. But all seems to working OK so I guess I don't need to create anything. No. The first two gave a response of 1 which means

Re: [R] functional median polish

2013-02-21 Thread Rui Barradas
Hello, Try package sos first: library(sos) findFn('functional median') # 'functional median polish' returns nothing Package fda.usc is first. findFn('functional anova') # also gets package fda.usc Hope this helps, Rui Barradas Em 21-02-2013 18:15, francisco.mon...@uv.es escreveu:

Re: [R] ggplot2, geomtile fill assignment

2013-02-21 Thread Benjamin Caldwell
As a follow-up, I am able to achieve what I'd like to do in terms of a set range of values for amplitude using filled.contour() and specifying the zlim argument - however, in the end I'd still like to have the possibilities for layering that ggplot offers available to me; so, please let me know if

Re: [R] functional median polish

2013-02-21 Thread Bert Gunter
... The OP might also wish to look at the Robust task view on CRAN for other approaches to dealing with discrepant data. I leave it to to him to define what this means and to determine whether anything there serves his needs. Cheers, Bert On Thu, Feb 21, 2013 at 12:54 PM, Rui Barradas

Re: [R] ggplot2, geomtile fill assignment

2013-02-21 Thread Ista Zahn
Hi Ben, How about lim - with(input, { c(min(amplitude), max(amplitude))}) p - ggplot(sub1, aes(x=x,y=y,fill=amplitude)) p + geom_tile() + scale_fill_gradientn(Custom Colours, colours=c(purple, blue, green,

Re: [R] remove rows in data frame by average

2013-02-21 Thread arun
Hi, May be this helps: dat1- read.table(text= Subject Block Trial Feature1 Feature2 1  1  1  48  40 1  1  2   62  18 1 2  1    34  43 1  2  2   51 34 1  3  1   64  14 ,sep=,header=TRUE)  res1-do.call(rbind,lapply(split(dat1,dat1$Block),function(x)

Re: [R] remove rows in data frame by average

2013-02-21 Thread Anthony Damico
another option that i think is easy intuitive :) library(sqldf) mydata - sqldf( select Subject , Block , avg( Feature1 ) as Feature1 , avg( Feature2 ) as Feature2 , [..keep going..] , avg( Feature10 ) as Feature10 from yourdata group by Subject , Block ) On Thu, Feb 21, 2013 at 4:45 PM,

Re: [R] ggplot2, geomtile fill assignment

2013-02-21 Thread Benjamin Caldwell
Excellent! Now I see that documentation in discrete_scale(). Thanks. *Ben Caldwell* Graduate Fellow University of California, Berkeley 130 Mulford Hall #3114 Berkeley, CA 94720 Office 223 Mulford Hall (510)859-3358 On Thu, Feb 21, 2013 at 1:26 PM, Ista Zahn istaz...@gmail.com wrote: Hi Ben,

Re: [R] remove rows in data frame by average

2013-02-21 Thread William Dunlap
Many find the functions in the plyr package more convenient to use than the do.call(rbind, lapply(split(...),...) business: library(plyr) ddply(dat1, .(Subject,Block), summarize, MeanFeature1=mean(Feature1), MeanFeature2=mean(Feature2)) Subject Block MeanFeature1 MeanFeature2 1

Re: [R] Having trouble converting a dataframe of character vectors to factors

2013-02-21 Thread Lopez, Dan
Hi Bill, Great info. The problem is what was originally given to me looks like DPUT1 below (random sample of 25). This is the only format they can give me this in and the data already looks molten. So I applied reshape2::dcast which resulted in a dataframe made of character vectors; except

Re: [R] Having trouble converting a dataframe of character vectors to factors

2013-02-21 Thread William Dunlap
#So I tried I tried this which had no effect keepcols- grepl(Q1_,names(scs.c2)) levels(scs.c2[,keepcols])-list(NoResp=,NotImportant=not important,SomewhatImpt=somewhat important,Important=important,VeryImpt=very important) #then this which also failed. It coerced a bunch of

Re: [R] Error in setwd(outDir) : cannot change working directory

2013-02-21 Thread Gabor Grothendieck
On Thu, Feb 21, 2013 at 5:22 PM, Joanna Papakonstantinou joanna.p...@gmail.com wrote: Below is what happened when I ran testInstalledPackages(scope=base,errorsAreFatal=FALSE) Testing examples for package ‘base’ comparing ‘base-Ex.Rout’ to ‘base-Ex.Rout.prev’ ... files differ in number of

Re: [R] 2 setGeneric's, same name, different method signatures

2013-02-21 Thread Greg Minshall
(apologies for not having edited the to/cc list) __ 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,

Re: [R] 2 setGeneric's, same name, different method signatures

2013-02-21 Thread Greg Minshall
the world's most minor typo on https://github.com/hadley/devtools/wiki/Rcpp optimisiation helpful page, btw! thanks! __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

Re: [R] Error in setwd(outDir) : cannot change working directory

2013-02-21 Thread Joanna Papakonstantinou
Below is what happened when I ran testInstalledPackages(scope=base,errorsAreFatal=FALSE) Testing examples for package ‘base’ comparing ‘base-Ex.Rout’ to ‘base-Ex.Rout.prev’ ...files differ in number of lines: Testing examples for package ‘tools’ comparing ‘tools-Ex.Rout’ to ‘tools-Ex.Rout.save’

[R] How to do generalized linear mixed effects models

2013-02-21 Thread Ross Boylan
I want to analyze binary, multinomial, and count outcomes (as well as the occasional continuous one) for clustered data. The more I search the less I know, and so I'm hoping the list can provide me some guidance about which of the many alternatives to choose. The nlme package seemed the

Re: [R] How to do generalized linear mixed effects models

2013-02-21 Thread Mitchell Maltenfort
One more link to look at http://glmm.wikidot.com/faq This is the r-sig-mixed-models FAQ. On Thu, Feb 21, 2013 at 8:53 PM, Ross Boylan r...@biostat.ucsf.edu wrote: I want to analyze binary, multinomial, and count outcomes (as well as the occasional continuous one) for clustered data. The

Re: [R] Merging data in arrays

2013-02-21 Thread Ray Cheung
Dear All, I've 2 arrays A and B: dim(A) = 100, 10, 1000 dim(B) = 100, 20, 900 I know there are 5 columns of values common to both arrays. I want to ask how to merge the 2 arrays. Thanks in advance! Best Regards, Ray [[alternative HTML version deleted]]

Re: [R] Merging data in arrays

2013-02-21 Thread Jeff Newmiller
I think this specification is insufficient to respond accurately to. Please make a reproducible subset of your data (or simulated data) and provide it in dput form, and describe your desired result data set more clearly.

Re: [R] Merging data in arrays

2013-02-21 Thread Ray Cheung
Thanks, Jeff. Here is a simplified hypothetical sample (sorry for the clumsy code): A1 - matrix(1:5, nrow=5, ncol=1) A2 - matrix(6:10, nrow=5, ncol=1) A3 - matrix(11:15, nrow=5, ncol=1) A4 - matrix(16:20, nrow=5, ncol=1) A5 - matrix(21:25, nrow=5, ncol=1) A6 - matrix(26:30, nrow=5, ncol=1) B1 -

Re: [R] Why R simulation gives same random results?

2013-02-21 Thread Greg Snow
Look at the harvestr package for one way to control multiple parallel simulations and make sure that they have different seeds. On Wed, Feb 20, 2013 at 4:24 PM, C W tmrs...@gmail.com wrote: Thanks, Greg. I think you are right. I did simulation one right after the other, less than 2 seconds.

Re: [R] (no subject)

2013-02-21 Thread Rolf Turner
Huh? This answer seems to have absolutely no bearing on the question. cheers, Rolf Turner On 02/21/2013 11:26 PM, PIKAL Petr wrote: Hi ?ncol Regards Petr -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of

Re: [R] package ReadImages

2013-02-21 Thread Greg Snow
Some possibilities: The EBImage package on Bioconductor; the jpeg and png packages read jpeg and png images. On Thu, Feb 21, 2013 at 8:26 AM, PIKAL Petr petr.pi...@precheza.cz wrote: Dear all I prepared some image processing routine which depended on package ReadImages. Basically I

Re: [R] package ReadImages

2013-02-21 Thread Prof Brian Ripley
On 22/02/2013 05:44, Greg Snow wrote: Some possibilities: The EBImage package on Bioconductor; the jpeg and png packages read jpeg and png images. Almost everyone using ReadImages was using it to read TIFF images, which package tiff can do. See the 'Data Import/Export Manual',