Re: [R] Need help with error

2011-03-19 Thread Allan Engelhardt
As it says at the bottom of every post: PLEASE do read the posting guidehttp://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Without an example that fails, it is hard to help. Allan On 18/03/11 16:26, Savitri N Appana wrote: Hi R

Re: [R] How do I delete multiple blank variables from a data frame?

2011-03-19 Thread Allan Engelhardt
On 19/03/11 01:35, Joshua Wiley wrote: Hi Rita, This is far from the most efficient or elegant way, but: ## two column data frame, one all NAs d- data.frame(1:10, NA) ## use apply to create logical vector and subset d d[, apply(d, 2, function(x) !all(is.na(x)))] This works, but apply

Re: [R] [R-sig-ME] lmm WITHOUT random factor (lme4)

2011-03-19 Thread Mark Difford
On Mar 19, 2011; 01:39am Andrzej Galecki wrote: I agree with you that caution needs to be exercised. Simply because mathematically the same likelihood may be defined using different constant. Yes. But this is ensured by the implementation. If the call to anova() is made with the lm$obj first

Re: [R] [O/T] reference for regular expressions

2011-03-19 Thread David Wolfskill
On Fri, Mar 18, 2011 at 09:45:57PM -0500, Erin Hodgess wrote: Dear R People: Could someone recommend a good reference on regular expressions, please? ... Mastering Regular Expressions; Friedl, Jeffrey E. F.; ISBN 9780596528126. Many of the O'Reilly books (as this one) may be purchased in an

Re: [R] Replace split with regex for speed ?

2011-03-19 Thread rivercode
Thanks for your suggestions. Cheers, Chris -- View this message in context: http://r.789695.n4.nabble.com/Replace-split-with-regex-for-speed-tp3386098p3388958.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org

Re: [R] How do I delete multiple blank variables from a data frame?

2011-03-19 Thread Tyler Rinker
I actually prefer to do this portion of the work (data prep) inside of excel. When you export the data as an cvs doc the NA's will be in the excel spreadsheet. Now the search and/or the search and replace option become very handy. Probably a better way in [R] though. Tyler Date: Fri,

Re: [R] Performance Difference? Windows vs. Linux

2011-03-19 Thread Prof Brian Ripley
On Fri, 18 Mar 2011, Shige Song wrote: One thing that Linux makes trivially easy is to interpolate R with C++ through the Rcpp package. The GCC compiler collection is part of all mainstream Linux distro. This is, however, not the case with Windows: you may be able to do it eventually (not sure

Re: [R] Performance Difference? Windows vs. Linux

2011-03-19 Thread Prof Brian Ripley
To try to answer the actual question I run x86_64 Linux and both 32-bit Windows XP and x64 Windows 7 on my home desktop. So from years of experience of using the same hardware on those OSes: 1) Generally Linux will be a bit faster, mainly because I do not hobble it with

Re: [R] [O/T] reference for regular expressions

2011-03-19 Thread Gabor Grothendieck
On Fri, Mar 18, 2011 at 10:45 PM, Erin Hodgess erinm.hodg...@gmail.com wrote: Dear R People: Could someone recommend a good reference on regular expressions, please? There are links to a number of sites on the gsubfn home page: http://gsubfn.googlecode.com/#REGULAR_EXPRESSION_LINKS --

[R] How to find position in bin-data?

2011-03-19 Thread Antje Niederlein
Hi there, probably there is a very simple solution, but I cannot think of one... I have a vector with values: data - c(1,6,3,4,8,4,2,9) and I have a vector with bin breaks: bins - c(1,3,5,7,9,11) Now, I'd like to get for each data point the index of the bin-vector where the value falls in

[R] how to access the elements of a univariate results table with Anova (library car)

2011-03-19 Thread Juan Andres Hernandez
Dear R users, I use the excelent Anova function of the library car because the easy way to get sphericity correction. Unless I use the scan function. I have not been able to access the values ​​of sum squares and degrees of freedom for each effect in the univariate summary table. Example of

Re: [R] How to find position in bin-data?

