[R] Matching pairs of values

2010-03-26 Thread David Scott
I am sure someone can come up with a clever way of doing what I want---I don't seem to be able to. I want to check if a pair of numbers occurs as one of the rows of an n by 2 matrix. If I was only checking whether a single number was in a vector of numbers I would use %in% but I can't see how

Re: [R] 3 levelplots and 1 colorbar

2010-03-26 Thread Deepayan Sarkar
On Fri, Mar 26, 2010 at 6:35 PM, Joaquin Rapela wrote: > A single multipanel levelplot would be perfect, but from the help to wireframe > I understood that conditioning was not possible when the argument to levelplot > was a matrix. Why would you see the help for wireframe when you are using leve

Re: [R] Competing with SPSS and SAS: improving code that loops throughrows (data manipulation)

2010-03-26 Thread Steven McKinney
Hi Dimitri Your code is complex, so this won't be easy for anyone to deparse. I think part of the issue is in the calculation you are doing in your innermost loop data[data[[group.var]] %in% subgroup, name][case]= 1-((1-data[data[[group.var]] %in% subgroup, name][case-1]*exp(1)^d)/(exp(1)^(data

Re: [R] Poisson Lognormal

2010-03-26 Thread Charles C. Berry
On Fri, 26 Mar 2010, Robert Ruser wrote: 2010/3/26 Charles C. Berry : On Fri, 26 Mar 2010, Robert Ruser wrote: So this is the generalized linear model with a poisson family, log link, and a Gaussian random effect in the linear predictor. Take a look at lme4, MASS (glmmPQL), and try searching C

Re: [R] Multilevel modeling with count variables

2010-03-26 Thread Corey Sparks
Whoops, sorry that's pt(), not dt() Thanks Dennis! - Corey Sparks, PhD Assistant Professor Department of Demography and Organization Studies University of Texas at San Antonio 501 West Durango Blvd Monterey Building 2.270C San Antonio, TX 78207 210-458-3166 corey.sparks 'at' utsa.edu https://

Re: [R] Competing with SPSS and SAS: improving code that loops throughrows (data manipulation)

2010-03-26 Thread Dimitri Liakhovitski
My sincere apologies if it looked large. Let me try again with less code. It's hard to do less than that. In fact - there is nothing in this code but 1 formula and many loops, which is the problem I am not sure how to solve. I also tried to be as clear as possible with the comments. Dimitri ## STA

Re: [R] 3 levelplots and 1 colorbar

