[R] Need Help for creating a new variable

2009-02-19 Thread Chun-Hao Tu
Hi R users, I did do the research and work on for hours, but I still don't know how to solve my silly problem. I try to creat a new variable in my dataset. such as if diet==C vesl==P then trt=CP; if diet==C vesl==A then trt=CA;. The following is my code (It does not work correctly).

Re: [R] Difference between GEE and Robust Cluster Standard Errors

2009-02-19 Thread Thomas Lumley
On Wed, 18 Feb 2009, jjh21 wrote: Hello, I know that two possible approaches to dealing with clustered data would be GEE or a robust cluster covariance matrix from a standard regression. What are the differences between these two methods, or are they doing the same thing? Thanks. There are

[R] SVM regression code

2009-02-19 Thread Alex Roy
Dear R user, I am looking for SVM regression in R. It willl be helpful for me if some one send me SVM regression code. Thanks Alex [[alternative HTML version deleted]] __ R-help@r-project.org mailing list

[R] Build R-2.8.1 on AIX5.3

2009-02-19 Thread 亿元五角
Hi R users, I want to build R-2.8.1 on AIX5.3, but I got following error message: Error in dyn.load(file, DLLpath = DLLpath, ...) : unable to load shared library '/rnd/homes/jixu/tmp/R-2.8.1/library/stats/libs/stats.so': rtld: 0712-001 Symbol d1mach was referenced from module

Re: [R] Need Help for creating a new variable

2009-02-19 Thread Mark Difford
Hi Chun, I did do the research and work on for hours ... I try to creat a new variable in my dataset. Yes, looks like you did. Look at ?interaction, which gives you more flexibility than ?:. ## Example diet-sort(rep(x=c(C,T),4)) vesl-rep(x=c(A,P),4) mydata-data.frame(diet,vesl) mydata$trt

Re: [R] R: R scripts and parameters

2009-02-19 Thread Prof Brian Ripley
You seem not to have put the R bin directory in your path. That is where Rterm, Rscript ... are installed (and the installer does not change the PATH for you). On Thu, 19 Feb 2009, mau...@alice.it wrote: Sorry. This is still unclear to me. I generated a file called Test.R that contains the

Re: [R] Build R-2.8.1 on AIX5.3

2009-02-19 Thread Ei-ji Nakama
Hi Jin. I found there is someone meet same problem when he build R-2.7.0 by searching r-help, and he used a patch to resolve this issue. The patch¡¯s location is http://prs.ism.ac.jp/~nakama/AIX/changefiles. But I can not find a patch R-2.8.1 in this path. Gnu patch is necessary.(AIX

[R] Read.table not reading in all columns

2009-02-19 Thread Sally
Hello, I am reading in a file called fit2.txt (Limma). fit2.txt has 38 columns but when I dim(fit2) I only get 6 columns. The first column that it does not read in is df.residual. fit2-read.table(fit2, file=fit2.txt,sep=\t,quote=,comment.char=,as.is=TRUE) The first few lines of fit2.txt

[R] Meaning of .local and the special token ..1 returned from match.call