2011-03-19 Thread Duncan Murdoch
On 11-03-19 8:18 AM, Antje Niederlein wrote: Hi there, probably there is a very simple solution, but I cannot think of one... I have a vector with values: data- c(1,6,3,4,8,4,2,9) and I have a vector with bin breaks: bins- c(1,3,5,7,9,11) Now, I'd like to get for each data point the index

Re: [R] How to find position in bin-data?

2011-03-19 Thread Antje Niederlein
Thanks a lot! That's what I was looking for :-) A On 19 March 2011 13:56, Duncan Murdoch murdoch.dun...@gmail.com wrote: On 11-03-19 8:18 AM, Antje Niederlein wrote: Hi there, probably there is a very simple solution, but I cannot think of one... I have a vector with values: data-

Re: [R] How to find position in bin-data?

2011-03-19 Thread Alexander Engelhardt
Am 19.03.2011 13:18, schrieb Antje Niederlein: Hi there, probably there is a very simple solution, but I cannot think of one... I have a vector with values: data- c(1,6,3,4,8,4,2,9) and I have a vector with bin breaks: bins- c(1,3,5,7,9,11) cut() does what you want: cut(data, bins) [1] NA

[R] cross-validation in rpart

2011-03-19 Thread Penny B
I am trying to find out what type of sampling scheme is used to select the 10 subsets in 10-fold cross-validation process used in rpart to choose the best tree. Is it simple random sampling? Is there any documentation available on this? Thanks, Penny. -- View this message in context:

[R] strange PREDICTIONS from a PIECEWISE LINEAR (mixed) MODEL

2011-03-19 Thread Federico Bonofiglio
Hi Dears, When I introduce an interaciton in a piecewise model I obtain some quite unusual results. If that would't take u such a problem I'd really appreciate an advise from you. I've reproduced an example below... Many thanks x-rnorm(1000) y-exp(-x)+rnorm(1000) plot(x,y)

[R] Plotting graph problem!!

2011-03-19 Thread andrew456
http://r.789695.n4.nabble.com/file/n3389613/Life_Expectancies_2008.csv Life_Expectancies_2008.csv I am trying to plot a histogram base on the file i uploaded above. I am facing a trouble in sorting out the frequency of the life expectancies. I wanted to plot a graph of life expectancies at birth

Re: [R] Generating repeated measures data

2011-03-19 Thread Michael Dewey
At 00:37 19/03/2011, John Sorkin wrote: How would one generate data to be used in a simulation of a repeated measures ANOVA given a known (1) within-person correlation with known (2) mean and SD of data obtained at each of three times of observation? You do not say which distribution you

Re: [R] Extracting columns from a class

2011-03-19 Thread Thomas Levine
Hi, Here is the prcomp output. tom=prcomp(matrix(rnorm(25),5,5)) R functions often output lists. To see what's in this one, run names(tom) or type tom$ and use tab completion. Once you do that, the following is more obvious. pc1=tom$rotation[,1] sd1=tom$sdev[1] column=c(sd1,pc1)

Re: [R] how to access the elements of a univariate results table with Anova (library car)

2011-03-19 Thread David Winsemius
On Mar 19, 2011, at 8:44 AM, Juan Andres Hernandez wrote: Dear R users, I use the excelent Anova function of the library car because the easy way to get sphericity correction. Unless I use the scan function. I have not been able to access the values ​​of sum squares and degrees of

Re: [R] Plotting graph problem!!

2011-03-19 Thread David Winsemius
On Mar 19, 2011, at 9:10 AM, andrew456 wrote: http://r.789695.n4.nabble.com/file/n3389613/Life_Expectancies_2008.csv Life_Expectancies_2008.csv I am trying to plot a histogram base on the file i uploaded above. I am facing a trouble in sorting out the frequency of the life expectancies. I

Re: [R] cross-validation in rpart

2011-03-19 Thread Allan Engelhardt
I assume you mean rpart::xpred.rpart ? The beauty of R means that you can look at the source. For the simple case (where xval is a single number) the code does indeed do simple random sampling xgroups- sample(rep(1:xval, length = nobs), nobs, replace = FALSE) If you want another sampling,

[R] persuade tabulate function to count NAs in a data frame

