[R] Need a faster function to replace missing data

2009-05-21 Thread Tim Clark
Dear List, I need some help in coming up with a function that will take two data sets, determine if a value is missing in one, find a value in the second that was taken at about the same time, and substitute the second value in for where the first should have been. My problem is from a fish t

[R] System crash when using surv=T in cph

2009-05-21 Thread maxb
Can someone help me. I am very new to R. I am fitting a Cox model using Frank Harrell's cph as I want to produce a Nomogram. This is what I have done: Srv<- Surv(time,cens) f.cox<- cph(Srv~ v1+v2+v3+v4, x=T, y=T, surv=T) As soon as I press enter, Windows XP crashes. If I remove surv=T, then it w

Re: [R] Non-linear regression with latent variable

2009-05-21 Thread spencerg
If you have the "RSiteSearch" package installed, you can do the following: library(RSiteSearch) nrow(nll <- RSiteSearch.function("nonlinear regression with latent")) HTML(nll) This just produced 8 hits for me. If this doesn't solve your problem, you might try other search terms.

[R] automatic model selection based on BIC in MLE

2009-05-21 Thread Michael
Hi all, Could anybody point me to an automatic model selection based on BIC for my MLE fitting problem, in R? I would imagine I just have to supply the MLE LLF function, and the dimension of the problem and the number of observations should be embedded in the definition of the LLF itself. And th

Re: [R] good numerical optimization to use in R?

2009-05-21 Thread Ravi Varadhan
What kind of optimization problem are you trying to solve? For smooth, nonlinear optimization, with box-constraints - optim(), nlminb(), spg() For smooth, nonlinear optimization, with linear inequality constraints - constrOptim() For smooth, nonlinear optimization, with equality and/or inequal

Re: [R] stationarity tests

2009-05-21 Thread spencerg
The following searches for help pages in contributed packages including terms "stationarity" or "unit root": library(RSiteSearch) st <- RSiteSearch.function('stationarity') ur <- RSiteSearch.function('unit root') ur. <- st|ur nrow(st) # 68 nrow(ur) # 122 nrow(ur.)# 180 HTML(st&ur) # Show

Re: [R] Behavior of seq with vector from

2009-05-21 Thread Ben Bolker
Rowe, Brian Lee Yung (Portfolio Analytics) wrote: > > Hello, > > I want to use seq with multiple from values and am getting unexpected > (to me) behavior. I'm wondering if this behavior is intentional or not. > >> seq(2, by=3, length.out=4) > [1] 2 5 8 11 > >> seq(3, by=3, length.out=4) >

Re: [R] How to google for R stuff?

2009-05-21 Thread Pedro Mardones
one option could be to type into Google bar something like (for instance for the lme function): filetype R lm On Wed, May 20, 2009 at 9:02 AM, Kynn Jones wrote: > Hi!  I'm new to R programming, though I've been programming in other > languages for years. > > One thing I find most frustrating ab

Re: [R] index to select rows of a large matrix

2009-05-21 Thread tsunhin wong
Dear all, I found the answer: intersect() - John On Thu, May 21, 2009 at 7:32 PM, tsunhin wong wrote: > Dear Jim, > Thanks for your suggestion. > > I have a follow-up question for fellow R Users that have followed this thread: > > *I used to create two lists by some very flexible criteria to co

Re: [R] How to google for R stuff?

2009-05-21 Thread Kenneth Roy Cabrera Torres
--- Begin Message --- I use to install the R Site Search Sidebar in firefox. http://addictedtor.free.fr/rsitesearch/ Unfortunalely you can not install it in new versions of firefox unlees you disable "checkCompatiblity" and "checkUpdateSecurity" on firefox (which is not recommendable). Still I d

Re: [R] NA when indexing vectors

2009-05-21 Thread Kenneth Roy Cabrera Torres
Maybe you mean: x[which(x>=2)] El jue, 21-05-2009 a las 14:34 -0400, Jorge Ivan Velez escribió: > Hi, > Try: > > which( x>=2 ) > > HTH, > > Jorge > > > On Thu, May 21, 2009 at 2:28 PM, Szilard > wrote: > > > Hello: > > > > Is there a more natural way to get all elements that satisfy a con

Re: [R] Barchart in lattice - wrong order of groups, data labels on top of each other, and a legend question

