[R] image usage
I am beginner in R and am trying to use the image function to create a grid, but would like to use an outer file as input. A file that contains the following array for example: 3 4 5 2 3 5 1 2 1 so that each cell has a color with different intensity. I am having problems to input the file and am not sure that image would do it . Does anybody know how to do it or have another suggestion? Thanks Julianno __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Simplex Out of Bounds Error
On Sat, 11 Oct 2003 [EMAIL PROTECTED] wrote: I am running the following code (testing the use of the simplex function to determine if a point is in the convex hull of another set of points or not): a - c(0, 0) A3 -matrix(c(1,2,3,4,1,1), ncol = 2, byrow = T) b3 -c(1.5, 3.5, 1) simplex(a = a, A3 = A3, b3 = b3) and the following error message appears: Error in simplex1(out1$a[1:(n + m1 + m2)], out1$A[, 1:(n + m1 + m2)], : subscript out of bounds Any advice on why this error is appearing and how to avoid it? (Particularly the latter?) In terms of the convex hull problem, this error seems to occur when the point in question (in the convex hull or not) is on the edge/surface of the convex hull. But I'm not positive about this. Thanks in advance. (I've noticed a few other posts of this problem, but never saw anyone reply.) I assume this is function simplex() in package boot, although you did not say so. If so, did you contact the author (and not the maintainer) who may well not read R-help but is the person most likely to be able to supply a fix? -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] image usage
Suppose your data is in image.txt, space delimited (one or more spaces), then you could use: myimage - as.matrix(read.table('image.txt',skip=0,header=FALSE,sep=,strip.white=TRUE))to view the resulting image use: image(myimage) to get contours: contour(myimage) etc. -- http://perswww.kuleuven.ac.be/~u0027178/VCard/mycard.php?name=krisn http://gloveg.kuleuven.ac.be/ Minds are like parachutes, they only work when open __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] DBI Interface broken
Fernando Henrique Ferraz wrote: Hi, I'm trying to use R's DBI interface but it appears to be broken. I am using R 1.8.0 on Linux, and have just installed DBI 0.1-6 through the command 'install.packages(DBI)'. Installation went fine, but now when I try to do a simple dbConnect(), it won't do anything besides complaining about an internal error: library(DBI) dbConnect(anything) Error in dbConnect(anything) : couldn't find function .valueClassTest dbConnect standardGeneric for dbConnect defined from package DBI defined with value class: DBIConnection function (drv, ...) .valueClassTest(standardGeneric(dbConnect), DBIConnection, dbConnect) environment: 0x91201a8 Methods may be defined for arguments: drv Anyone has a clue on what might be going on? Is it DBI working for any of you using R 1.8.0? Thank you, Why do you post twice, to R-help and to R-bugs? In order not to cross-post I repeat my answer on your bug-report: Package methods has a namespace from which .valueClassTest() is not exported, but it's in there, try: methods:::.valueClassTest I think .valueClassTest() is not intended to be called by the user, so the bug seems to be in package DBI rather than in R, and the maintainer of DBI (David A. James [EMAIL PROTECTED], in CC) will certainly fix it. Uwe Ligges __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Automatic re-looping after error
On 09-Oct-03 Thomas Lumley wrote: On Thu, 9 Oct 2003 [EMAIL PROTECTED] wrote: All that's really needed to cope with the situation is for R to drop that cycle of the loop, and resume with a new cycle. However, I'm wondering how to set this up. I've had a look at try(), and I'm not at all sure that it does what I would want. What I'd really like is something (inside the loop) on the lines of on.error(maybe some parameters X) break where X might specify what sort of error or what function it comes from. Would setting options(error = break ) I don't think so. You may need to look at the new exception-handling code (start with help(tryCatch)). Thanks, Thomas. I don't seem to have anything related to this in R-1.7.1 (16/06/03). However, some web-searching finally tracked down http://stat.ethz.ch/R-manual/R-devel/library/base/html/conditions.html so what would be involved in making this stuff available? Upgrade to current R? Install a beta-version? Thanks again, Ted. E-Mail: (Ted Harding) [EMAIL PROTECTED] Fax-to-email: +44 (0)870 167 1972 Date: 11-Oct-03 Time: 10:52:34 -- XFMail -- __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Some teaching/training materials (ESS/ESS-Noweb-Sweave/SNOW)
http://www.analytics.washington.edu/~rossini/courses/cph-statcomp/ Lecture/Labs 1 and 2 are on For ESS, ESS-Noweb-Sweave. Lecture/Lab 4 is on parallel computing with R (each Lecture/Lab was just under 2 hours). Comments/corrections welcome, they were used last week here in Copenhagen, so most of the bugs are out. best, -tony p.s. Lecture/Lab 3 on visualization needs to be completely redone for WWW work; it doesn't translate well (some might say, at all). -- [EMAIL PROTECTED]http://www.analytics.washington.edu/ Biomedical and Health Informatics University of Washington Biostatistics, SCHARP/HVTN Fred Hutchinson Cancer Research Center UW (Tu/Th/F): 206-616-7630 FAX=206-543-3461 | Voicemail is unreliable FHCRC (M/W): 206-667-7025 FAX=206-667-4812 | use Email CONFIDENTIALITY NOTICE: This e-mail message and any attachme...{{dropped}} __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Some R-related teaching/training materials (ESS/ESS-Noweb-Sweave/SNOW)
http://www.analytics.washington.edu/~rossini/courses/cph-statcomp/ Lecture/Labs 1 and 2 are on For ESS, ESS-Noweb-Sweave. Lecture/Lab 4 is on parallel computing with R (each Lecture/Lab was just under 2 hours). Comments/corrections welcome, they were used last week here in Copenhagen, so most of the bugs are out. best, -tony p.s. Lecture/Lab 3 on visualization needs to be completely redone for WWW work; it doesn't translate well (some might say, at all). -- [EMAIL PROTECTED]http://www.analytics.washington.edu/ Biomedical and Health Informatics University of Washington Biostatistics, SCHARP/HVTN Fred Hutchinson Cancer Research Center UW (Tu/Th/F): 206-616-7630 FAX=206-543-3461 | Voicemail is unreliable FHCRC (M/W): 206-667-7025 FAX=206-667-4812 | use Email CONFIDENTIALITY NOTICE: This e-mail message and any attachme...{{dropped}} __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] interpolation methods
Dear, Have a look at: *akima http://cran.r-project.org/src/contrib/akima_0.3-4.tar.gz: Interpolation of irregularly spaced data* Linear or cubic spline interpolation for irregular gridded data Kris -- http://perswww.kuleuven.ac.be/~u0027178/VCard/mycard.php?name=krisn http://gloveg.kuleuven.ac.be/ Minds are like parachutes, they only work when open __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] boot statictic fn for dual estimation of 2 stats?
Hi, I am trying to use boot() to refit an ordinal logit (polr in MASS) model. (A very basic bootstrap which samples from the data frame without replacement and updates the model.) I need to extract two statistics per run (the coefficients and zeta) and I tried concatenating them into a single vector after fitting, but I get the following error: Error in [-(*tmp*, r, , value = statistic(data, i[r, ], ...)) : number of items to replace is not a multiple of replacement length This error goes away if I just return the coefficients, but I need zeta in order to calculate predicted probabilities for each outcome category (1:4 in this case). Alternatively, if boot() could return a vector of predicted probabilities for each categorical outcome, that would work as well, but I don't have a clue as to how to start programming this. Thanks, Olivia Lau Here's some sample data and code: cost - c(4, 3, 2, 2, 2, 2, 2, 2, 1, 2, 1, 2, 2, 4, 3, 1, 2, 2, 1, 3, 2, 1, 4, 1, 1, 2, 2, 2, 1, 3, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, 2, 2, 2, 2, 1, 1, 2, 1, 1, 1, 2, 2, 1, 1, 1, 2, 2, 2, 2, 3, 1, 3, 3, 1, 2, 1, 3, 2, 2, 2, 3, 1, 2, 1, 2, 2, 1, 2) mil - c(1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1) coop - c(4, 2, 1, 1, 1, 1, 2, 1, 2, 2, 1, 1, 3, 3, 3, 1, 4, 3, 1, 3, 4, 1, 1, 1, 1, 3, 1, 1, 1, 4, 1, 1, 1, 1, 2, 3, 1, 1, 1, 2, 2, 2, 1, 2, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 3, 3, 1, 3, 2, 3, 2, 3, 1, 1, 3, 2, 2, 3, 2, 1, 4, 1, 3) sanction - data.frame(cost=cost, mil=mil, coop=coop) est - polr(as.factor(cost) ~ mil + coop, data = sanction) bootfn - function(data, i, object) { d - data[i,] fit - update(object, data = d) c(fit$coef, fit$zeta) } res - boot(sanction, bootfn, R = 10, object = est) __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] boot statictic fn for dual estimation of 2 stats?
Occasionaly, the polr returns a zeta element of length equal to 2 rather than 3 (which I guess is what you're expecting). You're bootfn function should always check to see that it's returning an object of the same length every time. -roger Olivia Lau wrote: Hi, I am trying to use boot() to refit an ordinal logit (polr in MASS) model. (A very basic bootstrap which samples from the data frame without replacement and updates the model.) I need to extract two statistics per run (the coefficients and zeta) and I tried concatenating them into a single vector after fitting, but I get the following error: Error in [-(*tmp*, r, , value = statistic(data, i[r, ], ...)) : number of items to replace is not a multiple of replacement length This error goes away if I just return the coefficients, but I need zeta in order to calculate predicted probabilities for each outcome category (1:4 in this case). Alternatively, if boot() could return a vector of predicted probabilities for each categorical outcome, that would work as well, but I don't have a clue as to how to start programming this. Thanks, Olivia Lau Here's some sample data and code: cost - c(4, 3, 2, 2, 2, 2, 2, 2, 1, 2, 1, 2, 2, 4, 3, 1, 2, 2, 1, 3, 2, 1, 4, 1, 1, 2, 2, 2, 1, 3, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, 2, 2, 2, 2, 1, 1, 2, 1, 1, 1, 2, 2, 1, 1, 1, 2, 2, 2, 2, 3, 1, 3, 3, 1, 2, 1, 3, 2, 2, 2, 3, 1, 2, 1, 2, 2, 1, 2) mil - c(1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1) coop - c(4, 2, 1, 1, 1, 1, 2, 1, 2, 2, 1, 1, 3, 3, 3, 1, 4, 3, 1, 3, 4, 1, 1, 1, 1, 3, 1, 1, 1, 4, 1, 1, 1, 1, 2, 3, 1, 1, 1, 2, 2, 2, 1, 2, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 3, 3, 1, 3, 2, 3, 2, 3, 1, 1, 3, 2, 2, 3, 2, 1, 4, 1, 3) sanction - data.frame(cost=cost, mil=mil, coop=coop) est - polr(as.factor(cost) ~ mil + coop, data = sanction) bootfn - function(data, i, object) { d - data[i,] fit - update(object, data = d) c(fit$coef, fit$zeta) } res - boot(sanction, bootfn, R = 10, object = est) __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] multiple character matching within a string
Hello all, I need to count the number of times certain characters occur in a string. The only way I have found so far to accomplish this is by using strsplit i.e. my.string - DDDRRHIH my.char - D num.char - -1 + length(unlist(strsplit(my.string,my.char))) now you probably won't be surprised if I say that this has proven to be extremely slow (I am not sure exactly why though, is it because strsplit creates new list for every call?). Is there an alternative way to do this short of going to compiled code? many thanks, -- Murad Nayal M.D. Ph.D. Department of Biochemistry and Molecular Biophysics College of Physicians and Surgeons of Columbia University 630 West 168th Street. New York, NY 10032 Tel: 212-305-6884 Fax: 212-305-6926 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] evaluating R expressions from C
Hello! I've looked at R help and previous postings, but I am not sure I completely understand the mechanism of evaluating R expressions from C++. They have function SEXP eval(SEXP expr, SEXP rho), but I can't get it to work. Could anyone who used it give any comments on how efficient it is and, if possible, give example of how to use it. My main problem is that I don't really understand how pass the name of R-function and it's parameters. Thank you, Iryna __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help