2011-03-19 Thread Bodnar Laszlo EB_HU
Hi, I'd like to ask you a question again. It is basically about data frames, NAs and tabulate function. I have this data frame. I already used this in one of the previous questions of mine. It intentionally looks this simple, my real 'df' dataframe is much bigger actually and again, I am not

Re: [R] Plotting graph problem!!

2011-03-19 Thread Allan Engelhardt
You should probably tell us which part of a- read.csv(http://r.789695.n4.nabble.com/file/n3389613/Life_Expectancies_2008.csv;) hist(a) doesn't do what you expect. (Though often when people say histogram they want something else - what's with that anyhow?) Allan On 19/03/11 13:10,

Re: [R] cross-validation in rpart

2011-03-19 Thread Prof Brian Ripley
On Sat, 19 Mar 2011, Penny B wrote: I am trying to find out what type of sampling scheme is used to select the 10 subsets in 10-fold cross-validation process used in rpart to choose the best tree. Is it simple random sampling? Is there any documentation available on this? Not SRS (and least

Re: [R] persuade tabulate function to count NAs in a data frame

2011-03-19 Thread Gavin Simpson
On Sat, 2011-03-19 at 15:58 +0100, Bodnar Laszlo EB_HU wrote: Hi, I'll top-post as the original Q is very lengthy: tabs -lapply(df[,2:6], function(x, id){ t(table(addNA(x), id, useNA = ifany)) }, df$id) is one way of doing what you want. More details are here:

Re: [R] Plotting graph problem!!

2011-03-19 Thread Allan Engelhardt
On 19/03/11 15:04, Allan Engelhardt wrote: You should probably tell us which part of a- read.csv(http://r.789695.n4.nabble.com/file/n3389613/Life_Expectancies_2008.csv;) hist(a) Should be hist(a$Life.Expectancies.at.Birth), of course. Sorry. doesn't do what you expect. (Though often

Re: [R] Plotting graph problem!!

2011-03-19 Thread andrew456
data1-read.delim(C:\\Users\\wenyin\\desktop\\Life_Expectancies_2008.txt,header=T) attach(data1) names(data1) table(Life.Expectancies.at.Birth) so this thing showed up: Life.Expectancies.at.Birth 42 46 47 48 49 50 51 52 53 54 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 2 2 1 4 4 1

Re: [R] Plotting graph problem!!

2011-03-19 Thread andrew456
I assigned the dataset to data1,then i tried typing hist(data1),it says: Error in hist.default(data1) : 'x' must be numeric how can I change the Locations to frequency so that it is in numeric form and I can plot the histogram? You should probably tell us which part of a-

[R] Could you share your R program to import US CDC mortality data?

2011-03-19 Thread Renny Li
Hello - I downloaded yearly mortality (all cause) data from CDC website. But have trouble to import them into R, have you worked with CDC mortality data before? I would appreciate it if you could share your R code on importing the data into R. Thanks, Renny [[alternative

Re: [R] Could you share your R program to import US CDC mortality data?

2011-03-19 Thread David Winsemius
On Mar 19, 2011, at 12:03 PM, Renny Li wrote: Hello - I downloaded yearly mortality (all cause) data from CDC website. You should offer a specific URL. The CDC website is huge and there are undoubtedly many places where various forms of such data are available. But have trouble to

[R] Libraries issue

2011-03-19 Thread Ben Ward
Hi, I've just discovered R keeps installing my packages into C:\Users\Ben instead of C:\\Users\\Ben;/R/win-library/2.12 which is what is returned by running Sys.getenv(R_LIBS_USER). I've tried setting environment variables in windows control panel of R_LIBS. But nothing seems to be working,

Re: [R] quantmod Some Single Letter Tickers Not getFin

2011-03-19 Thread Joshua Ulrich
Hi John, The financial statement pages exist, but they require the exchange to be specified. For example: http://www.google.com/finance?fstype=iiq=NYSE:GE and http://www.google.com/finance?fstype=iiq=GE take you to the same page, but http://www.google.com/finance?fstype=iiq=NYSE:F works, while

Re: [R] Libraries issue

2011-03-19 Thread Joshua Wiley
Hi Ben, I could be completely off target (corrections welcome if I am), but I think the semicolon in the environment variable is making two separate paths and maybe R chooses the first? It should be easy to try changing. HTH, Josh (and sorry for the wild goose hunt if my memory is shoddy) On

[R] GAMLSS Question

2011-03-19 Thread YAddo
Dear All: I have succeeded in fitting a GAMLSS.dist model to growth data I am working with it. My aim is to create a matrix of predicted percentiles and the corresponding the fitted model's sigma mu nu by agebins. Q: How do it generate these parameters as in L M S per Cole and Green 1992?

Re: [R] Plotting graph problem!!

2011-03-19 Thread andrew456
Thanks a lot for teaching me!!! By the way,one more question,how do i plot a boxplot of that?? On 19/03/11 15:04, Allan Engelhardt wrote: You should probably tell us which part of a- read.csv(http://r.789695.n4.nabble.com/file/n3389613/Life_Expectancies_2008.csv;) hist(a) Should be

[R] How would you avoid loops in this simple example?

2011-03-19 Thread zerfetzen
I'm trying to code more R-like and avoid loops. Here is an example I'm having a hard time getting away from loops with, and the real matrices are rather large, and the computation is too time-consuming. ### Dimensions N - 2 M - 3 P - 4 ### Array and Matrices nu - array(NA,dim=c(N,M,P)) Lambda -

[R] Output a table formatted with standard deviations below means

2011-03-19 Thread Nathan Torrance
Is it in bad form to double post to StackOverflow and R-help? Apologies if so. Here's my task: I've got a matrix of means like so means-matrix(1:10,nrow=2) colnames(means)-c(a,b,c,d,e) and a matrix of standard deviations like so sds-matrix(seq(0.1,1,by=0.1),nrow=2) colnames(sds)-c(a,b,c,d,e)

Re: [R] Output a table formatted with standard deviations below means

2011-03-19 Thread Jorge Ivan Velez
Hi Nathan, Do not know a direct way, but the following seems to work: # data means - matrix(1:10,nrow=2) sds - matrix(seq(0.1,1,by=0.1),nrow=2) colnames(means) - colnames(sds) - c(a,b,c,d,e) # adding ( ) to the SDs sdsn - t(apply(sds, 1, function(x) paste('(', x, ')', sep = ))) # formatting

Re: [R] Output a table formatted with standard deviations below means

2011-03-19 Thread David Winsemius
On Mar 19, 2011, at 12:13 PM, Nathan Torrance wrote: Is it in bad form to double post to StackOverflow and R-help? Apologies if so. Here's my task: I've got a matrix of means like so means-matrix(1:10,nrow=2) colnames(means)-c(a,b,c,d,e) and a matrix of standard deviations like so

Re: [R] How would you avoid loops in this simple example?

2011-03-19 Thread Joshua Wiley
Hi, You are basically just doing matrix multiplication, which R has some built in, optimized functions for. You can see the documentation at ?matmult This gets you part of the way there. I suspect you can even avoid the last loop if you know enough about linear algebra and how to use some

Re: [R] Libraries issue

2011-03-19 Thread peter dalgaard
On Mar 19, 2011, at 17:37 , Ben Ward wrote: Hi, I've just discovered R keeps installing my packages into C:\Users\Ben instead of C:\\Users\\Ben;/R/win-library/2.12 which is what is returned by running Sys.getenv(R_LIBS_USER). Er, I'm rusty on Windows, but that's what it is supposed to

[R] som package: the code of som.train (what is it?)

2011-03-19 Thread Nesnàju
Hi to all, I am new in the forum, and also in using R (with Rkward in Kubuntu). I have a little problem with the som package: I do the first steps (som.init and som), but when I have to do the train [ som.train(data, code, xdim, ydim, alpha=NULL, alphaType=inverse, neigh=gaussian, topol=rect,

[R] problem running a function

2011-03-19 Thread garciap
Dear people, I'm trying to do some analysis of a data using the models by Royle Donazio in their fantastic book, particular the following function: http://www.mbr-pwrc.usgs.gov/pubanalysis/roylebook/panel4pt1.fn that applied to my data and in the console is as follows: `desman.y` -

Re: [R] Problem in installing and starting Rattle

2011-03-19 Thread Tony Plate
On Mon, Mar 7, 2011 at 6:57 AM, nerice neil.r...@plymouth.ac.uk wrote: CHECK FOR CONFLICTS IN YOUR PATH !!! I had a related problem when trying to use library RGtk2 for the first time.  My problem was that when loading the library R was looking for the file zlib1.dll but couldn't find the

Re: [R] Libraries issue

2011-03-19 Thread Henrik Bengtsson
Hi. On Sat, Mar 19, 2011 at 12:17 PM, peter dalgaard pda...@gmail.com wrote: On Mar 19, 2011, at 17:37 , Ben Ward wrote: Hi, I've just discovered R keeps installing my packages into C:\Users\Ben instead of C:\\Users\\Ben;/R/win-library/2.12 which is what is returned by running

Re: [R] R newbie: how to replace string/regular expression

2011-03-19 Thread eben
I would read up on the 'gsub' command in R help. It does what you would like. -- View this message in context: http://r.789695.n4.nabble.com/R-newbie-how-to-replace-string-regular-expression-tp873169p3390170.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] problem running a function

2011-03-19 Thread Phil Spector
Try RN() - Phil Spector Statistical Computing Facility Department of Statistics UC Berkeley

Re: [R] How would you avoid loops in this simple example?

2011-03-19 Thread Petr Savicky
On Sat, Mar 19, 2011 at 10:27:11AM -0700, zerfetzen wrote: I'm trying to code more R-like and avoid loops. Here is an example I'm having a hard time getting away from loops with, and the real matrices are rather large, and the computation is too time-consuming. ### Dimensions N - 2 M - 3

Re: [R] GAMLSS Question

2011-03-19 Thread Tóth Dénes
Hi, predictAll should do what you want. See ?predict.gamlss. HTH, Denes Dear All: I have succeeded in fitting a GAMLSS.dist model to growth data I am working with it. My aim is to create a matrix of predicted percentiles and the corresponding the fitted model's sigma mu nu by

Re: [R] Libraries issue

2011-03-19 Thread Ben Ward
Hi, Got it fixed now, thanks everyone, still confused as to why it's never done that before, but at least it's fine now. Ben W. On 19/03/2011 19:38, Henrik Bengtsson wrote: Hi. On Sat, Mar 19, 2011 at 12:17 PM, peter dalgaardpda...@gmail.com wrote: On Mar 19, 2011, at 17:37 , Ben Ward

Re: [R] problem running a function

2011-03-19 Thread Ben Bolker
garciap garciap at usal.es writes: Dear people, I'm trying to do some analysis of a data using the models by Royle Donazio in their fantastic book, particular the following function: http://www.mbr-pwrc.usgs.gov/pubanalysis/roylebook/panel4pt1.fn [snip] I'm guessing you're fairly

[R] Problems using NLS in conjunction with non-parameteric bootstrapping

2011-03-19 Thread mweckel
Hello, I have been successfully using nls to fit a non-linear, self-limiting function to several sets of data collected in 2010 (example found below). To generate confidence intervals for parameter estimates, I've been attempting to bootstrap my sample. Unfortunately, I have meet with

[R] create a matrix with values from data.frame

2011-03-19 Thread Nicolas Gutierrez
Hello, I'm trying to create a matrix (95x55) with data from a data.frame pop: xloc yloc go indEne totW 123 20 516 1 0.02 20.21 223 20 1143 1 0.02 20.21 323 20 250 1 0.02 20.21 422 15 251 1 0.02 18.69 522 15

Re: [R] persuade tabulate function to count NAs in a data frame

2011-03-19 Thread Jim Lemon
On 03/20/2011 01:58 AM, Bodnar Laszlo EB_HU wrote: Hi, I'd like to ask you a question again. It is basically about data frames, NAs and tabulate function. Hi Bodnar, The freq function in the prettyR package might do what you want. Jim __

Re: [R] create a matrix with values from data.frame

2011-03-19 Thread David Winsemius
On Mar 19, 2011, at 5:29 PM, Nicolas Gutierrez wrote: Hello, I'm trying to create a matrix (95x55) with data from a data.frame pop: xloc yloc go indEne totW 123 20 516 1 0.02 20.21 223 20 1143 1 0.02 20.21 323 20 250 1 0.02 20.21 4

Re: [R] create a matrix with values from data.frame

2011-03-19 Thread jim holtman
Here is one way to fill in the value using indexing; it appears that you data has the same xloc/yloc values x xloc yloc go ind Ene totW 1 23 20 516 1 0.02 20.21 2 23 20 1143 1 0.02 20.21 3 23 20 250 1 0.02 20.21 4 22 15 251 1 0.02 18.69 5 22 15 598 1 0.02

Re: [R] Plotting graph problem!!

2011-03-19 Thread Jim Lemon
On 03/20/2011 04:33 AM, andrew456 wrote: Thanks a lot for teaching me!!! By the way,one more question,how do i plot a boxplot of that?? Hi Andrew, As you seem to be an R newbie and some of the replies may have been cryptic to a newbie, try this: boxplot(a$Life.Expectancies.at.Birth) To

Re: [R] create a matrix with values from data.frame

2011-03-19 Thread Nicolas Gutierrez
Thanks Jim and David.. that was easy! Nic On 3/19/2011 3:00 PM, jim holtman wrote: x.mat- matrix(NA, 95, 55) # create matrix x.mat[cbind(x$xloc, x$yloc)]- x$totW which(!is.na(x.mat), arr.ind =TRUE) __ R-help@r-project.org mailing list

[R] I want to create an object to use for the plot command

2011-03-19 Thread AOLeary
I'm using the TSA package (along with all prerequisites) to do some GARCH work and for some reason, something which used to work for me has decided to up and stop. The code is as follows, after loading the package: gs - garch.sim(alpha=c(1.9,0.1), beta=c(0.71, -0.083, -0.016),rnd =

[R] Referring to objects themselves

2011-03-19 Thread Russ Abbott
Is it possible to refer to an object from within a method, as in *this *in Java? I can't find anything about this in the documentation. Sorry if I missed it. Thanks. *-- Russ Abbott* *_* *** Professor, Computer Science* * California State

Re: [R] I want to create an object to use for the plot command

2011-03-19 Thread David Winsemius
On Mar 19, 2011, at 7:02 PM, AOLeary wrote: I'm using the TSA package (along with all prerequisites) to do some GARCH work and for some reason, something which used to work for me has decided to up and stop. The code is as follows, after loading the package: gs -

Re: [R] Referring to objects themselves

2011-03-19 Thread Gabor Grothendieck
On Sat, Mar 19, 2011 at 6:34 PM, Russ Abbott russ.abb...@gmail.com wrote: Is it possible to refer to an object from within a method, as in *this *in Java?  I can't find anything about this in the documentation.  Sorry if I missed it. Assuming you are referring to S3, the first argument to a

Re: [R] I want to create an object to use for the plot command

2011-03-19 Thread AOLeary
Hm, thank you David, that is a good point. I'm trying to model it as a white noise model, essentially. Now that I think of it there's probably an easier way to do this that I haven't thought of yet. I was trying it this way based on something I'd remembered reading from Engle's original paper

Re: [R] Referring to objects themselves

2011-03-19 Thread Russ Abbott
Actually, I guess I'm not really talking about objects. I was looking through the scoping demo. It uses this function. open.account - function(total) { + + list( +deposit = function(amount) { +if(amount = 0) +stop(Deposits must be positive!\n) +

[R] How to draw a map of Europe?

2011-03-19 Thread Sally Luo
Hi R users, I need to draw a map of select European countries with country names shown on the map. Does anyone know how to do this in R? Also, is it possible to draw a historical map of European countries using R? Thanks a lot for your help. Maomao [[alternative HTML version

Re: [R] Referring to objects themselves

2011-03-19 Thread Janko Thyson
You might want to check out Reference Classes (?SetRefClass). The object itself is stored in '.self' and can be referenced that way. HTH, Janko -Ursprüngliche Nachricht- Von: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] Im Auftrag von Russ Abbott Gesendet: Samstag,

Re: [R] Referring to objects themselves

2011-03-19 Thread Gabor Grothendieck
On Sat, Mar 19, 2011 at 8:02 PM, Russ Abbott russ.abb...@gmail.com wrote: Actually, I guess I'm not really talking about objects. I was looking through the scoping demo. It uses this function. open.account - function(total) { + +     list( +        deposit = function(amount) { +        

Re: [R] Referring to objects themselves

2011-03-19 Thread Kenn Konstabel
You could (in addition to the other suggestions) try package proto (. refers to self but see also the package's vignette) account - proto( deposit = function(., amount) { if(amount = 0) stop(Deposits must be positive!\n) .$total - .$total + amount

Re: [R] How to draw a map of Europe?

2011-03-19 Thread Mike Marchywka
Date: Sat, 19 Mar 2011 19:32:43 -0500 From: shali...@gmail.com To: r-help@r-project.org Subject: [R] How to draw a map of Europe? Hi R users, I need to draw a map of select European countries with country names shown on the map. Does anyone

[R] Problems with package npmc

2011-03-19 Thread carloskij
Hi there, I am having a problem with package npmc. If I use the included datasets (brain, kronen) everything is fine, but if I try and use my dataset I receive an error message: Error in probval.GenzBretz(algorithm, n, df, lower, upper, infin, corr, : NAs in foreign function call (arg 2) In

Re: [R] Referring to objects themselves

2011-03-19 Thread Bert Gunter
See also the proto package, I believe. -- Bert On Sat, Mar 19, 2011 at 5:51 PM, Janko Thyson janko.thyson.rst...@googlemail.com wrote: You might want to check out Reference Classes (?SetRefClass). The object itself is stored in '.self' and can be referenced that way. HTH, Janko

Re: [R] Referring to objects themselves

2011-03-19 Thread Russ Abbott
Thanks for all the suggestions. I realize that this isn't the most important thing in the world -- and as a newcomer to R I gather it's not the way most people use R anyway. But I tried to do what looked like the simplest suggestion. open.account.2 - function(total) { this - environment()

Re: [R] How to draw a map of Europe?

2011-03-19 Thread David Winsemius
On Mar 19, 2011, at 8:32 PM, Sally Luo wrote: Hi R users, I need to draw a map of select European countries with country names shown on the map. Does anyone know how to do this in R? Adding a tiny bit to the material produced from a search and finding something from Roger Bivand in

Re: [R] Referring to objects themselves

2011-03-19 Thread Kenn Konstabel
you can omit the list and do the following: open.account.2 - function(total) { deposit - function(amount) { if(amount = 0) stop(Deposits must be positive!\n) total - total + amount cat(amount, deposited. Your balance is, this$balance(),\n\n)

Re: [R] Part of a density plot

2011-03-19 Thread Jim Silverton
Suupose I have y - rbeta(1, 2, 5) and I only want to see only the density plot from x = 0 to x = 1 How do I do this? -- Thanks, Jim. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list

Re: [R] Referring to objects themselves

2011-03-19 Thread Kenn Konstabel
On Sun, Mar 20, 2011 at 4:13 AM, Kenn Konstabel lebats...@gmail.com wrote: you can omit the list and do the following: /.../ (but you don't really need this in this case as you can use balance instead of this$balance) P.S. using this would make some difference in one case: instead of

Re: [R] How would you avoid loops in this simple example?

2011-03-19 Thread zerfetzen
Thanks for the help, and now I have some functions to learn. Both suggestions work great, really appreciate it. -- View this message in context: http://r.789695.n4.nabble.com/How-would-you-avoid-loops-in-this-simple-example-tp3390017p3390549.html Sent from the R help mailing list archive at

Re: [R] How to draw a map of Europe?

2011-03-19 Thread Spencer Graves
I've created historical maps using R, but it required careful research, translating the boundaries into longitude and latitude shape files, then plotting them, similar to the example that David just provided. It seemed to be the easiest way I knew to produce the desired result, but it

Re: [R] Part of a density plot

2011-03-19 Thread Ravi Varadhan
Take a look at pvladens() function in bootruin package. Ravi. Ravi Varadhan, Ph.D. Assistant Professor, Division of Geriatric Medicine and Gerontology School of Medicine Johns Hopkins University Ph. (410) 502-2619 email:

Re: [R] Part of a density plot

2011-03-19 Thread Peter Ehlers
On 2011-03-19 19:15, Jim Silverton wrote: Suupose I have y- rbeta(1, 2, 5) and I only want to see only the density plot from x = 0 to x = 1 How do I do this? I'm not quite sure what you want, but this may be it: plot(density(y), xlim = c(0, 1), xaxs = 'i') Peter Ehlers

Re: [R] Referring to objects themselves

2011-03-19 Thread Russ Abbott
Wonderful! Thanks. I think I've got it. You can even put this - environment() at the top as long as this is returned at the end. I gather that the environment keeps accumulating elements even though it is assigned to 'this' at the beginning. I had thought that $ worked only on lists,

Re: [R] Referring to objects themselves

2011-03-19 Thread Gabor Grothendieck
On Sat, Mar 19, 2011 at 9:45 PM, Russ Abbott russ.abb...@gmail.com wrote: Thanks for all the suggestions. I realize that this isn't the most important thing in the world -- and as a newcomer to R I gather it's not the way most people use R anyway. But I tried to do what looked like the

Re: [R] Problems with package npmc

2011-03-19 Thread Peter Ehlers
On 2011-03-19 17:27, carloskij wrote: Hi there, I am having a problem with package npmc. If I use the included datasets (brain, kronen) everything is fine, but if I try and use my dataset I receive an error message: So somehow your own dataset does not comply with the requirements of npmc.

Re: [R] Referring to objects themselves

2011-03-19 Thread Henrik Bengtsson
For most standard things we do in R, one do not need this feature. R is a functional language. Everything is passed around as pass-by-value (but in a smart way so that under the hood you get pass-by-reference in most cases). Reference variables become useful first when you for instance have

Re: [R] Referring to objects themselves

2011-03-19 Thread Russ Abbott
Actually I'm a big Haskell fan. So I think of functional programming very positively. However, the environment() function doesn't seem to be treated functionally. If I write this - environment() at the top of the previous example, the other functions and the variables they are bound to are

Re: [R] Referring to objects themselves

2011-03-19 Thread Gabor Grothendieck
On Sun, Mar 20, 2011 at 12:10 AM, Russ Abbott russ.abb...@gmail.com wrote: Actually I'm a big Haskell fan. So I think of functional programming very positively.  However, the environment() function doesn't seem to be treated functionally.  If I write    this - environment() at the top of the

[R] R as a non-functional language

2011-03-19 Thread Russ Abbott
I'm reading Torgo (2010) *Data Mining with R*http://www.liaad.up.pt/~ltorgo/DataMiningWithR/code.htmlin preparation for a class I'll be teaching next quarter. Here's an example that is very non-functional. pH - c(4.5,7,7.3,8.2,6.3) names(pH) - c('area1','area2','mud','dam','middle') pH area1

Re: [R] R as a non-functional language

2011-03-19 Thread Gabor Grothendieck
On Sun, Mar 20, 2011 at 12:20 AM, Russ Abbott russ.abb...@gmail.com wrote: I'm reading Torgo (2010) *Data Mining with R*http://www.liaad.up.pt/~ltorgo/DataMiningWithR/code.htmlin preparation for a class I'll be teaching next quarter.  Here's an example that is very non-functional. pH -

Re: [R] R as a non-functional language

2011-03-19 Thread Bill.Venables
The idiom I prefer is pH - structure(c(4.5,7,7.3,8.2,6.3), names = c('area1','area2','mud','dam','middle')) -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Gabor Grothendieck Sent: Sunday, 20 March 2011 2:33 PM

Re: [R] R as a non-functional language

2011-03-19 Thread Russ Abbott
I'm afraid I disagree. As a number of people have shown, it's certainly possible to get the end result pH - c(4.5,7,7.3,8.2,6.3) names(pH) - c('area1','area2','mud','dam','middle') pH area1 area2muddam middle 4.57.07.38.26.3 using a single expression. But what

[R] Using the Mahalanobis Function

2011-03-19 Thread Tyler Rinker
Hello all, I am a 2 month newbie to R and am stumped. I have a data set that I've run multivariate stats on using the manova function (I included the data set). Now it comes time for a table of effect sizes with significance. The univariate tests are easy. Where I run into trouble