2009-05-21 Thread Gabor Grothendieck
If you are willing to go down one level and work at the grid level then you can do it without modifying the panel function. Below gg.ls$name lists the grid object names. Within that list look at the ones that have rect in their name. Among those are 5 in success (the 2nd through 6th rect objects

[R] Paste Strings as logical for functions?

2009-05-21 Thread tsunhin wong
Dear R Users, I have some dynamic selection rules that I want to pass around for my functions: >rules <- paste(g$TrialList==1 & g$Session==2) >myfunction <- function(rules) { > index <- which(rules) > anotherFunction(index) > } However, I can't find a way to pass around these selection rules

Re: [R] Class for time of day?

2009-05-21 Thread Gabor Grothendieck
On Thu, May 21, 2009 at 5:04 PM, Stavros Macrakis wrote: > On Wed, May 20, 2009 at 12:28 PM, Gabor Grothendieck > wrote: >> >> There is a times class in the chron package. > > Perfect!  Just what I was looking for. > > On Wed, May 20, 2009 at 12:19 PM, jim holtman wrote: >> >> If you want the ho

Re: [R] axis in the barplot

2009-05-21 Thread Peter Alspach
Tena koe Is this the sort of thing you had in mind? tt <- barplot(sample(1:5)) axis(1, tt, letters[1:5]) HTH ... Peter Alspach > -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of Xiaogang Yang > Sent: Friday, 22 May 2009 11:3

Re: [R] help with gsub and date pattern

2009-05-21 Thread Gabor Grothendieck
Here are a few more to add to the list. x <- c("5/31/2009 12:34:00","6/1/2009 1:14:00") # 1 read.table(textConnection(x), as.is = TRUE)[, 2] # 2 format(as.POSIXct(x, format = "%m/%d/%Y %H:%M:%S"), "%H:%M:%S") # 3 library(gsubfn) strapply(x, "[0-9]*:..:..", simplify = c) Also see R News 4/1.

[R] axis in the barplot

2009-05-21 Thread Xiaogang Yang
I use barplot to plot graph, and there is axis of y, but no x, just label, so where to add x-axis in barplot. -- Xiaogang Yang Sensorweb Research Laboratory http://sensorweb.vancouver.wsu.edu/ Washington State University Vancouver [[alternative HTML version deleted]] ___

Re: [R] index to select rows of a large matrix

2009-05-21 Thread tsunhin wong
Dear Jim, Thanks for your suggestion. I have a follow-up question for fellow R Users that have followed this thread: *I used to create two lists by some very flexible criteria to compare from "iData" and pass the two lists to *ANOTHER FUNCTION* that further decompose the two lists and do some cas

Re: [R] postscript problems (landscape orientation)

2009-05-21 Thread Ted Harding
On 21-May-09 23:02:28, David Scott wrote: > Well most people deal with that problem by not using Acrobat to > read .pdf files. On linux you can use evince or xpdf. On windows > just use gsview32. Those readers don't lock the .pdf. > > I am with Peter and generally go straight to pdf these days. Th

[R] hands-on model selection and statistical data analysis books in R?

2009-05-21 Thread Michael
Hi all, I am fitting a model to time series of intra-day financial data. Could anybody point me to some hands-on books about model selection, model specification test, goodness-of-fit test, feature selection and statistical time series data analysis? I am looking not for theoretical or math books

[R] good numerical optimization to use in R?

2009-05-21 Thread Michael
Hi all, Could anybody point me to a good/robust numerical optimization program to use in R? I am doing some MLE fitting. Thanks! __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://w

Re: [R] postscript problems (landscape orientation)

2009-05-21 Thread David Scott
On Thu, 21 May 2009, Zeljko Vrba wrote: On Thu, May 21, 2009 at 02:14:01PM +0200, Peter Dalgaard wrote: I think the trick is jade:~/> env | grep GS_ GS_OPTIONS=-dAutoRotatePages=/None Thanks, I found that myself. However, when using ps2pdf from Miktex 2.7, I get the following error: Unrec

[R] step by step debugger in R?

2009-05-21 Thread Michael
Could anybody point me to the latest status of the most user-friendly debugger in R? How I wish I don't have to stare at my (long) code for ages and stuck... Thanks! __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEA

[R] vcd package --- change layout of plot

2009-05-21 Thread Prew, Paul
Hello, I'm trying to use the vcd package to analyze survey data. Expert judges ranked possible features for product packaging. Seven features were listed, and 19 judges split between 2 cities ranked them. The following code (1) works, but the side-by-side plots for Cities PX, SF are shrunk too

[R] Naming a random effect in lmer

2009-05-21 Thread Leigh Ann Starcevich
Dear guRus: I am using lmer for a mixed model that includes a random intercept for a set of effects that have the same distribution, Normal(0, sig2b). This set of effects is of variable size, so I am using an as.formula statement to create the formula for lmer. For example, if the set of rand

Re: [R] Re order variables in a dataframe

2009-05-21 Thread pgseye
Thanks everyone -- View this message in context: http://www.nabble.com/Reorder-variables-in-a-dataframe-tp23647222p23660941.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailma

Re: [R] help with gsub and date pattern

2009-05-21 Thread Tim Clark
Thanks for the help and the various options! Putting the + outside the brackets worked, but I like the strsplit option. Always nice to learn new functions! Aloha, Tim --- On Thu, 5/21/09, Marc Schwartz wrote: > From: Marc Schwartz > Subject: Re: [R] help with gsub and date pattern > To

Re: [R] help with gsub and date pattern

2009-05-21 Thread Marc Schwartz
On May 21, 2009, at 4:13 PM, Tim Clark wrote: Dear List, I am having a problem using gsub to remove dates from a date/time string. For example: x<-c("5/31/2009 12:34:00","6/1/2009 1:14:00") I would like to remove the date and have just the time. I have tried: gsub("[0-9+]/[0-9+]/[0-9+]"

Re: [R] Barchart in lattice - wrong order of groups, data labels on top of each other, and a legend question

2009-05-21 Thread Dimitri Liakhovitski
Thank you very much, Deepayan! On Thu, May 21, 2009 at 4:49 PM, Deepayan Sarkar wrote: > On Thu, May 21, 2009 at 12:58 PM, Dimitri Liakhovitski > wrote: > >> Deepayan, thank you very much for your response. >> I have a general question. And please remember - I am really just a >> beginner in R.

[R] help with gsub and date pattern

2009-05-21 Thread Tim Clark
Dear List, I am having a problem using gsub to remove dates from a date/time string. For example: x<-c("5/31/2009 12:34:00","6/1/2009 1:14:00") I would like to remove the date and have just the time. I have tried: gsub("[0-9+]/[0-9+]/[0-9+]","",x) and various versions. I think my problem is

Re: [R] Changelog for the survival package

2009-05-21 Thread Heinz Tuechler
Dear Terry, first of all, thank you for your immense work. At the moment, I don't have a small reproducible example for the ratetable difficulty I have. I will work on it. Maybe the error message I get is of some information to you. Error in match.ratetable(m[, rate], ratetable) : Data has

Re: [R] Class for time of day?

2009-05-21 Thread Stavros Macrakis
On Wed, May 20, 2009 at 12:28 PM, Gabor Grothendieck < ggrothendi...@gmail.com> wrote: > There is a times class in the chron package. Perfect! Just what I was looking for. On Wed, May 20, 2009 at 12:19 PM, jim holtman wrote: > If you want the hours from a POSIXct, here is one way of doing it

Re: [R] Barchart in lattice - wrong order of groups, data labels on top of each other, and a legend question

2009-05-21 Thread Deepayan Sarkar
On Thu, May 21, 2009 at 12:58 PM, Dimitri Liakhovitski wrote: > Deepayan, thank you very much for your response. > I have a general question. And please remember - I am really just a > beginner in R. > Is it truly the case that in order to build quite a basic bar chart > with value labels attache

[R] Axis Limits in Scatterplot3d

2009-05-21 Thread Alan
Hi, How do you obtain the limits of the plotting region in a scatterplot3d plot? `par('usr')' does not seem to give sensible values, and that vector only has 4 elements (not the expected 6). Alan __ R-help@r-project.org mailing list https://stat.ethz.

[R] Marginal Effects in ordered logit

2009-05-21 Thread enrico secchi
Hi, I am running an ordered logistic regression model with an interaction, using the polr command. I am trying to find a way to calculate the marginal effects and their significance in R. Does anybody have any suggestion? Thank you! Enrico [[alternative HTML version deleted]] ___

Re: [R] Barchart in lattice - wrong order of groups, data labels on top of each other, and a legend question

2009-05-21 Thread Dimitri Liakhovitski
Deepayan, thank you very much for your response. I have a general question. And please remember - I am really just a beginner in R. Is it truly the case that in order to build quite a basic bar chart with value labels attached to it I have to be a true R graphics guru - because the only way to do a

Re: [R] arrangement of crowded labels

2009-05-21 Thread Greg Snow
The dynIdentify and TkIdentify functions work in 2 dimensions (and I think the thigmophope.labels does as well). The algorithm in spread.labs could be adapted to 2 dimensions (the example shows a semi-2 dimensional approach) if you can define what you want to happen (can labels overplot the poi

[R] Behavior of seq with vector from

2009-05-21 Thread Rowe, Brian Lee Yung (Portfolio Analytics)
Hello, I want to use seq with multiple from values and am getting unexpected (to me) behavior. I'm wondering if this behavior is intentional or not. > seq(2, by=3, length.out=4) [1] 2 5 8 11 > seq(3, by=3, length.out=4) [1] 3 6 9 12 Now if I want the combined sequence, I thought I could p

[R] size of point symbols

2009-05-21 Thread baptiste auguie
Dear list, This might be a topic for r-devel but i may be missing something obvious. I don't understand the rationale in the absolute sizes of the point symbols, and I couldn't find it documented. The example below uses Grid to check the size of the symbols against a square of 10mm x 10mm

Re: [R] NA when indexing vectors

2009-05-21 Thread Jorge Ivan Velez
Hi, Try: which( x>=2 ) HTH, Jorge On Thu, May 21, 2009 at 2:28 PM, Szilard wrote: > Hello: > > Is there a more natural way to get all elements that satisfy a condition > when there are NAs in the sample? > > > x=c(1,2,NA) > > > x>=2 > [1] FALSE TRUENA > > > x[x>=2] > [1] 2 NA ##

[R] NA when indexing vectors

2009-05-21 Thread Szilard
Hello: Is there a more natural way to get all elements that satisfy a condition when there are NAs in the sample? > x=c(1,2,NA) > x>=2 [1] FALSE TRUENA > x[x>=2] [1] 2 NA ## I would expect here to get just "2" > x[!is.na(x) & x>=2] ## seems a bit cumbersome [1] 2 Thanks, Szila

Re: [R] how to get remote ESS graphics to work?

2009-05-21 Thread Matthew Keller
Hi all, I got a few comments offline. Here's the final of how to get graphics remotely using ESS on a mac. It's working fine for us now. 1) change your /etc/sshd_config file. There is a line that reads: #X11 Forwarding no change this to: X11 Forwarding yes (note no # at start of line) 2) make su

Re: [R] arrangement of crowded labels

2009-05-21 Thread Thomas Zumbrunn
> -Original Message- > I'm looking for algorithms that assist in spreading out crowded labels, e.g. > labels of points in a scatter plot, in order to obtain a nicer visual > appearance and better legibility. > > I'm probably just stuck because I didn't find the right key words for a > succ

Re: [R] How can I estimate a Box-Cox function with R?

2009-05-21 Thread Greg Snow
Have you looked at the boxcox function in the MASS package? That may do what you want. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-

Re: [R] Loop avoidance and logical subscripts

2009-05-21 Thread Ted Harding
On 21-May-09 16:56:23, retama wrote: > Patrick Burns kindly provided an article about this issue called > 'The R Inferno'. However, I will expand a little bit my question > because I think it is not clear and, if I coud improve the code > it will be more understandable to other users reading this m

Re: [R] Loop avoidance and logical subscripts

2009-05-21 Thread Martin Morgan
retama wrote: Patrick Burns kindly provided an article about this issue called 'The R Inferno'. However, I will expand a little bit my question because I think it is not clear and, if I coud improve the code it will be more understandable to other users reading this messages when I will paste it

Re: [R] Changelog for the survival package

2009-05-21 Thread Terry Therneau
> Several changes in print.survfit, plot.survfit and seemingly in the > structure > of ratetabels effect some of my syntax files. > Is there somewhere a documentation of these changes, besides the code itself? I agree, the Changelog.09 file is not as comprehensive as one would like. Specific

Re: [R] Loop avoidance and logical subscripts

2009-05-21 Thread retama
Patrick Burns kindly provided an article about this issue called 'The R Inferno'. However, I will expand a little bit my question because I think it is not clear and, if I coud improve the code it will be more understandable to other users reading this messages when I will paste it :) In my examp

Re: [R] Rpart - best split selection for class method and Gin

2009-05-21 Thread Terry Therneau
I would suggest looking at the documentation found in Technical Report #61 in our department series. http://mayoresearch.mayo.edu/mayo/research/biostat/ The formulas for priors, losses, etc in Gini splitting are such that I can't deduce them myself from the source code (and I wrote

Re: [R] subsetting of a data.frame

2009-05-21 Thread culpritNr1
Hi Sarah and Jorge, ncol(). How elegant! Thank you. Jorge Ivan Velez wrote: > > Dear culprit > Try this: > A[ , 4:ncol(A) ] > > HTH, > > Jorge > > > > On Thu, May 21, 2009 at 12:06 PM, culpritNr1 > wrote: > >> >> Hello everybody >> >> How do you subset a data.frame when your bounda

Re: [R] subsetting of a data.frame

2009-05-21 Thread Jorge Ivan Velez
Dear culprit Try this: A[ , 4:ncol(A) ] HTH, Jorge On Thu, May 21, 2009 at 12:06 PM, culpritNr1 wrote: > > Hello everybody > > How do you subset a data.frame when your boundaries are a combination of > explicit and implicit limits? > > For example, I need to subset from the fourth (explicit

[R] RES: help

2009-05-21 Thread Leandro Marino
> a <- matrix(c(1:4),ncol=2) > b <- matrix(c(5:8),ncol=2) > a [,1] [,2] [1,]13 [2,]24 > b [,1] [,2] [1,]57 [2,]68 > a+b [,1] [,2] [1,]6 10 [2,]8 12 Atenciosamente, Leandro Lins Marino Centro de Avaliação Fundação CESGRANRIO Rua Santa

Re: [R] combining xYplot with map

2009-05-21 Thread Greg Snow
For future reference, you may want to look at the symbols function instead of points (for this example points works, but symbols gives more options/flexibility, the my.symbols function in the TeachingDemos package gives even more options for adding symbols to a plot). Hope this helps, -- Greg

Re: [R] subsetting of a data.frame

2009-05-21 Thread Sarah Goslee
You can for example use ncol(A) to get the number of columns. Sarah On Thu, May 21, 2009 at 12:06 PM, culpritNr1 wrote: > > Hello everybody > > How do you subset a data.frame when your boundaries are a combination of > explicit and implicit limits? > > For example, I need to subset from the four

[R] subsetting of a data.frame

2009-05-21 Thread culpritNr1
Hello everybody How do you subset a data.frame when your boundaries are a combination of explicit and implicit limits? For example, I need to subset from the fourth (explicit) to the last (implicit) column a data.frame named A. In other languages you would do A[ , 4:]. Would anybody show me the

Re: [R] Re placing a "+" in a string

2009-05-21 Thread Gabor Grothendieck
Here are a few ways: gsub("[+]", "K", "8.00+00") gsub("\\+", "K", "8.00+00") gsub("+", "K", "8.00+00", fixed = TRUE) Note that with gsubfn you can replace several at once as it is like gsubfn but can take a replacement translation list: library(gsubfn) gsubfn(".", list("+" = " plus", "0" = " zer

Re: [R] Re placing a "+" in a string

2009-05-21 Thread jim holtman
You need to escape the '+' since it is used in regular expressions: > gsub("\\+","K","8.00+00 ") [1] "8.00K00" > On Thu, May 21, 2009 at 11:45 AM, Tom La Bone wrote: > > I know this is easy, but I am stumped: > > > gsub("0","K","8.00+00") > [1] "8.KK+KK" > > > gsub("+","K","8.00+00") > Error i

Re: [R] Re placing a "+" in a string

2009-05-21 Thread Jorge Ivan Velez
Dear Tom, Use "\\" before "+": gsub("\\+","K","8.00+00") [1] "8.00K00" See ?regex. HTH, Jorge On Thu, May 21, 2009 at 11:45 AM, Tom La Bone wrote: > > I know this is easy, but I am stumped: > > > gsub("0","K","8.00+00") > [1] "8.KK+KK" > > > gsub("+","K","8.00+00") > Error in gsub("+", "K",

Re: [R] Product of 1 - probabilities

2009-05-21 Thread Ted Harding
On 21-May-09 14:45:20, Gabor Grothendieck wrote: > There are several arbitrary precision packages available: gmp (an > interface to the GNU multi-precision library on CRAN) and > bc (an R interface to the bc arbitrary precision calculator): > http://r-bc.googlecode.com > > There are also packages

Re: [R] Re placing a "+" in a string

2009-05-21 Thread Romain Francois
Tom La Bone wrote: I know this is easy, but I am stumped: gsub("0","K","8.00+00") [1] "8.KK+KK" gsub("+","K","8.00+00") Error in gsub("+", "K", "8.00+00") : invalid regular expression '+' In addition: Warning message: In gsub("+", "K", "8.00+00") : regcomp error: 'Invali

Re: [R] Product of 1 - probabilities

2009-05-21 Thread William Dunlap
> -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of Mark Bilton > Sent: Thursday, May 21, 2009 7:15 AM > To: r-help@r-project.org > Subject: [R] Product of 1 - probabilities > > > I am having a slight problem with probabilities.

Re: [R] help

2009-05-21 Thread Sarah Goslee
If your matrices are the same size, you can just add them. If they aren't the same size, I'm not sure what you are trying to accomplish. > mat1 <- matrix(1:9, nrow=3) > mat1 [,1] [,2] [,3] [1,]147 [2,]258 [3,]369 > mat2 <- matrix(runif(9), nrow=3) > mat2

[R] Re placing a "+" in a string

2009-05-21 Thread Tom La Bone
I know this is easy, but I am stumped: > gsub("0","K","8.00+00") [1] "8.KK+KK" > gsub("+","K","8.00+00") Error in gsub("+", "K", "8.00+00") : invalid regular expression '+' In addition: Warning message: In gsub("+", "K", "8.00+00") : regcomp error: 'Invalid preceding regular expression' I d

Re: [R] Matrix sum

2009-05-21 Thread daniele riggi
Ok, I know this waybut if i have a lot of matrix, does a function exist to sum all of them elements by elements? 2009/5/21 Jorge Ivan Velez > > Dear Daniele, > Try this: > > A <- matrix(1:10,ncol=2) > B <- matrix(10:20,ncol=2) > A+B > #[,1] [,2] > #[1,] 11 21 > #[2,] 13 23 > #[3,] 15

[R] help

2009-05-21 Thread daniele riggi
Someone knows the existence of a function to sum the elements of the same place A[i,j] B[i,j] of a matrix?thank you -- Dr. Daniele Riggi, PhD student University of Milano-Bicocca Department of Statistics Building U7, Via Bicocca degli Arcimboldi, 8 20126 Milano, Italy cell. +39 328 3380690 mailt

Re: [R] Product of 1 - probabilities

2009-05-21 Thread Duncan Murdoch
On 5/21/2009 10:15 AM, Mark Bilton wrote: I am having a slight problem with probabilities. To calculate the final probability of an event p(F), we can take the product of the chance that each independent event that makes p(F) will NOT occur. So... p(F) = 1- ( (1-p(A)) * (1-p(B)) * (1-p(C))...(1

Re: [R] Matrix sum

2009-05-21 Thread Jorge Ivan Velez
For this, you might want to take a look at the first example in ?Reduce. HTH, Jorge On Thu, May 21, 2009 at 11:21 AM, daniele riggi wrote: > Ok, I know this waybut if i have a lot of matrix, does a function exist to > sum all of them elements by elements? > > > 2009/5/21 Jorge Ivan Velez > > >

Re: [R] Matrix sum

2009-05-21 Thread Uwe Ligges
daniele riggi wrote: Someone knows the existence of a function to sum the elements of the same place A[i,j] B[i,j] of a matrix?thank you Yes: + Uwe Ligges __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEAS

Re: [R] Matrix sum

2009-05-21 Thread Jorge Ivan Velez
Dear Daniele, Try this: A <- matrix(1:10,ncol=2) B <- matrix(10:20,ncol=2) A+B #[,1] [,2] #[1,] 11 21 #[2,] 13 23 #[3,] 15 25 #[4,] 17 27 #[5,] 19 29 HTH, Jorge On Thu, May 21, 2009 at 11:11 AM, daniele riggi wrote: > Someone knows the existence of a function to sum the el

[R] Matrix sum

2009-05-21 Thread daniele riggi
Someone knows the existence of a function to sum the elements of the same place A[i,j] B[i,j] of a matrix?thank you -- Dr. Daniele Riggi, PhD student University of Milano-Bicocca Department of Statistics Building U7, Via Bicocca degli Arcimboldi, 8 20126 Milano, Italy cell. +39 328 3380690 mailt

Re: [R] Product of 1 - probabilities

2009-05-21 Thread Ted Harding
On 21-May-09 14:15:08, Mark Bilton wrote: > I am having a slight problem with probabilities. > > To calculate the final probability of an event p(F), we can take the > product of the chance that each independent event that makes p(F) will > NOT occur. > So... > p(F) = 1- ( (1-p(A)) * (1-p(B)) * (1

Re: [R] Product of 1 - probabilities

2009-05-21 Thread Gabor Grothendieck
There are several arbitrary precision packages available: gmp (an interface to the GNU multi-precision library on CRAN) and bc (an R interface to the bc arbitrary precision calculator): http://r-bc.googlecode.com There are also packages providing R interfaces to two computer algebra systems and th

Re: [R] minmun p-value for wilcox.test and correlation

2009-05-21 Thread Uwe Ligges
Peter Flom wrote: charles78 wrote I have a stupid question on how to get the real p-values for wilcox.test and correlation. the minmun can be reached is 2.2E-16 using the R version 2.6.2. I do not think it is the R version causing this but other issues. Any help is highly appreciated.

Re: [R] Error in importing table from SQL to R

2009-05-21 Thread Seeliger . Curt
Madan asks: > I am trying to import a table from SQL server to R(2.9.0), however i am > getting errors while running the below codes. Can anyone identify and let me > know where did i go wrong??? Thanks in anticipation :) > ... > NEWDATASQL1 <- sqlFetch(myconne, CampaignDataLarge) > > Error in od

Re: [R] [R-sig-Geo] Comparing spatial distributions - permutation test implementation

2009-05-21 Thread JiHO
On 2009-May-21 , at 05:40 , Marcelino de la Cruz wrote: Jose M. Blanco-Moreno an myself have implemented Syrjala's test in the ecespa package. As a matter of fact, Jose M. has implemented a Frotran version of Syrjala's original QBasic function. Using your data the results are very close to

Re: [R] index to select rows of a large matrix

2009-05-21 Thread jim holtman
Assuming that you get the list of indices into iData for the criteria, then you can use that to get the appropriate rows: indx <- which(iData >5) # or whatever your criteria is DataSeq[indx,, drop=FALSE] # gives you a subset matrix of just the rows you are interested in. On Thu, May 21, 2009 at

[R] Product of 1 - probabilities

2009-05-21 Thread Mark Bilton
I am having a slight problem with probabilities. To calculate the final probability of an event p(F), we can take the product of the chance that each independent event that makes p(F) will NOT occur. So... p(F) = 1- ( (1-p(A)) * (1-p(B)) * (1-p(C))...(1-p(x)) ) If the chance of an event within

[R] index to select rows of a large matrix

2009-05-21 Thread tsunhin wong
Dear R Users, I have created a 1500 x 2 data frame - DataSeq. Each of the 1500 rows represents a data sequence. I have another data frame iData that stores the information of these 1500 data sequences in the same order, for example, condition, gender, etc. If I use "subset" to select certain

Re: [R] Need help on ploting Histograms

2009-05-21 Thread Richard . Cotton
> this is the command i made for a normal distribution, but when i try to plot > the histograms, i dont know why the bars don't stick on the line... > > nsamples<-1000 > sampsize<-15 > Samples<-matrix(rnorm(nsamples*sampsize,0,1),nrow=nsamples) > a<-apply(Samples,1,var) > NC14<-a*14 > x<-0:40 >

Re: [R] Example for parsing XML file?

2009-05-21 Thread Duncan Temple Lang
Brigid Mooney wrote: Thanks! That helps a lot! A quick follow-up question - I can't really tell what part of the commands tell it to only look at the child nodes of . xmlRoot(bri) gives us the C node. xmlSApply(node, f) is short-hand for sapply(xmlChildren(node), f) so that is where we

[R] Loop avoidance and logical subscripts

2009-05-21 Thread retama
Hello! I'm writing a script with a lot of loops and it executes really slowly over huge amounts of data. I assume it's because I don't know how to avoid using loops. Logical subscripts are more desirable, but I don't know how to implement them. One example of that issue: library(seqinr) GCsequen

Re: [R] Example for parsing XML file?

2009-05-21 Thread Brigid Mooney
Thanks! That helps a lot! A quick follow-up question - I can't really tell what part of the commands tell it to only look at the child nodes of . Is there any way to also access the fields that are in the heirarchy? (ie the S, D, C, and F) I wouldn't necessarily want those repeated thousands

Re: [R] How to google for R stuff?

2009-05-21 Thread Andy Choens
> You are very picky. When I enter > > R residuals > > into Google, 8 out of the first 10 hits are for R topics. Isn't that > good enough for you? > > I think this is true of most Google searches: the letter R most often > means the R project. Although it does not appear to be a factor wit

Re: [R] How to google for R stuff?

2009-05-21 Thread David Cross
You can also try: http://www.rseek.org/ Cheers Duncan Murdoch wrote: On 20/05/2009 10:01 AM, cr...@binghamton.edu wrote: For Google searches, I find that throwing in the term cran on every search helps weed out irrelevant pages. For example, instead of r residuals I type r cran residua

[R] Negative value for adjustedRandIndex?

2009-05-21 Thread Pooka
Hello, I am a very new user to R so please have patience with me. :clap: I am trying to evalute the "internal response" for a couple of different cluster methods with the help of the AdjustedRandIndex, which is included in the mclust package. However, I do get a bit puzzled when I get a negat

[R] Need help on ploting Histograms

2009-05-21 Thread Bonna
this is the command i made for a normal distribution, but when i try to plot the histograms, i dont know why the bars don't stick on the line... nsamples<-1000 sampsize<-15 Samples<-matrix(rnorm(nsamples*sampsize,0,1),nrow=nsamples) a<-apply(Samples,1,var) NC14<-a*14 x<-0:40 plot(x,dchisq(x,14),

Re: [R] postscript problems (landscape orientation)

2009-05-21 Thread Zeljko Vrba
On Thu, May 21, 2009 at 02:14:01PM +0200, Peter Dalgaard wrote: > > I think the trick is > > jade:~/> env | grep GS_ > GS_OPTIONS=-dAutoRotatePages=/None > Thanks, I found that myself. However, when using ps2pdf from Miktex 2.7, I get the following error: Unrecoverable error: typecheck in .put

Re: [R] postscript problems (landscape orientation)

2009-05-21 Thread Peter Dalgaard
Zeljko Vrba wrote: On Thu, May 21, 2009 at 12:32:28PM +0100, Prof Brian Ripley wrote: Using Acrobat Reader to view PostScript! It is a PDF viewer. Ah, sorry, I explicitly convert the PS with ghostscript's ps2pdf. suspect you need to track down where conversion to PDF is happening and disabl

[R] Offsets in bigglm

2009-05-21 Thread Linda Eaton
Is it possible to have offsets in a glm when using bigglm? _ [[elided Hotmail spam]] [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.c

Re: [R] transformation and outliers

2009-05-21 Thread Peter Dalgaard
Fernando Marmolejo Ramos wrote: Dear R people I ask again… 1. Is there a published reference presenting the normal score transformation? Is there a published paper (in any field) using that transformation in the analysis of data? Dunno, but I'd search for "Normal Scores Test", AKA van de

Re: [R] postscript problems (landscape orientation)

2009-05-21 Thread Zeljko Vrba
On Thu, May 21, 2009 at 12:32:28PM +0100, Prof Brian Ripley wrote: > > Using Acrobat Reader to view PostScript! It is a PDF viewer. > Ah, sorry, I explicitly convert the PS with ghostscript's ps2pdf. > > suspect you need to track down where conversion to PDF is happening > and disable auto-ro

[R] transformation and outliers

2009-05-21 Thread Fernando Marmolejo Ramos
Dear R people I ask again… 1. Is there a published reference presenting the normal score transformation? Is there a published paper (in any field) using that transformation in the analysis of data? And this is a new question… 2. The “outliers” library has a function called “rm.outlier

Re: [R] postscript problems (landscape orientation)

2009-05-21 Thread Prof Brian Ripley
On Thu, 21 May 2009, Zeljko Vrba wrote: I use the following function to export some figures to .eps: p.eps <- function(p, fname, title = NULL, width, height) { postscript(file=fname, onefile=FALSE, paper="special", width=width, height=height, horizontal=FALSE) print(p + opts(title

Re: [R] Inverse

2009-05-21 Thread Zeljko Vrba
On Thu, May 21, 2009 at 08:36:27PM +1000, Kon Knafelman wrote: > > I have coded the following polynomial function > > y= function(x) x^3-2*x^2+1 > > I need to find the inverse of this, but the code i am using now isnt > returning what i want it to. > This function is not injective, so the inve

Re: [R] [newbie] how to do a 3d plot of bivariate density?

2009-05-21 Thread Richard . Cotton
> I am new to R. Yesterday I passed the afternoon reading the > introduction and language reference, but I could'nt find a way to do a > 3d plot of the density of a data table of size 2. > I am trying with: > > plot(density(t(t2))) > > but it mixes the two columns and calculate the density like

[R] problem with ci for lmer

2009-05-21 Thread Xin Shi
Hi, I am trying to calculate ci from lmer. However, I have the error message below: library(gmodels) library(lme4) fm2 <- lmer(Reaction ~ Days + (1|Subject) + (0+Days|Subject), sleepstudy) ci(fm2) Error in as.vector(x, mode) : cannot coerce type 'S4' to vector of type 'any' In addi

[R] "Error: C stack usage is too close to the limit" (can't understand explanations of how to fix this)

2009-05-21 Thread anon36
Apparently the way to deal with this error message is to set R_CStackLimit = (uintptr_t)-1 I tried typing this in the R console, but it says Error: object "R_CStackLimit" not found. So where do I type it? In one of the initialization files that R uses when it starts up? I can't find the answer a

Re: [R] em algorithm mixture of multivariate normals

2009-05-21 Thread Christian Hennig
Look up packages flexmix and mclust! Christian On Thu, 21 May 2009, daniele riggi wrote: Hi, I would like to know if it is possible to have a "R code" to estimate the parameters of a mixture of bivariate (or multivariate) normals via EM Algorithm. I tried to write it, but in the estimation

[R] Inverse

2009-05-21 Thread Kon Knafelman
Hi Guys, i think this is a relatively simple question. I have coded the following polynomial function y= function(x) x^3-2*x^2+1 I need to find the inverse of this, but the code i am using now isnt returning what i want it to. What is the general code for finding an inverse function? Thanks

[R] How can I estimate a Box-Cox function with R?

2009-05-21 Thread Ikerne del Valle
Dear Fernando and all: Thanks for your help. Now works. This is a training example to learn how to estimate a Box-Cox (right and/or left side transformations) with R (as LIMDEP does) in order to compare these estimations with the ones derived by applying NLS, ones the dependent var

  1   2   >