[R] Odp: Question from day2 beginner

2010-07-19 Thread Petr PIKAL
Hi I am not an expert in time series modelling but it seems to me that combination ar model and resid extractor function for result of this model does not work as anticipated. Check docs for resid and ar if there is some explanation for this. resid(ar(logrvar, aic=TRUE)) Error in ar.yw(x, aic

Re: [R] Question from day2 beginner

2010-07-19 Thread Patrick Burns
Try: ar(logrvar, aic=TRUE)$resid The problem you are running into is that 'resid' is a generic function, and the 'ar' function neither returns an object with a class nor returns an object that the default method works with. The 'summary' command you used might have instead used 'str'. The

Re: [R] RMySQL Load Error: package/namespace load failed for 'RMySQL'

2010-07-19 Thread neatgadgets
Is there any resolution to this? Can RMySQL be used on Windows wit ha remote MySQL server? -- View this message in context: http://r.789695.n4.nabble.com/RMySQL-Load-Error-package-namespace-load-failed-for-RMySQL-tp2289650p2293532.html Sent from the R help mailing list archive at Nabble.com.

[R] question about bootstrap and z-score

2010-07-19 Thread ying_chen wang
I can bootstrap from observed distribution using 'sample'. But now, the challenge is to bootstrap from a frequency distribution. I have already smoothed the distribution and the next step is to bootstrap from the frequency distribution. I did numerous searches and found nothing. Last, need to

[R] Can RMySQL run on Windows using a remote MySQL server?

2010-07-19 Thread neatgadgets
Can RMySQL run on Windows using a remote MySQL server? -- View this message in context: http://r.789695.n4.nabble.com/Can-RMySQL-run-on-Windows-using-a-remote-MySQL-server-tp2293533p2293533.html Sent from the R help mailing list archive at Nabble.com.

[R] Error while Executing Oracle procedures through R

2010-07-19 Thread vikrant
Dear ALL, I have installed RODBC package in R and successfully connected to Oracle. Now my question is when I am trying to execute oracle procedures though R, I am not able to do it. Simple oracle queries like select * from dbtable are successfully executed. but the command for execution of

Re: [R] R graphic help

2010-07-19 Thread Birte Reichstein
Hi Tim, You might want to try it with the following: par(usr=c(-2,1,ymin,ymax) Where -2 and 1 are the exponents for your x-values, and ymin and ymax the margins you want for your y-values. Then you plot as usual adding the following parameters:

[R] error when copy and transform within a data frame

2010-07-19 Thread Al R
# trying to do a copy and a transform within a data frame, but getting the arguments imply differing number of rows error, and I'm not sure why a=c(1,2,3) b=c(2,3,4) c=c(Yes,No,Yes) d=c(No,Yes,No) df=data.frame(a,b,c,d) # the following works fine! df = transform(df, new=sapply(df[,c(1,2)], FUN

Re: [R] slplot issue

2010-07-19 Thread Jim Lemon
On 07/18/2010 11:22 PM, Peter Ehlers wrote: ... [Now, I'm having trouble with the pemqzrsTawYY function; can anybody help? :)] Certainly. That is in the WelshRabbit package, which requires the WalesSpeak and dumbBunny packages. Jim __

Re: [R] package plotrix

2010-07-19 Thread Jim Lemon
On 07/19/2010 01:59 AM, mau...@alice.it wrote: I installed package plotrix because reading its vignette it looks like it can help me solve a legend problem. The package instaleed correctly on my Mac OS/X 10.5.8 But I cannot reproduce the examples centered on function lgendg. library(plotrix)

[R] Hurst Exponent Estimation

2010-07-19 Thread Lorenzo Isella
Dear All, I am a novice when it comes to time-series analysis and at the moment I am actually interested in calculating the Hurst exponent of a time series. This question has already been asked quite some time ago http://bit.ly/98dZsi and I trust some progress has been made ever since. I was

[R] divide grid.newpage into two?

2010-07-19 Thread Eleni Rapsomaniki
Hi,   Is there some easy way to split the grid.newpage() into two columns? For example, how could I put the two forest plots below (meta1 and meta2) next to each other? library(meta) data(Olkin95) meta1 - metabin(event.e, n.e, event.c, n.c,data=Olkin95, subset=c(41,47,51,59),sm=RR,

Re: [R] problem with using tm

2010-07-19 Thread Jim Lemon
On 07/19/2010 03:59 PM, cob wrote: ... Error in normalizePath(path) : path[1]=C:\Program Files\R\R-2.11.1\library/slam: The system cannot find the file specified Hi cob, That path looks like it won't be read properly - the backslashes should be doubled. Jim

[R] how to plot a olygon round map

2010-07-19 Thread Irina Foss
Hello, I am plotting a contour map of certain patterns with levelplot and I add a map of the few countries on the top with the llines command ( I have a data of longitudes and latitudes for that). But I need to plot a polygon around all the countries (where the sea is) since the patterns need

Re: [R] Cramer-von Mises test

2010-07-19 Thread Peter Ehlers
Don't thank me, thank the authors of sos (Spencer Graves, Sundar Dorai-Raj, and Romain Francois) and Jonathan Baron for hosting the search site. -Peter Ehlers On 2010-07-18 23:43, Sean Carmody wrote: Thanks Peter...I hadn't some across the sos package before, but I'm sure I'll be putting it

Re: [R] split file equivalent in R

2010-07-19 Thread Iasonas Lamprianou
Dear all (a)in SPSS PASW there is a 'split file' command is repeats the same analysis for all sub-groups. Is there a split file equivalent in R? (b) Is there a package in R that will compute immediately statistics like Hosmer and Lemeshow Test, pseudo-R squares etc without my intervention? I

Re: [R] split file equivalent in R

2010-07-19 Thread Tobias Verbeke
Hi, On 07/19/2010 11:56 AM, Iasonas Lamprianou wrote: (a)in SPSS PASW there is a 'split file' command is repeats the same analysis for all sub-groups. Is there a split file equivalent in R? There is a by command in base R, but for this type of problems Hadley Wickham has written a nice

Re: [R] split file equivalent in R

2010-07-19 Thread Iasonas Lamprianou
Thank you, I'll have a look \ Dr. Iasonas Lamprianou Assistant Professor (Educational Research and Evaluation) Department of Education Sciences European University-Cyprus P.O. Box 22006 1516 Nicosia Cyprus Tel.: +357-22-713178 Fax: +357-22-590539 Honorary Research Fellow Department of

[R] assigning one value into a dspMatrix-class matrix

2010-07-19 Thread Robert Castelo
dear list, I'm interested in using the 'dspMatrix' class of matrices, from the R-project recommended package Matrix, to store large symmetric matrices. I would like to know how to fill such a matrix cell by cell avoiding coercion to a non-dspMatrix which might not be storing the symmetric matrix

[R] heatmap.2() yielding an inappropriate key?

2010-07-19 Thread Karl Brand
Esteemed R-users, heatmap.2() is yielding an inappropriate key based on my colors and break-points. In the reproducible example below, the key is inappropriate (to me) because- 1. 'Orange' is simply not represented in the key, despite its prescence in the heatmap. 2. The proportions of the

[R] Missing value

2010-07-19 Thread A . Fırat ÖZDEMİR
Hi, i have such a code tau-0 for (i in 1:10) { x-rnorm(20,0,1) # t1=onesampb(x,est=tauloc,SEED=F)$conf.interval if(t1[1]0 ||t1[2]0)tau=tau+1 } print (tau) this code gives me Error in if (t1[1] 0 || t1[2] 0) tau = tau + 1 : missing value where TRUE/FALSE needed what can be done with

[R] Help with replacing a substring in a string

2010-07-19 Thread Tolga I Uzuner
Dear R Users, I am trying to replace a substring in a string with something else. For example: if we have abc.degg.hijk I would like to replace all the . with a SPACE to become abc degg hijk I have tried the replace.substring.wild function in the Hmisc package but get this error:

Re: [R] Neural Network

2010-07-19 Thread Rainer Stuetz
2010/7/18 Arnaud Trébaol arnaud.treb...@mail.polimi.it: Hi all, I am working for my master's thesis and I need to do a neural network to forecast stock market price, with also external inputs like technical indicators. I would like to know which function and package of R are more suitable

Re: [R] Help with replacing a substring in a string

2010-07-19 Thread Tolga I Uzuner
Actually, I think I got it, need to use gsub. From: Tolga I Uzuner Sent: 19 July 2010 12:11 To: 'r-help@r-project.org' Subject: Help with replacing a substring in a string Dear R Users, I am trying to replace a substring in a string with something else. For example: if we have abc.degg.hijk I

Re: [R] Missing value

2010-07-19 Thread jim holtman
do 'str(t1)' to see what the value returned is. Most likely one of the comparisons in the 'if' statement is evaluating to NA. Also PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. 2010/7/19 A. Fırat

Re: [R] error when copy and transform within a data frame

2010-07-19 Thread jim holtman
Look at the error messages generated and you will see: Error in data.frame(list(a = c(1, 2, 3), b = c(2, 3, 4), c = c(2L, 1L, : arguments imply differing number of rows: 3, 2 In addition: Warning messages: 1: In if (x == Yes) { : the condition has length 1 and only the first element will be

Re: [R] help about the CAH

2010-07-19 Thread philippe larty
Hello R-help, I built the dendrogram. I would cut the dendrogram. Whatis the function in R that allows to know how many classes? Best Regards [[alternative HTML version deleted]] __ R-help@r-project.org mailing list

Re: [R] Continuing on with a loop when there's a failure

2010-07-19 Thread Josh B
You are right -- I made a typo. When I fix my code to go through the loop three times, it works like a charm. THANK YOU! For the benefit of the listserv, here is the full (WORKING) code: x - read.table(textConnection(y1 y2 y3 x1 x2 indv.1 bagels donuts bagels 4 6 indv.2 donuts donuts donuts 5 1

Re: [R] Help with replacing a substring in a string

2010-07-19 Thread Martyn Byng
Hi, Have you tried gsub? a = abc.degg.hijk gsub(., ,a,fixed=TRUE) [1] abc degg hijk Martyn -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Tolga I Uzuner Sent: 19 July 2010 12:38 To: r-help@r-project.org Subject: Re: [R] Help

Re: [R] Help with replacing a substring in a string

2010-07-19 Thread Nikhil Kaza
gsub(., , abc.degg.hijk, fixed=T) On Jul 19, 2010, at 7:37 AM, Tolga I Uzuner wrote: Actually, I think I got it, need to use gsub. From: Tolga I Uzuner Sent: 19 July 2010 12:11 To: 'r-help@r-project.org' Subject: Help with replacing a substring in a string Dear R Users, I am trying to

[R] replacing elements of distance matrix

2010-07-19 Thread Michael Ralph M. Abrigo
Hi! I am trying to implement non-bipartite matching. I have around 500 sites which can be clustered by 10 regions. I am able to calculate pairwise Mahalanobis distances between sites (thanks to another post in the forum). However, I want to constrain my match to sites within the same region. Thus

[R] hola

2010-07-19 Thread marlene marchena
Hola amor! Finalmente llegué a D.C. Ya estoy en el albergue pero el cuarto solo va a ser liberado a la una o tal vez dos de la tarde. Pero no importa al menos ya estoy aqui, ya tomé desayuno que por cierto es horrible. Voy a poder tomar baño y usar un locker por un dolar. Entonces voy a tomar

[R] Grouping and stacking bar plot for categorical variables

2010-07-19 Thread Simon Kiss
Hi all, I have a series of cateogiral variables that look just like this: welfare=sample(c(less, same, more), 1000, replace=TRUE) education=sample(c(less, same, more), 1000, replace=TRUE) defence=sample(c(less, same, more), 1000, replace=TRUE) egp=sample(c(salariat, routine non-manual,

Re: [R] hola

2010-07-19 Thread marlene marchena
Very sorry about that! 2010/7/19 marlene marchena marchenamarl...@gmail.com Hola amor! Finalmente llegué a D.C. Ya estoy en el albergue pero el cuarto solo va a ser liberado a la una o tal vez dos de la tarde. Pero no importa al menos ya estoy aqui, ya tomé desayuno que por cierto es

[R] pcaMethods and Lattice help.

2010-07-19 Thread Shawn Way
I've been using the pcaMethods to develop a scores matrix === data(iris) pcIr - pca(iris[,1:4], method=nipals, nPcs=3, cv=q2) test - scores(pcIr) What I'm looking to do is to use lattice's barchart to plot the scores

Re: [R] Grouping and stacking bar plot for categorical variables

2010-07-19 Thread David Winsemius
On Jul 19, 2010, at 9:36 AM, Simon Kiss wrote: Hi all, I have a series of cateogiral variables that look just like this: welfare=sample(c(less, same, more), 1000, replace=TRUE) education=sample(c(less, same, more), 1000, replace=TRUE) defence=sample(c(less, same, more), 1000, replace=TRUE)

Re: [R] slplot issue

2010-07-19 Thread Shawn Way
Sorry about not answering sooner and providing code. My company mail server died this weekend and I could respond without creating a new account on r-help. The package I'm using is pcaMethods (1.12)(found in the bioconductor packages). The following runs ==

Re: [R] replacing elements of distance matrix

2010-07-19 Thread Nikhil Kaza
replace dist with mahalanobis distance in the following example. a - cbind(runif(10), sample(1:3, 10, replace=T)) a.L - split(a,a[,2]) dist.L - lapply(a.L, dist) Nikhil Kaza Asst. Professor, City and Regional Planning University of North Carolina nikhil.l...@gmail.com On Jul 19, 2010, at

[R] nls with some coefficients fixed

2010-07-19 Thread Keith Jewell
I'm using nls to fit a variety of different models. Here I use SSgompertz as an example. I want the ability to fix one (or more) of the coefficients that would normally be optimised (e.g. fix b3=0.8). Examples; based on and using data from example(SSgompertz) #- # vanilla

Re: [R] error when copy and transform within a data frame

2010-07-19 Thread Jeff Newmiller
See ?ifelse. Your num_value function needs to be rewritten in vector form using ifelse. Al R aneva...@yahoo.com wrote: # trying to do a copy and a transform within a data frame, but getting the arguments imply differing number of rows error, and I'm not sure why a=c(1,2,3) b=c(2,3,4)

[R] R: package plotrix

2010-07-19 Thread mauede
I got plotrix running after updating R. My problem is now solved. Thank you. Maura -Messaggio originale- Da: Jim Lemon [mailto:j...@bitwrit.com.au] Inviato: lun 19/07/2010 10.58 A: mau...@alice.it Cc: r-h...@stat.math.ethz.ch Oggetto: Re: package plotrix On 07/19/2010 01:59 AM,

[R] RMySQL and RMPI together

2010-07-19 Thread kdbondalapati
Dear R-users, I got problem when using both RMPI and RMySQL together and I thought some body in this forum can help me. I have a huge data set (more than 300,000 rows) and I would like to modify only few observations. I wrote the modifications in a function form and able to send the function

Re: [R] RMySQL and RMPI together

2010-07-19 Thread Jeff Newmiller
Don't send the open connection object... send the connection info (database name, username, password, etc.) and create new connections as part of the slave task. The master connection object is not valid on the slaves. kdbondalap...@jacks.sdstate.edu wrote: Dear R-users, I got problem when

[R] par(uin) ?

2010-07-19 Thread Michael Friendly
I inherited a function written either for an older version of R or SPlus to draw a brace, {, in a graph. It uses par(uin) to determine the scaling of the quarter circles that make up segments of the brace, but that setting doesn't exist in current R. I'm guessing that, in the function below,

Re: [R] par(uin) ?

2010-07-19 Thread Eik Vettorazzi
http://tinyurl.com/34fhcvg Am 19.07.2010 17:20, schrieb Michael Friendly: I inherited a function written either for an older version of R or SPlus to draw a brace, {, in a graph. It uses par(uin) to determine the scaling of the quarter circles that make up segments of the brace, but that

Re: [R] replacing elements of distance matrix

2010-07-19 Thread Michael Ralph M. Abrigo
Thanks for the tip, Nikhil. However, i need only one matrix as input for another to compute for non-bipartite matching which minimizes pairwise distances between observations. As such, I need the georeference (id) of the observations for subsequent processing. Below is an illustration. #generate

[R] Calculation of Covariance Matrix Calculation

2010-07-19 Thread Wendy Han
Hi, Excuse me for asking this silly question. But I really couldn't understand why cov() and ccov() don't work for my calculation of covariance matrix. a - matrix(1:8, 2, 4) a [,1] [,2] [,3] [,4] [1,]1357 [2,]2468 ccov(a) Error in solve.default(cov, ...) :

[R] Confusion of cov() and ccov() Function Error

2010-07-19 Thread Wendy Han
On Mon, Jul 19, 2010 at 9:09 AM, Wendy Han wendyha...@gmail.com wrote: Hi, Excuse me for asking this silly question. But I really couldn't understand why cov() and ccov() don't work for my calculation of covariance matrix. a - matrix(1:8, 2, 4) a [,1] [,2] [,3] [,4] [1,]13

Re: [R] par(uin) ?

2010-07-19 Thread Alain Guillet
My question is probably stupid but why don't you use the text() function? plot(1:10,type=n) text(4,4,{) text(6,6,{,cex=3) # if you want it bigger Alain On 19-Jul-10 17:20, Michael Friendly wrote: I inherited a function written either for an older version of R or SPlus to draw a brace, {,

Re: [R] save plot

2010-07-19 Thread dbandler
Is there an easy way to load plots in png files into R? I'm using the png function to create the plots from a batch job and would like to view them later. -Original Message- From: Gavin Simpson gavin.simp...@ucl.ac.uk Sent: Saturday, July 17, 2010 6:21pm To: linda.s

Re: [R] par(uin) ?

2010-07-19 Thread RICHARD M. HEIBERGER
From the S+8.1 documentation graphics.pdf * uin *information numeric inches per *usr *unit *c(0.73, 0.05) * [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read

Re: [R] levene.test - spelling

2010-07-19 Thread S Ellison
John Fox j...@mcmaster.ca 14/07/2010 15:49:21 the development version of the car package on R-Forge, which can be installed via install.packages(car, repos=http://R-Forge.R-project.org; (and which has an argument named center, not location). Would you consider a plaintive request to

Re: [R] slplot issue

2010-07-19 Thread Peter Ehlers
On 2010-07-19 7:50, Shawn Way wrote: Sorry about not answering sooner and providing code. My company mail server died this weekend and I could respond without creating a new account on r-help. The package I'm using is pcaMethods (1.12)(found in the bioconductor packages). The following runs

Re: [R] pcaMethods and Lattice help.

2010-07-19 Thread Peter Ehlers
On 2010-07-19 7:35, Shawn Way wrote: I've been using the pcaMethods to develop a scores matrix === data(iris) pcIr- pca(iris[,1:4], method=nipals, nPcs=3, cv=q2) test- scores(pcIr) What I'm looking to do is to use

[R] replacing elements of distance matrix

2010-07-19 Thread Michael Ralph M. Abrigo
Thanks for the tip, Nikhil. However, i need only one matrix as input for another to compute for non-bipartite matching which minimizes pairwise distances between observations. As such, I need the georeference (id) of the observations for subsequent processing. Below is an illustration.

Re: [R] producing biplot of canonical correlation analysis

2010-07-19 Thread jan . graffelman
Dear Elaine, The calibrate package contains a routine for canonical correlation analysis called canocor. Section 4.3 of the documentation vignette of the package shows how to make biplots for canonical correlation analysis. Hope this helps, Best regards, Jan Graffelman. Message: 13 Date:

[R] Help on R strucchange package

2010-07-19 Thread João Boavida
Hello, I’m using strucchange package in R software in order to apply Bai and Peron (1998, 2003) structural break tests to a set of n=1671 observations with a constant term (no AR terms). For that purpose I have read several papers, for instance “Validating Multiple Structural Change

[R] Analysing CPI inflation by the fractionally integrated ARFIMA-STVGARCH model

2010-07-19 Thread Sebastian Kruk
Hi, are there any library to estima a fractionally integrated ARFIMA-STVGARCH model? You can read about it in http://www.greqam.fr/IMG/working_papers/2008/2008-36.pdf Thanks, Sebastián. __ R-help@r-project.org mailing list

Re: [R] heatmap.2() yielding an inappropriate key?

2010-07-19 Thread Karl Brand
I see now my error, several in fact: The 'breaks' specified need to be of a similar range to the data range, and they should be equally spaced. So in my example: breaks = seq(0, 0.2, 0.001) If one needs uneqaully spaced coloring, as i do, then this is achieved by specifying the approprate

[R] Calculation optimization advice needed

2010-07-19 Thread Trafim Vanishek
Dear all, I produced a part of code which does what needed but by estimations I would need to wait for that for 300 hours!!! Maybe someone can give a me a glance advice or something. Thanks a lot! I need to define maximum adjusted R-squares from regression model: returns as dependent variable(

[R] Help on R strucchange package

2010-07-19 Thread João Boavida
I’m using strucchange package in R software in order to apply Bai and Peron (1998, 2003) structural break tests. This sequential procedure includes: 1) Sup F test; 2) double maximum tests and 3) supFT (l+1/ l) tests. Could anyone help me to perform such tests in R, please? Kind Regards,

Re: [R] replacing elements of distance matrix

2010-07-19 Thread Nikhil Kaza
Michael, You can modify the following code to suit. Also avoid using dist as a variable name since it is a function in base. However, are you sure you want to do this? Sx is the variance using sites in all the regions! d1 - apply(x,1, function(i){mahalanobis(x,i,Sx)}) is.na(d1) -

[R] Creating symbolic expressions in R

2010-07-19 Thread Erin
Hello, I'm trying to do some differential equation modeling in R using the package 'deSolve.' Briefly, I'm trying to use the law of mass action (the details of which aren't really important) to structure a vector of rate equation which will be passed into an ODE function and solved with

[R] Access to R help database

2010-07-19 Thread Sigbert Klinke
Hi, from the documentation of help.search I think that fields like concept and keywords in the R help database exists. How can I access them from R? If I do help-help.search(blabla) colnames(help$matches) [1] topic title Package LibPath then I get back only back these 4 fields. Thanks

Re: [R] how to collapse categories or re-categorize variables?

2010-07-19 Thread Henric Winell
On 2010-07-17 23:03, Peter Dalgaard wrote: Ista Zahn wrote: Hi, On Fri, Jul 16, 2010 at 5:18 PM, CC turtysm...@gmail.com wrote: I am sure this is a very basic question: I have 600,000 categorical variables in a data.frame - each of which is classified as 0, 1, or 2 What I would like to do is

Re: [R] replacing elements of distance matrix

2010-07-19 Thread Nikhil Kaza
My mistake, instead of colnames(d1) use substr(colnames(d1),1,1) or similar On Jul 19, 2010, at 2:15 PM, Nikhil Kaza wrote: Michael, You can modify the following code to suit. Also avoid using dist as a variable name since it is a function in base. However, are you sure you want to do

[R] Historical Libor Rates

2010-07-19 Thread Aaditya Nanduri
Hello All, Does anyone know how to download historical LIBOR rates of different currencies into R? Or if anyone knows of a website that holds all this data...I only need up to january of 2000. Also, how can we make the row names the index of a plot (the names of the x values)?

[R] invalid type error

2010-07-19 Thread jd6688
myDF = data.frame(id=c(A10,A20),d1=c(.3,.3),d2=c(.4,.4),d3=c(-.2,.5),d4=c(-.3,.6),d5=c(.5,-.2),d6=c(.6,-.4),d7=c(-.9,-.5),d8=c(-.8,-.6)) doit=function(x)c(x[1],sum_LK_positive=sum(x[-1][x[-1]0]),sum_LK_negative=sum(x[-1][x[-1]0])) myDF id d1 d2 d3 d4 d5 d6 d7 d8 1 A10 0.3 0.4

Re: [R] invalid type error

2010-07-19 Thread Erik Iverson
jd6688 wrote: myDF = data.frame(id=c(A10,A20),d1=c(.3,.3),d2=c(.4,.4),d3=c(-.2,.5),d4=c(-.3,.6),d5=c(.5,-.2),d6=c(.6,-.4),d7=c(-.9,-.5),d8=c(-.8,-.6)) doit=function(x)c(x[1],sum_LK_positive=sum(x[-1][x[-1]0]),sum_LK_negative=sum(x[-1][x[-1]0])) myDF id d1 d2 d3 d4 d5 d6

Re: [R] invalid type error

2010-07-19 Thread Joshua Wiley
Jason, Erik already offered a nice solution, but I wanted to comment on why it did not work. apply() works on arrays and, of course, matrices. When you pass a data frame to apply, it will try to coerce it to a matrix. Matrices only contain a single class of data (unlike data frames which can

[R] concatenating column names in a loop

2010-07-19 Thread Josh B
Hi all, I am trying to concatenate words together to create new column names, using a loop. Please consider the following toy example: x - matrix(nrow = 1, ncol = 3) colnames(x) - c(a, b, c) x[1,1] - 1 x[1,2] - 2 x[1,3] - 3 I would like to create a new matrix with column names based on the

Re: [R] concatenating column names in a loop

2010-07-19 Thread Henrique Dallazuanna
Try this: colnames(y) - sprintf('q_%s', colnames(x)) On Mon, Jul 19, 2010 at 4:35 PM, Josh B josh...@yahoo.com wrote: Hi all, I am trying to concatenate words together to create new column names, using a loop. Please consider the following toy example: x - matrix(nrow = 1, ncol = 3)

Re: [R] concatenating column names in a loop

2010-07-19 Thread Joshua Wiley
so I must use a loop. is almost never true in R. This works: colnames(y) - paste(q_, colnames(x), sep = ) HTH, Josh On Mon, Jul 19, 2010 at 12:35 PM, Josh B josh...@yahoo.com wrote: Hi all, I am trying to concatenate words together to create new column names, using a loop. Please

Re: [R] concatenating column names in a loop

2010-07-19 Thread Erik Iverson
Josh B wrote: Hi all, I am trying to concatenate words together to create new column names, using a loop. Please consider the following toy example: x - matrix(nrow = 1, ncol = 3) colnames(x) - c(a, b, c) x[1,1] - 1 x[1,2] - 2 x[1,3] - 3 I would like to create a new matrix with column

Re: [R] Historical Libor Rates

2010-07-19 Thread Jonathan Christensen
You might try asking on the R-SIG-Finance group, if nobody here can answer your question (https://stat.ethz.ch/mailman/listinfo/r-sig-finance). Jonathan On Mon, Jul 19, 2010 at 1:21 PM, Aaditya Nanduri aaditya.nand...@gmail.comwrote: Hello All, Does anyone know how to download historical

Re: [R] Troubles with DBI's dbWriteTable in RMySQL

2010-07-19 Thread Gray Calhoun
Hi Ted, This is difficult to answer without a self-contained example -- one that can be cut and pasted into an R session and run. You might also try coercing each element of aaa to a dataframe before calling rbind. --Gray On Fri, Jul 16, 2010 at 4:34 PM, Ted Byers r.ted.by...@gmail.com wrote:

[R] possible bug in ape::extract.clade()

2010-07-19 Thread Dylan Beaudette
Hi, I was recently splitting some massive phylo class objects with extract.clade() and noticed what appears to be a bug in how tip labels are copied from the full tree to the pruned tree. This possible bug was also mentioned here:

Re: [R] invalid type error

2010-07-19 Thread David Winsemius
On Jul 19, 2010, at 3:43 PM, Erik Iverson wrote: jd6688 wrote: myDF = data.frame(id=c(A10,A20),d1=c(.3,.3),d2=c(.4,.4),d3=c(-. 2,.5),d4=c(-.3,.6),d5=c(.5,-.2),d6=c(.6,-.4),d7=c(-.9,-.5),d8=c(-. 8,-.6)) doit=function(x)c(x[1],sum_LK_positive=sum(x[-1]

Re: [R] integral in R

2010-07-19 Thread JLucke
help(integrate) Nathalie Gimenes ncgmsanc...@gmail.com Sent by: r-help-boun...@r-project.org 07/19/2010 04:59 PM To r-help@r-project.org cc Subject [R] integral in R Hello All, I have to create a variable that is a function of another one (already created), its cumulative

Re: [R] invalid type error

2010-07-19 Thread Henrique Dallazuanna
Another option could be: doit - function(x)c(sum(x[x 0]), sum(x[x 0])) apply(transform(myDF, row.names = id, id = NULL), 1, doit) On Mon, Jul 19, 2010 at 4:36 PM, jd6688 jdsignat...@gmail.com wrote: myDF =

Re: [R] [SOLVED] read.table input array

2010-07-19 Thread Balpo
Thank you a lot, Jim. Issue solved. Balpo On 16/07/10 11:27, jim holtman wrote: Here is a way of creating a separate list of variable length vectors that you can use in your processing: # read into a dataframe x- read.table(textConnection(ABCTLengths + 14.0

Re: [R] Help on R strucchange package

2010-07-19 Thread Achim Zeileis
On Mon, 19 Jul 2010, João Boavida wrote: I???m using strucchange package in R software in order to apply Bai and Peron (1998, 2003) structural break tests. This sequential procedure includes: 1) Sup F test; 2) double maximum tests and 3) supFT (l+1/ l) tests. Thanks for your interest, but you

Re: [R] possible bug in ape::extract.clade()

2010-07-19 Thread Ben Bolker
Dylan Beaudette debeaudette at ucdavis.edu writes: I was recently splitting some massive phylo class objects with extract.clade() and noticed what appears to be a bug in how tip labels are copied from the full tree to the pruned tree. This possible bug was also mentioned here:

[R] integral in R

2010-07-19 Thread Nathalie Gimenes
Hello All, I have to create a variable that is a function of another one (already created), its cumulative distribution function and the integral of this cumulative distribution, with limits: 0 and the value of the variable. To be clear, I have the variable called “cip”. And its cdf called

Re: [R] Can RMySQL run on Windows using a remote MySQL server?

2010-07-19 Thread Steven McKinney
I have done this from my previous computer, a Windows PC running Windows XP (32 bit). So in theory it can be done. I had installed the MySQL Workbench application as well which no doubt set up the MySQL dll's needed. My new computer is running Windows 7 64-bit for which RMySQL is not yet built.

Re: [R] par(uin) ?

2010-07-19 Thread Peter Ehlers
Michael, I have a very old version of some brace functions somewhere. I never did combine them into a single function, so there's one each for left/right/up/down braces. (I used them in teaching regression to show resids and formulae.) If you're interested, I'll dig 'em up and send them.

Re: [R] par(uin) ?

2010-07-19 Thread Paul Murrell
Hi Also see the xinch() and yinch() functions. Paul On 20/07/2010 10:44 a.m., Peter Ehlers wrote: Michael, I have a very old version of some brace functions somewhere. I never did combine them into a single function, so there's one each for left/right/up/down braces. (I used them in teaching

[R] Indexing by logical vectors

2010-07-19 Thread Christian Raschke
Dear R-Listers, My question concerns indexing vectors by logical vectors that are based on the original vector. Consider the following simple example to hopefully make clear what I mean: a - rnorm(10) a[a0] - NA However, I am now working with multiple data frames that I received, where

Re: [R] Indexing by logical vectors

2010-07-19 Thread David Winsemius
On Jul 19, 2010, at 7:16 PM, Christian Raschke wrote: Dear R-Listers, My question concerns indexing vectors by logical vectors that are based on the original vector. Consider the following simple example to hopefully make clear what I mean: a - rnorm(10) a[a0] - NA However, I am now

Re: [R] Calculation of Covariance Matrix Calculation

2010-07-19 Thread Dennis Murphy
Hi: a - matrix(1:8, 2, 4) cov(a)# using cov() from stats package [,1] [,2] [,3] [,4] [1,] 0.5 0.5 0.5 0.5 [2,] 0.5 0.5 0.5 0.5 [3,] 0.5 0.5 0.5 0.5 [4,] 0.5 0.5 0.5 0.5 After using package sos to discover that ccov() is a function in package robust (which was

Re: [R] Indexing by logical vectors

2010-07-19 Thread Bill.Venables
As far as I know the answer to your question is No, but there are things you can do to improve the readability of your code. One thing I find useful is to avoid using $ as much as possible and to favour things like with() and within(). The first thing you might do is think about choosing

[R] metaplot (rmeta)

2010-07-19 Thread Kate Snedeker
Greetings I have been trying to use metaplot to create a forest plot of my meta-analysis results. My data is in the form of ORs, so I've been inputting the ORs as the point estimate (mn) and the SEs of the logORs as the SE (se). However, whilst the point estimates appear to be displayed

Re: [R] divide grid.newpage into two?

2010-07-19 Thread Paul Murrell
Hi On 19/07/2010 9:17 p.m., Eleni Rapsomaniki wrote: Hi, Is there some easy way to split the grid.newpage() into two columns? For example, how could I put the two forest plots below (meta1 and meta2) next to each other? library(meta) data(Olkin95) meta1- metabin(event.e, n.e, event.c,

[R] ACCTGMX to 1223400 in R?

2010-07-19 Thread John1983
Hi, I am a newbie in R and was working on some DNA data represented as strings of A,C,T and G (also wild-character like M and X). I use the Bioconductor package in R. Currently I need to convert a string of the form ACCTGMX to 1223400 i.e. A is replaced by 1, C with 2, T with 3, G with 4 and any

Re: [R] replacing elements of distance matrix

2010-07-19 Thread Michael Ralph M. Abrigo
Thank you very much for your help, Nikhil! The code I'm using now is #generate data set.seed(2) x - as.matrix(runif(5)) id1 - sample(1:2,5,replace=T) id2 - c(1:5) rownames(x) - paste(id1, id2) #create distance matrix if same id1 x.L - split(x,id1) n.L - split(rownames(x), id1) for(i in

[R] problems with plot()

2010-07-19 Thread math_daddy
I have a list of vectors of length 2, each representing a point in 2-space, and each of which I wish to plot on the current plot. In a loop, I assign the x and y coordinates of the current element of the list to variables 'x' and 'y' respectively, then make a call to plot as follows: par(new =

Re: [R] Can RMySQL run on Windows using a remote MySQL server?

2010-07-19 Thread neatgadgets
I'm using Windows XP. -- View this message in context: http://r.789695.n4.nabble.com/Can-RMySQL-run-on-Windows-using-a-remote-MySQL-server-tp2293533p2294705.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org

[R] to extend data.frame or not ... that is the question

2010-07-19 Thread Markus Weisner
I am designing a package to analyze fire department data. I created an S4 class called CAD (short for Computer Aided Dispatch data) as part of this package that essentially extends the data.frame class. When the user initializes a CAD object, a data.frame object is broken down into seperate

[R] Reshaping data

2010-07-19 Thread Thomas Jensen
Dear All, I have some data in the following shape: ID begin_t1end_t1 begin_t2end_t2 Thomas 11/03/0413/05/0604/02/0716/05/08 ... ... ... ...

Re: [R] R and WinBUGS (via R2WinBUGS) error

2010-07-19 Thread YL Grize
Hi I have got the same error than you had, calling BUGS from R with the bugs() function: / Error in FUN(X[[1L]], ...) : //.C(..): 'type' must be real for this format/ but couldn't find the answer on the R help site. Could you please give me a hint? Could you solve it? ( i am simply trying

  1   2   >