2009-02-19 Thread Niels Richard Hansen
I am writing a version of the subset function for a new class. I don't understand the behavior of match.call in this particular case, and I didn't seem to be able to find much help in the language definition or the email archive. Here follows a minimal example: setClass(myClass,

[R] Re : SVM regression code

2009-02-19 Thread justin bem
there is svmpath package by Trevor Hastie  Justin BEM BP 1917 Yaoundé Tél (237) 99597295 (237) 22040246 De : Alex Roy alexroy2...@gmail.com À : r-help@r-project.org Envoyé le : Jeudi, 19 Février 2009, 9h19mn 18s Objet : [R] SVM regression code Dear R

[R] Translate R to C code

2009-02-19 Thread datapool99
I am looking for a person who is able to translate a short R code to a C code. I am not sure where to start searching. It is only a short R code (the wrm.smooth code from the robfilter package). Perhaps someone can give me an hint where to start. Thanks in advance. Sincerely, Lars -- View

[R] Multiple merge, better solution?

2009-02-19 Thread Lauri Nikkinen
Hello, My problem is that I would like to merge multiple files with a common column but merge accepts only two data.frames to merge. In the real situation, I have 26 different data.frames with a common column. I can of course use merge many times (see below) but what would be more sophisticated

[R] Matrix package: band matrix

2009-02-19 Thread Thomas Lumley
I want to construct a symmetric band matrix in the Matrix package from a matrix where the first column contains data for the main diagonal, the second column has data for the first subdiagonal/superdiagonal and so on. Since the Matrix will be 10^5 x 10^5 or so, with perhaps 10-20 non-zero

Re: [R] Multiple merge, better solution?

2009-02-19 Thread markleeds
Hi: Below is a TOTAL HACK and I don't recommend it but it does seem to do what you want. I think that I remember Gabor saying that you can merge multiple data frames using zoo but I don't know the specifics. I'm sure he'll respond with the correct way. Below uses a global variable to access

[R] type III effect from glm()

2009-02-19 Thread Simon Pickett
Hi all, This could be naivety/stupidity on my part rather than a problem with model output, but here goes I have fitted a fairly simple model m1-glm(count~siteall+yrs+yrs:district,family=quasipoisson,weights=weight,data=m[x[[i]],]) I want to know if yrs (a continuous variable) has a

Re: [R] Multiple merge, better solution?

2009-02-19 Thread baptiste auguie
Hi, I think Reduce could help you. DF1 - data.frame(var1 = letters[1:5], a = rnorm(5)) DF2 - data.frame(var1 = letters[3:7], b = rnorm(5)) DF3 - data.frame(var1 = letters[6:10], c = rnorm(5)) DF4 - data.frame(var1 = letters[8:12], d = rnorm(5)) g - merge(DF1, DF2, by.x=var1, by.y=var1, all=T)

Re: [R] type III effect from glm()

2009-02-19 Thread Simon Pickett
Sorry, that was a typo in the email, not the model. So I still have the problem. Cheers, Simon. - Original Message - From: Ted Harding ted.hard...@manchester.ac.uk To: Simon Pickett simon.pick...@bto.org; r-help@r-project.org Sent: Thursday, February 19, 2009 10:56 AM Subject:

Re: [R] Multiple merge, better solution?

2009-02-19 Thread Lauri Nikkinen
Thanks, both solutions work fine. I tried these solutions to my real data, and I got an error Error in match.names(clabs, names(xi)) : names do not match previous names I refined this example data to look more like my real data, this also produces the same error. Any ideas how to prevent this

Re: [R] Read.table not reading in all columns

2009-02-19 Thread Uwe Ligges
I'd suggest to make the data available on the web. Then we can take a closer look. You or some mail tool in between removed the tabs from the message, hence we cannot reproduce in any way. Best, Uwe Ligges Sally wrote: Hello, I am reading in a file called fit2.txt (Limma). fit2.txt has 38

Re: [R] type III effect from glm()

2009-02-19 Thread Ted Harding
On 19-Feb-09 10:38:50, Simon Pickett wrote: Hi all, This could be naivety/stupidity on my part rather than a problem with model output, but here goes I have fitted a fairly simple model m1-glm(count~siteall+yrs+yrs:district,family=quasipoisson,

Re: [R] type III effect from glm()

2009-02-19 Thread Simon Pickett
Cheers Mark, I did originally think too, i.e. that not including the main effect was the problem. However, the same thing happens when I include main effects test1-glm(count~siteall+yrs*district,family=quasipoisson,weights=weight,data=m[x[[i]],])

[R] table with 3 varialbes

2009-02-19 Thread Pascal Candolfi
I have the initial matrice: *data.frame(Subject=rep(100:101, each=4), Quarter=rep(paste(Q,1:4, sep=),2), Boolean = rep(c(Y,N),4))* Subject Quarter Boolean 1100 Q1 Y 2100 Q2 N 3100 Q3 Y 4100 Q4 N 5101 Q1 Y 6101

[R] package knnFinder, kd-trees

2009-02-19 Thread Markus Loecher
Dear R users, thanks to Samuel for making the package knnFinder available to the public. I was wondering if there is an easy way to only build and store the kdd tree in a first step and perform NN queries from then on ? It seems that nn() does both simultaneously. Thanks! Markus

[R] table with 3 variables

2009-02-19 Thread Pascal Candolfi
I have the initial matrice: *data.frame(Subject=rep(100:101, each=4), Quarter=rep(paste(Q,1:4, sep=),2), Boolean = rep(c(Y,N),4))* Subject Quarter Boolean 1100 Q1 Y 2100 Q2 N 3100 Q3 Y 4100 Q4 N 5101 Q1 Y 6101

[R] Use of ifelse for indicating specific rownumber

2009-02-19 Thread joe1985
Hello I have a dataset named b2 with 1521 rows, in that dataset i have 64 rows containing specific information. the rownumbers with specific info are: + i [1] 22 53 104 127 151 196 235 238 249 250 263 335 344 353 362 370 389 422 458 459 473 492 502 530 561 624 647

Re: [R] table with 3 varialbes

2009-02-19 Thread patricia garcía gonzález
Hi, Look, is simple with reshape: x - data frame(...) reshape( x, idvar = Subject, direction = wide, timevar = Quarter) Regards, Patricia Date: Thu, 19 Feb 2009 11:02:58 +0100 From: pcando...@gmail.com To: r-help@r-project.org Subject: [R] table with 3 varialbes I have the initial

Re: [R] System.time

2009-02-19 Thread Wacek Kusnierczyk
Wacek Kusnierczyk wrote: to contribute my few cents, here's a simple benchmarking routine, inspired by the perl module Benchmark. it allows one to benchmark an arbitrary number of expressions with an arbitrary number of replications, and provides a summary matrix with selected timings.

Re: [R] Multiple merge, better solution?

2009-02-19 Thread baptiste auguie
Another option using Recall, merge.rec - function(.list, ...){ if(length(.list)==1) return(.list[[1]]) Recall(c(list(merge(.list[[1]], .list[[2]], ...)), .list[-(1:2)]), ...) } my.list - list(DF1, DF2, DF3, DF4) test2 - merge.rec(my.list, by.x=var1, by.y=var1, all=T)

Re: [R] Multiple merge, better solution?

2009-02-19 Thread baptiste auguie
If you don't mind I've added this example to the R wiki, http://wiki.r-project.org/rwiki/doku.php?id=tips:data-frames:merge It would be very nice if a R guru could check that the information I put is not complete fantasy. Feel free to remove as appropriate. Best wishes, baptiste On 19

Re: [R] type III effect from glm()

2009-02-19 Thread markleeds
Hi Simon: In below , test1 spelled out is count ~ siteall + yrs + district + yrs:district so this is fine. but in test2 , you have years interacting with district but not the main effect for years. this is against the rules of marginality so I still think there's a problem. I would wait for

Re: [R] table with 3 varialbes

2009-02-19 Thread patricia garcía gonzález
Hi, I think you should take a look to ?reshape. Regards Patricia Date: Thu, 19 Feb 2009 11:02:58 +0100 From: pcando...@gmail.com To: r-help@r-project.org Subject: [R] table with 3 varialbes I have the initial matrice: *data.frame(Subject=rep(100:101, each=4),

Re: [R] Use of ifelse for indicating specific rownumber

2009-02-19 Thread Patrick Burns
I think you are looking for something like: ifelse(1:nrow(b2) %in% i, 1, 0) Patrick Burns patr...@burns-stat.com +44 (0)20 8525 0696 http://www.burns-stat.com (home of The R Inferno and A Guide for the Unwilling S User) joe1985 wrote: Hello I have a dataset named b2 with 1521 rows, in that

Re: [R] Multiple merge, better solution?

2009-02-19 Thread Lauri Nikkinen
That's perfectly fine. I figured out how to to this with my second example DF1 - data.frame(var1 = letters[1:5], a = rnorm(5), b = rnorm(5), c = rnorm(5)) DF2 - data.frame(var1 = letters[3:7], a = rnorm(5), b = rnorm(5), c = rnorm(5)) DF3 - data.frame(var1 = letters[6:10], a = rnorm(5), b =

Re: [R] Unadulterated plot

2009-02-19 Thread James Nicolson
good point! Provide your own set of x,y,z co-ords, mine are pretty big but you can use any. library(akima) fr3d = data.frame(x,y,z) xtrp - interp(fr3d$x,fr3d$y,fr3d$z,linear=FALSE,extrap=TRUE,duplicate= strip) op - par(ann=FALSE, mai=c(0,0,0,0)) filled.contour(xtrp$x, xtrp$y, xtrp$z, asp =

Re: [R] Multiple merge, better solution?

2009-02-19 Thread Lauri Nikkinen
Yes, even better DF1 - data.frame(var1 = letters[1:5], a = rnorm(5), b = rnorm(5), c = rnorm(5)) DF2 - data.frame(var1 = letters[3:7], a = rnorm(5), b = rnorm(5), c = rnorm(5)) DF3 - data.frame(var1 = letters[6:10], a = rnorm(5), b = rnorm(5), c = rnorm(5)) DF4 - data.frame(var1 = letters[8:12],

Re: [R] type III effect from glm()

2009-02-19 Thread Mark Difford
Hi Simon, I want to know if yrs (a continuous variable) has a significant unique effect in the model, so I fit a simplified model with the main effect ommitted... [A different approach...] This is not really a sensible question until you have established that there is no significant

Re: [R] table with 3 variables

2009-02-19 Thread Eik Vettorazzi
Maybe reshape will help you, but I'm in doubt that your posted desired result fits your given data - e.g shouldn't subject 101 Q3 give Y? xx-data.frame(Subject=rep(100:101, each=4), Quarter=rep(paste(Q,1:4,sep=),2), Boolean = rep(c(Y,N),4))

Re: [R] Use of ifelse for indicating specific rownumber

2009-02-19 Thread Eik Vettorazzi
why use ifelse? Shouldn't b2$totalvac-rep(0,1521) b2$totalvac[i]-1 do the trick? joe1985 schrieb: Hello I have a dataset named b2 with 1521 rows, in that dataset i have 64 rows containing specific information. the rownumbers with specific info are: + i [1] 22 53 104 127 151 196

[R] dotplot points color

2009-02-19 Thread glaporta
Dear list, is it possible to change the background color of dotplot's points? I tried in many ways but unsuccessfully Thanks in advance Gianandrea require(lattice) dotplot(variety ~ yield | site, data = barley, groups = year, pch=21) dotplot(variety ~ yield | site, data = barley, groups =

[R] problem with comparing a part of string with whole string

2009-02-19 Thread venkata kirankumar
Hi all, I got one problem with comparing strings like if any string is like *RIGHT, EPICARDIUM: FOCUS, GRAY-WHITE, SINGLE, APPROX 0.6 CM IN DIAMETER*. and i have to compare *GRAY-WHITE*with the above string or otherwise i have to compare*TUMOR BENIGN* this string

Re: [R] Insert value in a Vector Alternately

2009-02-19 Thread jim holtman
How about this: dat-c(0.00377467,0.00377467,0.00377467,0.00380083,0.00380083,0.00380083,0.00380959, + 0.00380959,0.00380959,0.00380083,0.00380083,0.00380083) dat[seq(1, by=3, to=length(dat))] - 0 dat [1] 0. 0.00377467 0.00377467 0. 0.00380083 0.00380083 0. 0.00380959

Re: [R] problem with comparing a part of string with whole string

2009-02-19 Thread jim holtman
'grep' will tell you if there is a match in the string; x - c(*RIGHT, EPICARDIUM: FOCUS, GRAY-WHITE, SINGLE, APPROX 0.6 CM IN DIAMETER*.,*MEDULLRY TUMOR BENIGN,TYP PHEOCHROMOCYTOMA*) grep(GRAY-WHITE, x) [1] 1 grep(TUMOR BENIGN, x) [1] 2 On Thu, Feb 19, 2009 at 7:39 AM, venkata kirankumar

[R] Odp: problem with comparing a part of string with whole string

2009-02-19 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 19.02.2009 13:39:42: Hi all, I got one problem with comparing strings like if any string is like *RIGHT, EPICARDIUM: FOCUS, GRAY-WHITE, SINGLE, APPROX 0.6 CM IN DIAMETER*. and i have to compare *GRAY-WHITE*with the above string

Re: [R] type III effect from glm()

2009-02-19 Thread Mark Difford
Hi Simon, [On my response] ...not really a sensible question until... On reading through this...what I mean is that yours seems not to be a sensible approach, the question itself may be reasonable. What you want to be doing is testing whether the interaction term (yrs:district) gets dropped.

Re: [R] Insert value in a Vector Alternately

2009-02-19 Thread baptiste auguie
Perhaps you can try this, d - c(0.00377467, 0.00377467, 0.00377467, 0.00380083, 0.00380083, 0.00380083, 0.00380959, 0.00380959, 0.00380959, 0.00380083, 0.00380083, 0.00380083) c( t( cbind(matrix(d, ncol=3, byrow=T), 0))) I don't know how to avoid the transpose operation that

[R] Bug in predict function for naiveBayes?

2009-02-19 Thread joris meys
Dear all, I tried a simple naive Bayes classification on an artificial dataset, but I have troubles getting the predict function to work with the type=class specification. With type= raw, it works perfectly, but with type=class I get following error : Error in as.vector(x, mode) : invalid 'mode'

Re: [R] error bars

2009-02-19 Thread hadley wickham
On Thu, Feb 19, 2009 at 1:19 AM, jdeisenberg catc...@catcode.com wrote: Nicole Hackman wrote: Hello, I have a very simple data set i imported from excel including 96 averages in a column along with 96 standard errors associated with those averages (calculated in excel). I plotted the 95

Re: [R] Insert value in a Vector Alternately

2009-02-19 Thread Eik Vettorazzi
to avoid the transposition you can use rbind(matrix(d, nrow=3), 0) baptiste auguie schrieb: Perhaps you can try this, d - c(0.00377467, 0.00377467, 0.00377467, 0.00380083, 0.00380083, 0.00380083, 0.00380959, 0.00380959, 0.00380959, 0.00380083, 0.00380083, 0.00380083) c( t(

Re: [R] Python and R

2009-02-19 Thread Esmail Bonakdarian
Doran, Harold wrote: lm(y ~ x-1) solve(crossprod(x), t(x))%*%y# probably this can be done more efficiently You could do crossprod(x,y) instead of t(x))%*%y that certainly looks more readable (and less error prone) to an R newbie like myself :-)

Re: [R] Insert value in a Vector Alternately

2009-02-19 Thread David Hajage
2009/2/19 baptiste auguie ba...@exeter.ac.uk Perhaps you can try this, d - c(0.00377467, 0.00377467, 0.00377467, 0.00380083, 0.00380083, 0.00380083, 0.00380959, 0.00380959, 0.00380959, 0.00380083, 0.00380083, 0.00380083) c( t( cbind(matrix(d, ncol=3, byrow=T), 0))) I don't

Re: [R] Python and R

2009-02-19 Thread Esmail Bonakdarian
Hi Kenn, Thanks for the suggestions, I'll have to see if I can figure out how to convert the relatively simple call to lm with an equation and the data file to the functions you mention (or if that's even feasible). Not an expert in statistics myself, I am mostly concentrating on the

Re: [R] indicator or deviation contrasts in log-linear modelling

2009-02-19 Thread Michael Friendly
Maja, The need to interpret parameters in log-linear models (and therefore, the need to understand how the model is parameterized) often vanishes if you visualize the fitted model or the residuals in a mosaic display. e.g., ucb1 asserts Admit is jointly independent of Gender and Dept --- fits

Re: [R] table with 3 variables

2009-02-19 Thread David Hajage
And I would like to group the Subject by Quarter using as a result in the table the value of the third variable (Boolean). The final result would give: Subjet Q1 Q2 Q3 Q4 1100 Y Y Y Y 2101 N N N N Are you sure that this is the final result you want ? You could use the reshape

Re: [R] table with 3 variables

2009-02-19 Thread David Hajage
Sorry, you don't need 'melt' : cast(truc, Subject ~ Quarter) 2009/2/19 David Hajage dhajag...@gmail.com And I would like to group the Subject by Quarter using as a result in the table the value of the third variable (Boolean). The final result would give: Subjet Q1 Q2 Q3 Q4 1100 Y

Re: [R] Insert value in a Vector Alternately

2009-02-19 Thread Eik Vettorazzi
actually c(rbind(0,matrix(d, nrow=3))) which has the bonus of giving the desired result ;) baptiste auguie schrieb: Perhaps you can try this, d - c(0.00377467, 0.00377467, 0.00377467, 0.00380083, 0.00380083, 0.00380083, 0.00380959, 0.00380959, 0.00380959, 0.00380083, 0.00380083,

[R] Problem in converting a string in binary formate

2009-02-19 Thread venkata kirankumar
Hi all, can any one suggest how to convert one string into binary formate to store in another file and to use for farther searching with using of binary files only that search can process for that i need to convert string into binary files thanks in advance [[alternative HTML version

Re: [R] Running out of memory when importing SPSS files

2009-02-19 Thread Paul Bivand
2009/2/19 Thomas Lumley tlum...@u.washington.edu: On Wed, 18 Feb 2009, Uwe Ligges wrote: dobomode wrote: Hello R-help, I am trying to import a large dataset from SPSS into R. The SPSS file is in .SAV format and is about 1GB in size. I use read.spss to import the file and get an error

Re: [R] Python and R

2009-02-19 Thread Esmail Bonakdarian
Gabor Grothendieck wrote: On Wed, Feb 18, 2009 at 7:27 AM, Esmail Bonakdarian esmail...@gmail.com wrote: Gabor Grothendieck wrote: See ?Rprof for profiling your R code. If lm is the culprit, rewriting your lm calls using lm.fit might help. Yes, based on my informal benchmarking, lm is the

Re: [R] Unadulterated plot

2009-02-19 Thread Patrizio Frederic
James, as I previously told you in my broken English, probably the function you're looking for is not filled.contour but image and contour The following code makes exactly what you ask for data(akima) akima akima.smooth - with(akima, interp(x, y, z, xo=seq(0,25, length=500),

Re: [R] Re : SVM regression code

2009-02-19 Thread Max Kuhn
You can find the complete list at: http://cran.r-project.org/web/views/MachineLearning.html Max __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

[R] DLM and matrices with 0 eigenvalues

2009-02-19 Thread Rebecca Sela
I am using DLM to fit a state space model. The covariance matrix of states (W) is given by: a 0 a 0 0 0 0 0 a 0 a 0 0 0 0 0 where a is a parameter to be estimated. Even though the matrix is positive semidefinite, sometimes DLM gives me an error that W is not a valid variance matrix. As far

Re: [R] Insert value in a Vector Alternately

2009-02-19 Thread baptiste auguie
thanks all for the correction, funny how it's often the complicated solution that comes to mind first. baptiste On 19 Feb 2009, at 13:41, Eik Vettorazzi wrote: actually c(rbind(0,matrix(d, nrow=3))) which has the bonus of giving the desired result ;) baptiste auguie schrieb: Perhaps

Re: [R] Multiple merge, better solution?

2009-02-19 Thread Gabor Grothendieck
The zoo package has a multi-way merge for zoo objects. Its just do.call(merge, z) where z is a list of zoo objects. In detail: set.seed(1) DF1 - data.frame(var1 = letters[1:5], a = rnorm(5), b = rnorm(5), c = rnorm(5)) DF2 - data.frame(var1 = letters[3:7], a = rnorm(5), b = rnorm(5), c =

[R] code patterns in vector

2009-02-19 Thread Stefan Uhmann
Dear List, I have this column/vector: vec - c(function, missing, string) and want to compute a second column/vector: - value if the pattern unc is found: 1 - value if the pattern iss is found: 2 - value if none of the patterns is found: 0 This should be the result: vec2 [1] 1 2 0 Any help?

Re: [R] code patterns in vector

2009-02-19 Thread Duncan Murdoch
On 19/02/2009 9:26 AM, Stefan Uhmann wrote: Dear List, I have this column/vector: vec - c(function, missing, string) and want to compute a second column/vector: - value if the pattern unc is found: 1 - value if the pattern iss is found: 2 - value if none of the patterns is found: 0 This

Re: [R] Insert value in a Vector Alternately

2009-02-19 Thread dwinsemius
- Original Message - From: baptiste auguie ba...@exeter.ac.uk To: Gundala Viswanath gunda...@gmail.com Cc: r-h...@stat.math.ethz.ch R-help r-h...@stat.math.ethz.ch Sent: Thursday, February 19, 2009 7:12:23 AM GMT -06:00 US/Canada Central Subject: Re: [R] Insert value in a Vector

[R] Curso: Introduccion al idioma R

2009-02-19 Thread Sharon Lazenby
A Todos Todavía hay sitios para los próximos cursos. Para mas información y el formulario de inscripción pónganse en contacto con train...@mango-solutions.com, o visiten nuestro sitio Web www.mango-solutions.com http://www.mango-solutions.com/ . The R Language Introducción al idioma R

Re: [R] Age as time-scale in a cox model

2009-02-19 Thread Terry Therneau
You asked about survival curves with age scale versus follow-up scale. fit1 - coxph(Surv(time/365.25, status) ~ t5 + id + age, data=stanford2) surv1- survfit(fit1) surv1 n events median 0.95LCL 0.95UCL 157.000 102.000 1.999 0.898 3.608 summary(surv1, times=3) time n.risk

Re: [R] Need Help for creating a new variable

2009-02-19 Thread Jorge Ivan Velez
Dear Chun-Hao, How about this? diet-sort(rep(x=c(C,T),4)) vesl-rep(x=c(A,P),4) mydata-data.frame(diet,vesl) mydata$trt-with(mydata,paste(diet,vesl,sep=)) mydata HTH, Jorge On Thu, Feb 19, 2009 at 2:53 AM, Chun-Hao Tu tc...@hotmail.com wrote: Hi R users, I did do the research and work on

Re: [R] Need Help for creating a new variable

2009-02-19 Thread Stavros Macrakis
On Thu, Feb 19, 2009 at 9:50 AM, Jorge Ivan Velez jorgeivanve...@gmail.com wrote: mydata$trt-with(mydata,paste(diet,vesl,sep=)) Besides the above (good!) solution, you might want to understand why your original solution didn't work: mydata$trt-ifelse(mydata$diet==C mydata$vesl==A, CA, +

[R] Help on warning message from Neg. Binomial error during glm

2009-02-19 Thread Mahua Ghara
I am using glm.nb, a ~b*c ( b is categorical and c is continuous). when I run this model I get the warning message: Warning messages: 1: In theta.ml(Y, mu, sum(w), w, limit = control$maxit, trace = control$trace : iteration limit reached 2: In theta.ml(Y, mu, sum(w), w, limit = control$maxit,

Re: [R] type III effect from glm()

2009-02-19 Thread John Fox
Dear Mark and Simon, I assume from the variable names that siteall and district are factors and that yrs is numeric. If that's the case, then the second model formula, ~ siteall + district + yrs:district, nests yrs within district, that is, will fit a separate slope for years within each level of

[R] read.table : how to condition on error while opening file?

2009-02-19 Thread Stephane Bourgeois
Hi, I'm using read.table in a loop, to read in multiple files. The problem is that when a file is missing there is an error message and the loop is broken; what I'd like to do is to test for the error and simply do next instead of breaking the loop. Anybody knows how to do that? Example:

Re: [R] Unadulterated plot

2009-02-19 Thread James Nicolson
To All, I'm using R 2.8.1. I have attached two images, one shows what I get and the other shows what I want. All I want is the plotting region. Surely there must be a way of plotting individual regions/components in R? Patrizio, I prefer filled.contour() for my data. I still have the same

[R] everybody loves R...

2009-02-19 Thread thefurryblur
Just thought I'd let you guys know about this site I stumbled across: http://riki.wikidot.com/ http://riki.wikidot.com/ It is obviously in its early stages (as it does not have any content yet) but is looking like a good place to build a simple knowledge base for the R software. Anyway, if any

Re: [R] everybody loves R...

2009-02-19 Thread Gábor Csárdi
I don't want to be mean, I really like wikidot, but isn't it a better solution to use the R wiki instead? http://wiki.r-project.org/rwiki/doku.php G. On Thu, Feb 19, 2009 at 4:44 PM, thefurryblur wrcst...@gmail.com wrote: Just thought I'd let you guys know about this site I stumbled across:

Re: [R] read.table : how to condition on error while opening file?

2009-02-19 Thread Eik Vettorazzi
Hi Stephane, see ?try hth. Stephane Bourgeois schrieb: Hi, I'm using read.table in a loop, to read in multiple files. The problem is that when a file is missing there is an error message and the loop is broken; what I'd like to do is to test for the error and simply do next instead of

Re: [R] Questions about biglm

2009-02-19 Thread Greg Snow
The idea of the biglm function is to only have part of the data in memory at a time. You read in part of the data and run biglm on that section of the data, then delete it from memory, load in the next part of the data and use update to include the new data in the analysis, delete that, read

[R] an S idiom for ordering matrix by columns?

2009-02-19 Thread Aaron Mackey
There's got to be a better way to use order() on a matrix than this: y 2L-035-3 2L-081-23 2L-143-18 2L-189-1 2R-008-5 2R-068-15 3L-113-4 3L-173-2 3981 1 221 12 2 8571 1 221 22 2

[R] colored maps again

2009-02-19 Thread Alina Sheyman
I'm trying to create a colored map that would show the number of students per state. My data frame consists of two columns - state and count. I'm using the following code library(maps) map(usa) library(plotrix) state.col-color.scale(gre$count,0,0,c(0,1)) map(state,fill=TRUE,col=state.col) I'm

[R] counting strings in a column

2009-02-19 Thread Nattu
Dear All, I have a query : what is the command to count number of repeated words in a column. for ex: a = oranges oranges apples apples grape oranges apple pine the result should be oranges 3 apples 3 grape 1 pine 1 is there an easy way for this. Thanks, Nataraju GM R D Bangalore --

Re: [R] an S idiom for ordering matrix by columns?

2009-02-19 Thread jim holtman
How about this: x - matrix(sample(0:1,100,TRUE),10) # create a list of all the columns to sort col.list - lapply(seq(ncol(x)), function(a) x[,a]) # now sort the matrix x[do.call(order, col.list),] [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,]001001

Re: [R] an S idiom for ordering matrix by columns?

2009-02-19 Thread Gustaf Rydevik
On Thu, Feb 19, 2009 at 5:40 PM, Aaron Mackey ajmac...@gmail.com wrote: There's got to be a better way to use order() on a matrix than this: y 2L-035-3 2L-081-23 2L-143-18 2L-189-1 2R-008-5 2R-068-15 3L-113-4 3L-173-2 3981 1 221 12

Re: [R] counting strings in a column

2009-02-19 Thread jim holtman
?table On Thu, Feb 19, 2009 at 11:48 AM, Nattu natar...@gmail.com wrote: Dear All, I have a query : what is the command to count number of repeated words in a column. for ex: a = oranges oranges apples apples grape oranges apple pine the result should be oranges 3 apples 3

Re: [R] Questions about biglm

2009-02-19 Thread John Fox
Dear Greg and Dobo, The vif() in the car package computes VIFs (and generalized VIFs) from the covariance matrix of the coefficients; I'm not sure whether it will work directly on objects produced by biglm() but if not it should be easily adapted to do so. I hope this helps, John

Re: [R] indicator or deviation contrasts in log-linear modelling

2009-02-19 Thread Charles C. Berry
On Wed, 18 Feb 2009, maiya wrote: I realise that in the case of loglin the parameters are clacluated post festum from the cell frequencies, however other programmes that use Newton-Raphson as opposed to IPF work the other way round, right? In which case one would expect the output of

Re: [R] Unadulterated plot

2009-02-19 Thread Duncan Murdoch
James Nicolson wrote: To All, I'm using R 2.8.1. I have attached two images, one shows what I get and the other shows what I want. All I want is the plotting region. Surely there must be a way of plotting individual regions/components in R? Patrizio, I prefer filled.contour() for my data. I

Re: [R] an S idiom for ordering matrix by columns?

2009-02-19 Thread Aaron Mackey
Thanks to all, do.call(order, as.data.frame(y)) was the idiom I was missing! -Aaron On Thu, Feb 19, 2009 at 11:52 AM, Gustaf Rydevik gustaf.ryde...@gmail.comwrote: On Thu, Feb 19, 2009 at 5:40 PM, Aaron Mackey ajmac...@gmail.com wrote: There's got to be a better way to use order() on a

Re: [R] matrix computation???

2009-02-19 Thread Greg Snow
You are computing the hat matrix to predict stack.loss, but stack.loss is a column in the A matrix, so you predictions are all perfect (given stack.loss, what is stack.loss, fairly simple answer, all errors are 0). I think you want to redo this using only the 3 columns other than stack.loss in

Re: [R] colored maps again

2009-02-19 Thread Mike Lawrence
Here's a bit of a hacky way to do it: #get the names of each state state=map('state',plot=F)$names #set up some random state-color data cols = as.data.frame(cbind(state=states,x=sample(1:10,length(states),replace=T))) #do the plot map('usa') for(this_state in state){

Re: [R] problem with using %in% condition while using in if() condition

2009-02-19 Thread Greg Snow
The %in% operator returns a vector of logicals the same length as the vector to the left. The if program flow operator expects a single logical value, not a vector, since you are giving it a vector it looks at just the 1st element, ignores the rest and gives the warning. This warning should be

Re: [R] How to connect R and WinBUGS/OpenBUGS/LinBUGS in Linux in Feb. 2009

2009-02-19 Thread chaogai
I do not know about the ubuntu instructions, they would not help me on Suse. The wine version is 1.1.9. I thought that was the latest,but when I checked latest is 1.1.15, which does indeed throw the blackbox error. So, now it does not work for me either Sorry I gave bad advise kees On Thu, 19

[R] Source code for nlm()

2009-02-19 Thread Ravi Varadhan
Hi, Where can I find the source code for nlm()? I dowloaded the R2.8.1.tar.gz file and looked at all the .c and .f files, but couldn't find either nlm.c or nlm.f There is an nlm.r file, but that is not useful. Thanks for any help, Ravi.

Re: [R] Python and R

2009-02-19 Thread Gabor Grothendieck
On Thu, Feb 19, 2009 at 8:30 AM, Esmail Bonakdarian esmail...@gmail.com wrote: Hi Kenn, Thanks for the suggestions, I'll have to see if I can figure out how to convert the relatively simple call to lm with an equation and the data file to the functions you mention (or if that's even

Re: [R] read.table : how to condition on error while opening file?

2009-02-19 Thread lauramorg...@bluewin.ch
Hello Stephane, here is something you could try, filelist - c(file1.txt, file2.txt, file3.txt) for (i in 1:3) { tmpList-try(read.table(filelist[[i]]), silent=TRUE) if(inherits(tmpList, try-error)) {print(paste(error opening file , filelist[[i]])) } else {

[R] TAR Models and predictive residuals

2009-02-19 Thread Andreas Klein
Hello R users. There is a paper from Ruey Tsay with the title: Testing and Modelling Threshold Autoregressive Processes, published in 1989 in the Journal of the American Statistical Association (March, Vol. 84, No. 405). Mr. Tsay describes a very interesting way of identifying and modelling

[R] Doing pairwise comparisons using either Duncan, Tukey or LSD

2009-02-19 Thread Saeed Ahmadi
Hi, I have a basic and simple question on how to code pairwise (multiple) mean compariosn between levels of a factor using one of the Duncan, Tukey or LSD. Thanks in advance, Saeed -- View this message in context:

[R] Using R in Java?

2009-02-19 Thread nicro
Hi 2 questions- 1. Is there a package that will allow me to run R scripts (entirely) from Java? 2. If so, is there a way to capture the output of those scripts, (including images) and embed them in my SWT java app? My challenge is I have a java app that does some statistical chores- it would be

Re: [R] Doing pairwise comparisons using either Duncan, Tukey or LSD

2009-02-19 Thread Chuck Cleland
On 2/19/2009 11:51 AM, Saeed Ahmadi wrote: Hi, I have a basic and simple question on how to code pairwise (multiple) mean compariosn between levels of a factor using one of the Duncan, Tukey or LSD. Here is one approach: library(multcomp) summary(glht(lm(Petal.Width ~ Species, data =

Re: [R] Source code for nlm()

2009-02-19 Thread Christos Hatzis
It seems to be in optimize.c Rgonzui has a very nice search facility for source of R or CRAN packages (however it is against R 2.8.0 source): http://rgonzui.nakama.ne.jp/R/markup/R-2.8.0/src/main/optimize.c?fm=cq=nlm# l378 -Christos -Original Message- From:

  1   2   >