2010-03-26 Thread Joaquin Rapela
A single multipanel levelplot would be perfect, but from the help to wireframe I understood that conditioning was not possible when the argument to levelplot was a matrix. If it is possible please let me know. > help(wireframe) > ... > For 'wireframe', 'x', 'y' and 'z' may also be matrices (of > t

Re: [R] Multilevel modeling with count variables

2010-03-26 Thread Corey Sparks
have you tried using glmer? If your dependent variable is poisson distributed, you can try something like fit<-glmer(y~x+(1|group), family=poisson) and if you have differential exposure, you can do fit<-glmer(y~offset(log(exposure))+x+(1|group), family=poisson) Is this what you are asking? With

Re: [R] how to read this special form of data

2010-03-26 Thread jim holtman
> x <- readLines(textConnection("Testing marker: s_1 + - + + Allele df(0) -LnLk(0) df(T) -LnLk(T) ChiSq p + 3 7995 29320.30 7994 29311.85 16.90 4e-05 (2229/8000 probands) + + Testing marker: s_2 +

Re: [R] Multilevel modeling with count variables

2010-03-26 Thread dadrivr
By the way, my concern with lmer and glmer is that they don't produce p-values, and the techniques used to approximate the p-values with those functions (pvals.fnc, HPDinterval, mcmcsamp, etc.) only apply to Gaussian distributions. Given that I would likely be working with quasi-poisson distribut

Re: [R] R loop help

2010-03-26 Thread Jorge Ivan Velez
Hi casperyc, Here is a suggestion: # all at once apply(combn(paste('x', 1:3, sep =""), 2), 2, function(v) get(v[1])*get(v[2]) ) # step by step thex <- paste('x', 1:3, sep ="") thex combs <- combn(thex, 2) combs apply(combs, 2, function(v) get(v[1])*get(v[2]) ) x1, x2 and x3 correspo

[R] R loop help

2010-03-26 Thread casperyc
Hi, I am tring to write a loop to compute this, == x1=c( rep(-1,4), rep(1,4) ) x2=c( rep(c(-1,-1,1,1),2) ) x3=c( rep(c(-1,1),4) ) x1*x2 x1*x3 x2*x3 suppose i have x1,x2,x3

Re: [R] return.replicates in survey pkg

2010-03-26 Thread Thomas Lumley
On Fri, 26 Mar 2010, Richard Valliant wrote: How do I retrieve the replicates estimates from a crosstab done using svyby? Here is an example from the help page for svyby in the package: data(api) dclus1<-svydesign(id=~dnum, weights=~pw, data=apiclus1, fpc=~fpc) rclus1<-as.svrepdesign(dclus1)

Re: [R] expression over-plotted

2010-03-26 Thread Chris Campbell
On Fri, Mar 26, 2010 at 16:05, Brad Eck wrote: > >   When I try to add the following annotation to a plot the entries are plotted >   one on top of the other.  I'm trying to get something that looks like " eta >   =  0.2  "  where the Greek letter is used on the plot.  I realize that >   expressio

Re: [R] Using lapply with two lists

2010-03-26 Thread anna
Yes thank you Jorge :working: - Anna Lippel -- View this message in context: http://n4.nabble.com/Using-lapply-with-two-lists-tp1692883p1692898.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list htt

Re: [R] Using lapply with two lists

2010-03-26 Thread Jorge Ivan Velez
Hi Anna, Here is a suggestion: # creating L1 L1 <- lapply(1:5, function(x) matrix(rnorm(10), ncol = 2)) L1 # creating L2 L2 <- lapply(1:5, function(x) sample(5, 2)) L2 # defining a function foo <- function(x, y) list(x[-y,]) # result mapply(foo, L1, L2) HTH, Jorge On Fri, Mar 26, 2010 at 5:3

Re: [R] Using lapply with two lists

2010-03-26 Thread Riley, Steve
Anna, See ?mapply I think you should be able to use that. Steve Riley, Pharm.D., Ph.D. Clinical Pharmacology, Specialty Neuroscience Pfizer Specialty Care Business Unit Mail Stop MS 6025-B2110 50 Pequot Ave New London, CT 06320 steve.ri...@pfizer.com Tel: (860) 732-1796 Fax: (860) 686-567

[R] Using lapply with two lists

2010-03-26 Thread anna
Hello guys, I have a list L1 of matrix. I have another list L2 with the same number of elements representing the row of the L matrix that I want to delete (L1[[i]][-L2[[i]],]) but I can't do this with lapply as it iterates through L1 (first argument) and not L2. Any idea? - Anna Lippel -- V

Re: [R] Competing with SPSS and SAS: improving code that loops throughrows (data manipulation)

2010-03-26 Thread Bert Gunter
Dmitri: If you follow the R posting guide you're more likely to get useful replies. In particular it asks for **small** reproducible examples -- your example is far more code then I care to spend time on anyway (others may be more willing or more able to do so of course). I suggest you try (if you

[R] Competing with SPSS and SAS: improving code that loops through rows (data manipulation)

2010-03-26 Thread Dimitri Liakhovitski
Dear R-ers, In my question there are no statistics involved - it's all about data manipulation in R. I am trying to write a code that should replace what's currently being done in SAS and SPSS. Or, at least, I am trying to show to my colleagues R is not much worse than SAS/SPSS for the task at han

[R] Hierarchical modeling MCMC with sample size 1

2010-03-26 Thread ping chen
Dear R users: I am using hierchical modeling for a response varible (ordinal) given by patients for each doctor. My MCMC run with MCMMCglmm ( thin=20,nitt=208000,burnin=24000, family='ordinal') still can't have all the parameters pass the GEWEKE diagnosis test. I am trying to find the reason

[R] Heirarchical tree data structure

2010-03-26 Thread Janmaat, John
Hello, I'm modeling a watershed, and have a file linking individual tributaries - the name of each tributary and the water body into which it flows (which can be a tributary of another water body). I want to use this to build a tree data structure (a root, and then child nodes, linked to further

[R] plots: gap between x- and y-axis

2010-03-26 Thread Martin Batholdy
Hi, I was wondering why the gap between the x- and the y-axis gets bigger with a wider plot window. see this example; quartz("1",10,3) par(bty="n") plot(1:9, xaxt="n") axis(1, 1:9) quartz("2",30,3) par(bty="n") plot(1:9, xaxt="n") axis(1, 1:9) quartz("3",80,3) par(bty="n") plot(1:9, xaxt="n"

[R] expression over-plotted

2010-03-26 Thread Brad Eck
When I try to add the following annotation to a plot the entries are plotted one on top of the other. I'm trying to get something that looks like " eta = 0.2 " where the Greek letter is used on the plot. I realize that expression( eta == 0.2) is one solution, but ultimately I'd li

Re: [R] Poisson Lognormal

2010-03-26 Thread Robert Ruser
2010/3/26 Charles C. Berry : > On Fri, 26 Mar 2010, Robert Ruser wrote: > So this is the generalized linear model with a poisson family, log link, and > a Gaussian random effect in the linear predictor. > > Take a look at lme4, MASS (glmmPQL), and try searching CRAN packages for > 'glm' and 'GLM' (

Re: [R] smart way to turn a vector into a matrix

2010-03-26 Thread anna
Ok so as I am using a data.frame I just need to use split() without the sapply now it worked :) thanks! - Anna Lippel -- View this message in context: http://n4.nabble.com/smart-way-to-turn-a-vector-into-a-matrix-tp1692671p1692759.html Sent from the R help mailing list archive at Nabble.com

Re: [R] smart way to turn a vector into a matrix

2010-03-26 Thread anna
so now the problem is that my real matrix is a data.frame.. The first column is character, second dates and third numeric. What I did is I converted the data frame into a matrix with data.matrix() but it converts my characters and dates in integers. Any idea of how I could handle this? - Anna

Re: [R] smart way to turn a vector into a matrix

2010-03-26 Thread anna
it looks you forecasted the next problem, let work on it a little bit more :) - Anna Lippel -- View this message in context: http://n4.nabble.com/smart-way-to-turn-a-vector-into-a-matrix-tp1692671p1692747.html Sent from the R help mailing list archive at Nabble.com. ___

[R] MySQL and RODBC - limitations

2010-03-26 Thread jorgusch
Hello, By accident I fell over a problem, which just did not expected... Via Windows ODBC (package RODBC) I download data from a MySQL 5.1 database. The amount is so large that the working set memory is going up to around 400MB. Not too large, I think. Anyhow, one column includes ten digit numb

[R] CDF calculation from kernel density estimates for a 324X 15 matrix

2010-03-26 Thread Tarana Solaiman
Hi, I have a 324X15 matrix (No of years vs. heavy precipitation days) and I want to calculate the cdf at 5 different data points for each row. I tried by the following codes but it's not working. heavyprec <- read.csv (file="heavyprecdays_CSV.csv",header=TRUE,sep=",") a <- heavyprec pdf <- densit

[R] how to read this special form of data

2010-03-26 Thread lixxx554
Dear R listers, I have a data file looks like the following: Testing marker: s_1 - Allele df(0) -LnLk(0) df(T) -LnLk(T) ChiSq p 3 7995 29320.30 7994 29311.85 16.90 4e-05 (2229/8000 probands) Testing marker:

Re: [R] ColorRamp different from ColorRampPalette

2010-03-26 Thread taw
Try the rgb function in the grDevices library. pal.cr<-colorRamp( c("blue", "white", "red"), space = "rgb") plot(rep(0,40),pch=16,col=rgb(pal.cr((0:40)/40),max=255)) Troy -- View this message in context: http://n4.nabble.com/ColorRamp-different-from-ColorRampPalette-tp889372p1692642.html S

[R] BaselR

2010-03-26 Thread Sarah Lewis
BaselR - The new R meeting We are pleased to announce the new R meeting to be held in Basel, Switzerland. BaselR will be held from 6:30-9:30pm on Tues, Apr 27 at TransBARent: http://transbarent.business.sv-group.ch Doors open at 6:30,pm with the presentations starting at 7:00pm Introduction: W

Re: [R] Add title to color spectrum legend in xyplot

2010-03-26 Thread Nick Ackerman
Thanks Deepayan, That's an easy fix and provides a nice graph. Nick -- View this message in context: http://n4.nabble.com/Add-title-to-color-spectrum-legend-in-xyplot-tp1678456p1692375.html Sent from the R help mailing list archive at Nabble.com. __

[R] fda Data2fd

2010-03-26 Thread Dr. Laca Emilio A.
I would like to create a functional data object where both domain and range are matrices. My erroneous attempts are below. Can you suggest corrections? library(fda) domain<-matrix(c(1,1.1,1.2,2,2.1,2.1,3,3.1,3.2,4,4.1,4.2,5,5.1,5.2), nrow = 5, ncol=3, byrow=TRUE) range<-sin(domain)+matrix(rnor

Re: [R] Sweave running R chunks for figure generation several times

2010-03-26 Thread Florian Burkart
Cheers thanks guys just wanted to make sure there isn't another option I could easily set to false. On 26/03/2010 15:44, Greg Snow wrote: Is the order consistent? Meaning that the pdf/eps producing run always comes second? If so, then set a variable to FALSE and when you get to the plotting

Re: [R] smart way to turn a vector into a matrix

2010-03-26 Thread Erik Iverson
anna wrote: Oh this is a great answer too thanks erik! - Anna Lippel It was really the same answer as Phil. Notice if you use a data.frame instead of a matrix, you don't have to recast to a 'matrix'-like form, and therefore the split call is a little simpler. Depending on what you're

Re: [R] smart way to turn a vector into a matrix

2010-03-26 Thread anna
Oh this is a great answer too thanks erik! - Anna Lippel -- View this message in context: http://n4.nabble.com/smart-way-to-turn-a-vector-into-a-matrix-tp1692671p1692711.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-pr

Re: [R] smart way to turn a vector into a matrix

2010-03-26 Thread anna
YES Phil!!! Thank you so much I was completely stuck! I still have a lot to learn on R :) You're the boss! - Anna Lippel -- View this message in context: http://n4.nabble.com/smart-way-to-turn-a-vector-into-a-matrix-tp1692671p1692702.html Sent from the R help mailing list archive at Nabble.

Re: [R] smart way to turn a vector into a matrix

2010-03-26 Thread Erik Iverson
Hello, anna wrote: Hello guys, I am working on a matrix which looks like this one: initialMatrix <- rbind(cbind(rep("A",3),seq(1,3)),cbind(rep("B",4),seq(1,4)),cbind(rep("C",3),seq(1,3))) initialMatrix [,1] [,2] [1,] "A" "1" [2,] "A" "2" [3,] "A" "3" [4,] "B" "1" [5,] "B" "

Re: [R] smart way to turn a vector into a matrix

2010-03-26 Thread Phil Spector
Anna - Does this do what you want? parts = split(initialMatrix,initialMatrix[,1]) parts = lapply(parts,function(x)matrix(x,ncol=2)) parts $A [,1] [,2] [1,] "A" "1" [2,] "A" "2" [3,] "A" "3" $B [,1] [,2] [1,] "B" "1" [2,] "B" "2" [3,] "B" "3" [4,] "B" "4" $C [,1] [,2]

Re: [R] smart way to turn a vector into a matrix

2010-03-26 Thread anna
I tried to use ave() as well but it didn't work either... - Anna Lippel -- View this message in context: http://n4.nabble.com/smart-way-to-turn-a-vector-into-a-matrix-tp1692671p1692685.html Sent from the R help mailing list archive at Nabble.com. ___

[R] Linear mixed models with custom link functions in R

2010-03-26 Thread Daniel Barton
Hello All, I am looking for an R library/function that allows the specification of a custom link function in a linear mixed model. I've been using glm() in library MASS to fit fixed-effect models with a custom link but my study design demands mixed models. Any suggestions on the best R li

[R] smart way to turn a vector into a matrix

2010-03-26 Thread anna
Hello guys, I am working on a matrix which looks like this one: > initialMatrix <- > rbind(cbind(rep("A",3),seq(1,3)),cbind(rep("B",4),seq(1,4)),cbind(rep("C",3),seq(1,3))) > initialMatrix [,1] [,2] [1,] "A" "1" [2,] "A" "2" [3,] "A" "3" [4,] "B" "1" [5,] "B" "2" [6,] "B" "3

Re: [R] R, S, S-Plus, whence comes thy name?

2010-03-26 Thread Ben Bolker
John Sorkin grecc.umaryland.edu> writes: > How did S, S-Plus, and R get their names? From http://stat.bell-labs.com/S/ http://cm.bell-labs.com/stat/doc/94.11.ps by Rick Becker By July, 1976, we decided to name the system. Acronyms were in abundance at Bell Laboratories, so it seemed su

Re: [R] string problems in R

2010-03-26 Thread muting
Thank you I am waiting for the R to finish running the loop..I hope it will work.. muting Quoting "jholtman [via R]" : > > > > try this: > > x <- lapply(v.fundno, function(.fund){ >sqlQuery(channel, paste("select mret from monthly_return where > crsp_fundno =", >.fund, 'and caldt >

Re: [R] string problems in R

2010-03-26 Thread muting
Hi Charlie: I tried gmret<-sqlQuery(channel, paste( "select mret from Monthly_returns where crsp_fundno =", v.fundno[1] ) ) It works well.. I think you got my problem solved,R just need time to run the loop, not dead.. Thank you very much Muting -- View this message in context: http:/

Re: [R] regular expression

2010-03-26 Thread jim holtman
try this: > x <- c("XXX184_YYY_ZZZ.dat", "YY123_YY_ZZ.dat") > sub("(^[[:alpha:]]+)[[:digit:]]+.*", "\\1 ", x, perl=TRUE) [1] "XXX" "YY" > On Fri, Mar 26, 2010 at 2:27 PM, arnaud chozo wrote: > Hi, > > I need to select a substring from the filename of a file in a list. > I can find all the filen

Re: [R] Off Topic: teenie weenie numbers -- Was: Precision level

2010-03-26 Thread Steve Lianoglou
On Fri, Mar 26, 2010 at 1:11 PM, Barry Rowlingson wrote: > On Fri, Mar 26, 2010 at 4:31 PM, Bert Gunter wrote: >> *** COMPLETELY OFF TOPIC *** >> >> Although machine precision (smallest numerical values that can be exactly >> represented) is important for numerical calculations, what is the small

Re: [R] ggplot2: How to remove legend component for geom_errorbar() ?

2010-03-26 Thread James Rome
In general, one should be able to turn off the legend entirely. I did a plot with geom_jitter() and then overlaid it with geom_boxplot() and I got a legend with a sort of box drawn in a legend that was meaningless since there was no factor involved. Jim -- View this message in context: http://n

[R] regular expression

2010-03-26 Thread arnaud chozo
Hi, I need to select a substring from the filename of a file in a list. I can find all the filenames in a directory by list.files(fn_dir) Each filename has the format (the following is an example because field lengths are variable) XXX184_YYY_ZZZ.dat XXX: 2 or 3 alphabetic characters 184: 3 nu

Re: [R] More efficient alternative to combn()?

2010-03-26 Thread elgorgonzola
Hi Chuck, thanks for the reply. I am not actually interested in all the individual products but the sum of the products. So you wouldn't have to store all the values just the sum. El -- View this message in context: http://n4.nabble.com/More-efficient-alternative-to-combn-tp1692117p1692629.htm

[R] Multilevel modeling with count variables

2010-03-26 Thread dadrivr
I am using a multilevel modeling approach to model change in a person's symptom score over time (i.e., longitudinal individual growth models). I have been using the lme function in the multilevel package for the analyses, but my problem is that my outcome (symptoms) and one of my predictors (even

Re: [R] string problems in R

2010-03-26 Thread jim holtman
try this: x <- lapply(v.fundno, function(.fund){ sqlQuery(channel, paste("select mret from monthly_return where crsp_fundno =", .fund, 'and caldt > 19700630 order by caldt') }) result <- do.call(rbind, x) On Fri, Mar 26, 2010 at 2:07 PM, muting wrote: > > Hi Charlie > > Thank you fo

Re: [R] string problems in R

2010-03-26 Thread muting
Hi Charlie Thank you for your advice, but it makes my R dead... My head(v.fundno) is > head(v.fundno) [1] "2899" "2903" "2960" "3094" "3095" "3211" I tried to plug in the specific value like 2890 and 2960 : gmret.2899<-sqlQuery(channel,"select caldt, mret from Monthly_returns where crsp_fundno

[R] [R-pkgs] New package: equate

2010-03-26 Thread Tony Albano
The 'equate' package, designed for statistical equating (non-IRT) of test score distributions, is available on CRAN: http://cran.r-project.org/package=equate The package was developed for both research and teaching purposes, and will hopefully be useful for both. A vignette introduces the basic

Re: [R] Poisson Lognormal

2010-03-26 Thread Charles C. Berry
On Fri, 26 Mar 2010, Robert Ruser wrote: Hi R Users, I'm going to estimate via. ML the parameters in Poisson Lognormal model. The model is: x | lambda ~ Poisson(lambda) lambda ~ Lognormal(a,b) Unfortunately, I haven't found a useful package allowing for such estimation. So this is the genera

Re: [R] More efficient alternative to combn()?

2010-03-26 Thread Charles C. Berry
On Fri, 26 Mar 2010, elgorgonzola wrote: Hi, i am working on a problem where i need to compute the products of all possible combinations of size m of the elements of a vector. I know that this can be achieved using the function combn(), e.g.: vector <- 1:6 combn(x = vector, m = 3, FUN = func

Re: [R] tapply syntax

2010-03-26 Thread David Freedman
how about: d1=data.frame(pat=c(rep('a',3),'b','c',rep('d',2),rep('e',2),'f'),var=c(1,2,3,1,2,2,3,2,4,4)) ds=set(d1,var %in% c(2,3)) with(ds,tapply(var,pat,FUN=length)) hth, David Freedman, CDC, Atlanta -- View this message in context: http://n4.nabble.com/tapply-syntax-tp1692503p1692553.html S

Re: [R] Off Topic: teenie weenie numbers -- Was: Precision level

2010-03-26 Thread Barry Rowlingson
On Fri, Mar 26, 2010 at 4:31 PM, Bert Gunter wrote: > *** COMPLETELY OFF TOPIC *** > > Although machine precision (smallest numerical values that can be exactly > represented) is important for numerical calculations, what is the smallest > number that anyone has actually seen describing physical p

Re: [R] tapply syntax

2010-03-26 Thread Min-Han Tan
Hi, I figured a workaround to my problem, but if anyone has any advice on how to express a function in tapply to achieve the same outcome, that would be awesome and I'd learn something about functions! The workaround was tapply ((data$Variation.Type %in% c(2,3)), data$Patient, sum) Thanks. Min-

Re: [R] NA values in indexing

2010-03-26 Thread Barry Rowlingson
On Fri, Mar 26, 2010 at 4:15 PM, Matthew Dowle wrote: > The type of 'NA' is logical. So x[NA] behaves more like x[TRUE] i.e. silent > recycling. > >> class(NA) > [1] "logical" >> x=101:108 >> x[NA] > [1] NA NA NA NA NA NA NA NA >> x[c(TRUE,NA)] > [1] 101  NA 103  NA 105  NA 107  NA > >> x[as.integ

Re: [R] 1 - Survival Plot

2010-03-26 Thread Euphoria
Thanks for the responses guys! It worked like a charm! =) -- View this message in context: http://n4.nabble.com/1-Survival-Plot-tp1691512p1692516.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https:

Re: [R] NA values in indexing

2010-03-26 Thread Barry Rowlingson
On Fri, Mar 26, 2010 at 4:15 PM, Bert Gunter wrote: > Is this, from the man page, relevant? > > "An empty index selects all values: this is most often used to replace all > the entries but keep the attributes. " No, I think that means doing "x[]", and only in replacement: > x=101:105 > attr(x,"

Re: [R] whisker definition

2010-03-26 Thread S Ellison
>>> James Rome 26/03/2010 02:38 >>> >What is the definition of the whiskers in the ggplot2 qplot with geom="boxplot"? See http://had.co.nz/ggplot2/stat_boxplot.html >Why is it so hard to find? Pass. It only took me a couple of hops from the geom_boxplot html help page,, but I can see that I g

[R] tapply syntax

2010-03-26 Thread Min-Han Tan
Dear R-help members, Apologies for the trouble. I have a question : Essentially, I have a dataset which stores genetic variations for individual patients. Each individual patient can have more than one variation, and each new record corresponds to a new variation (thus, both individual patients

[R] question regarding conversion from factor to vector

2010-03-26 Thread Oliver Kullmann
Hello, let me show you the following part of a session: > table(E$singles) 0 1 2 3 4 5 6 7 8 14 15 461752 5487 93224379658 1099 4053 2 1868 1 21 28 29 35 42 49 50 56 63 7

Re: [R] NA values in indexing

2010-03-26 Thread Bert Gunter
Is this, from the man page, relevant? "An empty index selects all values: this is most often used to replace all the entries but keep the attributes. " Bert Gunter Genentech Nonclinical Statistics -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org

[R] Reading a SpreadsheetML / XMLNS into R xmlns="urn:schemas-microsoft-com:office:spreadsheet

2010-03-26 Thread stefan.d...@gmail.com
Hello, I use a software that outputs the data in a form/dialect(?) of xml (I think its called "SpreadsheetML", see below for an excerpt). It allows (admittedly) easy import of such files into Excel. I would like, however, to import it directly into R. I am familiar how to do that with standard xml-

[R] Off Topic: teenie weenie numbers -- Was: Precision level

2010-03-26 Thread Bert Gunter
*** COMPLETELY OFF TOPIC *** Although machine precision (smallest numerical values that can be exactly represented) is important for numerical calculations, what is the smallest number that anyone has actually seen describing physical phenomena in science? I've seen values of ca. 1e-20 or so rout

[R] how to make stacked plot?

2010-03-26 Thread sdzhangping
Dear friends: I'm interested to make a stacked plot of cumulative incidence. that's, the cuminc model is fitted [fit=cuminc(time, relapse)] and cumulative incidence is in place. I'd like to stack the cuminc plots (relapse of luekemia and death free from leukemia, for example) , then th

Re: [R] NA values in indexing

2010-03-26 Thread Gabor Grothendieck
Try > x <- 101:107 > x[c(NA_integer_, NA_integer_)] [1] NA NA On Fri, Mar 26, 2010 at 8:09 AM, Barry Rowlingson wrote: > If you index a vector with a vector that has NA in it, you get NA back: > >  > x=101:107 >  > x[c(NA,4,NA)] >  [1]  NA 104  NA >  > x[c(4,NA)] >  [1] 104  NA > > All well and

Re: [R] NA values in indexing

2010-03-26 Thread Matthew Dowle
The type of 'NA' is logical. So x[NA] behaves more like x[TRUE] i.e. silent recycling. > class(NA) [1] "logical" > x=101:108 > x[NA] [1] NA NA NA NA NA NA NA NA > x[c(TRUE,NA)] [1] 101 NA 103 NA 105 NA 107 NA > x[as.integer(NA)] [1] NA HTH Matthew "Barry Rowlingson" wrote in message news

Re: [R] Problems if optimization

2010-03-26 Thread Berend Hasselman
Francisco Silva wrote: > > > I am a begginer in R and i am trying to find the parameters of one > likelihood function, but when i otimize it, always appers a error or > advertisement and the solve does not occur. > The problem seems like that: > > "lMix<-function(pars,y){ > > Shouldn't

Re: [R] Precision level

2010-03-26 Thread Dimitri Liakhovitski
Thanks a lot - it's been helpful. Look like it has to be pretty darn close to zero to be considered = 0. D. On Fri, Mar 26, 2010 at 3:22 AM, Prof Brian Ripley wrote: > On Fri, 26 Mar 2010, Rolf Turner wrote: > >> >> On 26/03/2010, at 12:38 PM, jim holtman wrote: >> >>> WHen using '==' or '%in%' i

Re: [R] Selecting Best Model in an anova.

2010-03-26 Thread Greg Snow
This really depends on what question you are trying to answer, and for some questions the "Best" model is not one of the 2 you show. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 > -Original Message- > From: r-help-bou

Re: [R] Create blocks or observations

2010-03-26 Thread Greg Snow
[snip] > > group <- unlist( lapply( 1:numGroups, rep.int, times = 3 ) ) This can be done simpler with: group <- rep(1:numgroups, each=3) -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111

Re: [R] Sweave running R chunks for figure generation several times

2010-03-26 Thread Greg Snow
Is the order consistent? Meaning that the pdf/eps producing run always comes second? If so, then set a variable to FALSE and when you get to the plotting code have an if statement on that variable, if it is FALSE then set it to TRUE, if it is TRUE then run the plotting code. This way it only

Re: [R] image() function

2010-03-26 Thread Greg Snow
Use the zlim argument to image: m <- matrix(1:18,3,6) par(mfrow = c(2,1)) image(1:6, 1:3, t(m), col = rainbow(20), zlim=c(0,30)) image(1:6, 1:3, t(m+9), col = rainbow(20), zlim=c(0,30)) hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@

[R] Poisson Lognormal

2010-03-26 Thread Robert Ruser
Hi R Users, I'm going to estimate via. ML the parameters in Poisson Lognormal model. The model is: x | lambda ~ Poisson(lambda) lambda ~ Lognormal(a,b) Unfortunately, I haven't found a useful package allowing for such estimation. I tried to use "poilog" package, but there is no equations and it's

[R] distance matrix, podani, package: proxy

2010-03-26 Thread Kim Vanselow
Dear r-helpers, I just wanted to calculate a distance matrix using the function dist, with method = 'Podani' (package: proxy). The calculation is starting without error. Now the hourglass is running and won't stop. Since more than 20 hours! I do not think that the problem is with my input matrix.

Re: [R] Help with assigning a value based on existing numbers

2010-03-26 Thread sjaffe
An expression like "v >= 52", where v is a vector, will produce a vector resulting from comparing each entry -- that is why you see the message. What you want to do is logical subscripting. For example names <- character( nrow( curveData ) ) names[ curvedata$Date.difference <= 29 ] = "< 1 mon

[R] Discrete values in levelplot?

2010-03-26 Thread Filipe Cadete
Dear all, I am trying represent a matrix of discrete values. At the moment I am using levelplot from the lattice package, but it seems to only work with numerical values. Is there an option in levelplot that will allow me to assign a color to a discrete value, or another package that will do th

Re: [R] pause/break between execution of two commands

2010-03-26 Thread Ista Zahn
Hi, See ?Sys.sleep -Ista On Fri, Mar 26, 2010 at 10:29 AM, Jannis wrote: > Dears, > > > > is there any way to include a pause or break for example of 5 seconds between > the execution of two commands in R? I found some stuff in other packages > (pause {DAAG} ...) but I am having trouble instal

Re: [R] R, S, S-Plus, whence comes thy name?

2010-03-26 Thread John Sorkin
Thank you. John John Sorkin M.D., Ph.D. Chief, Biostatistics and Informatics Baltimore VA Medical Center GRECC, University of Maryland School of Medicine Claude D. Pepper OAIC, University of Maryland Clinical Nutrition Research Unit, and Baltimore VA Center Stroke of Excellence University of Mary

[R] return.replicates in survey pkg

2010-03-26 Thread Richard Valliant
How do I retrieve the replicates estimates from a crosstab done using svyby? Here is an example from the help page for svyby in the package: > data(api) > dclus1<-svydesign(id=~dnum, weights=~pw, data=apiclus1, fpc=~fpc) > rclus1<-as.svrepdesign(dclus1) > > a <- svyby(~api99, ~stype, rclus1, svym

[R] pause/break between execution of two commands

2010-03-26 Thread Jannis
Dears, is there any way to include a pause or break for example of 5 seconds between the execution of two commands in R? I found some stuff in other packages (pause {DAAG} ...) but I am having trouble installing custom packages due to insufficient user rights anyway, so I am looking for a way

[R] grid graphics - concatenating gLists - is there a function?

2010-03-26 Thread Mark Heckmann
I have to gList objects containing several grobs. Now, I want to combine them into a single gList object as e.g. gTree() does not take a nested gList as children argument. gl1 <- gList(rectGrob(), rectGrob()) gl2 <- gList(textGrob("Text 1")) Now I want to combine gl1 and gl2 into a single gList

Re: [R] how to measure accuracy of regression tree?

2010-03-26 Thread Frank E Harrell Jr
vibha patel wrote: Hello, for constructing regression tree, I am using rpart function. now after dividing dataset in to training and testing, I'm using predict for forecasting. Such data splitting yields unreliable validations unless N > 20,000. Frank how to measure accuracy of the predict

Re: [R] R, S, S-Plus, whence comes thy name?

2010-03-26 Thread Ted Harding
On 26-Mar-10 12:30:37, John Sorkin wrote: > I appeal to those entrusted with the keeping of the R flame, > the S flame, and the S-Plus flame to relate a bit of history. > How did S, S-Plus, and R get their names? Going from S to S-Plus > appears clear, a commercial company purchased rights to S, >

[R] Odp: Help with assigning a value based on existing numbers

2010-03-26 Thread Petr PIKAL
Hi again a work for cut. See ?cut and notice a labels option. Regards Petr r-help-boun...@r-project.org napsal dne 26.03.2010 11:37:20: > Hi All > > I have a column/variable called time difference. It has a whole list of > numbers from 0 through to the hundreds eg 236. I want to assign a >

Re: [R] Creating a vector of categories

2010-03-26 Thread Christoffer Karlsson
Thanks a ton guys for your help! Saved me a boat load of time and helped me develop a much better method of doing these things than I had in the past. The method I ended up using was to cut up my counts and aggregating my data as suggested by Petr. Thanks! Chris On Fri, Mar 26, 2010 at 12:05 PM,

[R] R Crashing when trying to open script or load workpace

2010-03-26 Thread Musal
Hello all, I am using Windows XP and R 2.10.1. When using the "Open Script" or "Load Workspace" File menu items, R tends to shut down. This does not happen while I am writing the script within R or R is running a script. I used to have this problem with a much earlier version of R. When I started

[R] R-help

2010-03-26 Thread SADANANDAM MADDELA
Hi thank you very much for advanced help. I am new to R language.. I am using r language with asp.net. while i am run below code. the graphics window open out side of my *.aspx *page(it is opened as a *pop up*window) .i need to open that window with in my . *aspx *page(without using( png,jpg e

[R] Please help Me(R Language)

2010-03-26 Thread SADANANDAM MADDELA
Hi thank you very much for advanced help. I am new to R language.. I am using r language with asp.net. while i am run below code. the graphics window open out side of my *.aspx *page(it is opened as a *pop up*window) .i need to open that window with in my . *aspx *page(without using( png,jpg e

[R] similarity measure

2010-03-26 Thread karuna m
hi all, I am doing hierarchical clustering using similarity measures for binary data using package ade4 and hclust function. For method=8 and method = 9 of dist.binary, I am getting Na values. Hence, hclust function is giving error as Error in hclust(d8, method = "ward") :   NA/NaN/Inf in foreig

[R] Help with assigning a value based on existing numbers

2010-03-26 Thread Jessica Cathro
Hi All I have a column/variable called time difference. It has a whole list of numbers from 0 through to the hundreds eg 236. I want to assign a corresponding "name" to each variable from a predefined list: Month or less, 1 -2 months, 2-3 months etc So the result would look something like: Tim

[R] row names in regression results and saving the identification results from added variable plots

2010-03-26 Thread Simon Kiss
Hello all, Is there a way to take the row names from my data.frame and have them imported to the regression results? At the moment, I my original data frame looks like this: / Riding name / Turnout / Margin / Expenditures 1 / Abbotsford 2 / . 3 / . 4 / .Willow I know how to set the row names f

[R] Problems if optimization

2010-03-26 Thread Francisco Silva
What's up fellows... I am a begginer in R and i am trying to find the parameters of one likelihood function, but when i otimize it, always appers a error or advertisement and the solve does not occur. The problem seems like that: "lMix<-function(pars,y){ beta1<-pars[1] beta2<-pars[2] beta3<-pars

Re: [R] R, S, S-Plus, whence comes thy name?

2010-03-26 Thread Kevin Wright
Google "history of S" to find this document www2.research.att.com/areas/stat/doc/94.11.ps with the following quote: By July, 1976, we decided to name the system. Acronyms were in abundance at Bell Laboratories, so it seemed sure that we would

  1   2   >