Re: [R] s language version and complie languages
On Sun, 24 Sep 2006, Taka Matzmoto wrote: Hi R users Which version of S does the current R version use? Venables and Ripley's book (2000) says R is version 3 of S language. Is there any change since 2000 ? Yes, the 'methods' package implements much of the changes in S version 4, and there are quite a few nods to S4 elsewhere in the code. That is mentioned in the on-line errata files. I searched R-help archive for using C or C++ with R. Although there are some postings, I am looking for up-to-date answers. Which one ( C and C++) works better with R? What complier is the best suited for R ( gcc or visual c++ or others)? You seem to be assuming Windows. The recommended compiler (MinGW gcc) and toolset work best. If you write C++, you need to use a C++ compiler, but remember that C++ is not binary compatible across compilers (or even compiler versions) and also that you need to use C bindings. If you don't need C++ features, use a C compiler. -- 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 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Fitdistr() versus nls()
On Sat, 23 Sep 2006, Luca Telloli wrote: Hello R-Users, I'm new to R so I apologize in advance for any big mistake I might be doing. I'm trying to fit a set of samples with some probabilistic curve, and I have an important question to ask; in particular I have some data, from which I calculate manually the CDF, and then I import them into R and try to fit: I have the x values (my original samples) and the y values (P(Xx)). To attempt the fit I've both fitdistr() and nls(), in the way you can read in the piece of code at the end of the email. Because the fit with all data doesn't work very well, I decided to take a subset of samples randomly chosen (for some random x, the correspondant y is chosen). The first big problem is that fitdistr and nls, in the way I use them in the code, they don't get me similar results. I think I'm making a mistake but I can't really understand which one. From this first issue, a second one arises because the plot with nls is similar (maybe not a great fit bust still...) to my original CDF while the plot of fitdistr is basically a straight line of constant value y=1. On the other side, the fitdistr outperforms in the Kolmogorov-Smirnov test, which for nls has values of probability around 0 (not a good score huh?). Can u please tell me if there's a major mistake in the code? Yes: you fit distribution models to x, not to the CDF of x. So the call to fitdistr and those to ks.test should be of somevals.x not somevals.y. Using nls here is fitting an exponentional to the CDF by least-squares. This is not very sensible for an exponentional distribution where the MLE is known in closed form. Using a KS test after estimating parameters is invalid unless you make adjustments (ks.test does not), and suitable adjustments are AFAIK only known for ML estimation. (The help page does say so and point you to the literature.) Thanks in advance, Luca -- BEGINNING OF CODE cdf.all=read.table(all_failures.cdf, header=FALSE, col.names=c (ttr, cdf), sep=: ) allvals.x=array(t(cdf.all[1])) allvals.y=array(t(cdf.all[2])) What is the intention here? I suspect you want cdf.all[[1]] etc. library(MASS) bestval.exp.nls=bestval.exp.fit=-1 plot(allvals.x, allvals.y) for(it in 1:100){ #extract random samples random=sort(sample(1:length(allvals.x), 15)) somevals.x=allvals.x[c(random)] somevals.y=allvals.y[c(random)] #fit with nls and fitdistr fit.exp = fitdistr(somevals.y, exponential) nls.exp - nls(somevals.y ~ pexp(somevals.x, rate), start=list(rate=. 0001), model=TRUE) #plot what you get out of the two fits lines(allvals.x, pexp(allvals.x, coef(fit.exp)), col=it) lines(allvals.x, pexp(allvals.x, coef(nls.exp)), col=it) #perform kolmogorov-smirnov test on your fit ks.exp.nls = ks.test(somevals.y, pexp, coef(nls.exp)) ks.exp.fit = ks.test(somevals.y, pexp, coef(fit.exp)) bestval.exp.fit = max(bestval.exp.fit, ks.exp.fit$p.value) bestval.exp.nls = max(bestval.exp.nls, ks.exp.nls$p.value) } print(bestval.exp.fit) print(bestval.exp.nls) --END OF CODE -- 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 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] problem with summary of data
Looks like I've missed out the 'as.is' argument, I put it in and everything was alright! Thank you so much! In addition,there're a few .rda files that I've got that I would like to view as file perse. How do I open it because when I tried opening it with Notepad, it came out as unrecognised symbols. Thanx again. Peter Dalgaard wrote: David Barron [EMAIL PROTECTED] writes: You haven't shown the command you used to input the data, but it looks as though you haven't told R not to convert the input into factors. Looks even more like R wasn't told that the first line of data was the variable names. summary on factors shows the frequencies of the levels for each variable, which is what your output shows. See ?read.table for how to prevent conversion into factors. And possibly also the Data Import/Export manual. On 23/09/06, Nel N. [EMAIL PROTECTED] wrote: Greetings everybody, I'm new with R and I'm trying to do some statistical analysis with R using my data. It is a DNA microarray data with 69 samples(row) and 7070 (column) variables. I read the file using the command 'file.table' and it can be done with no error.However, when I tried running a summary of the data, the result was not what I had expected. Below is an extract of the result. And I knew that the command summary will give a summary of a data's descriptive statistics such as it's median,mean,etc.So , what i want is the statistics summary of each gene (in each column). V7065 V7066V7067V7068V7069 20 :29 20 :69 117: 2 39 : 6 20 :69 25 : 4 X16699_at: 1 134: 2 42 : 4 L49218_f_at: 1 30 : 4 142: 2 44 : 4 23 : 3 170: 2 46 : 4 26 : 3 203: 2 38 : 3 21 : 2 96 : 2 58 : 3 (Other):25 (Other):58 (Other):46 V7070V7071 30 : 5 20 :69 21 : 4 Z78285_f_at: 1 51 : 4 64 : 4 27 : 3 36 : 3 (Other):47 My data is in .dat format. Also, I have downloaded a few .rda files to be tried out with R but how do I view them as data per se, like the .dat file can be viewed and edited using Notepad, how about the .rda files? I express my greatest appreciation all who help. Thank you. -- View this message in context: http://www.nabble.com/problem-with-summary-of-data-tf2322882.html#a6462497 Sent from the R help mailing list archive at Nabble.com. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- = David Barron Said Business School University of Oxford Park End Street Oxford OX1 1HP [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- O__ Peter Dalgaard ?ster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- View this message in context: http://www.nabble.com/problem-with-summary-of-data-tf2322882.html#a6470251 Sent from the R help mailing list archive at Nabble.com. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Power analysis for repeated measures ANCOVA
I haven't seen a reply to this post, and you may have moved beyond this question by now, but I will nevertheless offer one brief question: Have you looked at 'simulate.lme'? This might simplify coding your power analysis. Hope this helps. Spencer Graves Steve Su wrote: Dear All, I wonder if anyone has written a code for power analysis with repeated measures ANCOVA? I am aware of the following reference: Frison L and Pocock SJ: Repeated Measures in Clinical Trials: analysis using mean summary statistics and its implications for design in Statistics in Medicine, 1992, 11:1685-1704. Statistics in Medicine It will probably be fairly easy to code this up or even work on this from scratch, but it would be good if people have already done this and can share their code. Thanks. Steve. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] plotCI
Hi R masters! I need a Help with plot confidence intervals for one equation. I use library gplots and plotCI command in this script: require(gplots) ano -1980:2002 rf-exp(91.37162-0.04720281*ano) ciw.f-sqrt(1.766073e-08) plotCI(ano,rf,uiw=ciw.f) But in the graph not shown the errors bar and I have this error msg zero-length arrow is of indeterminate angle and so skipped Well, where is my eror? Thanks in advance Bernardo Rangel Tura, MD, PhD National Institute of Cardiology Laranjeiras Rio de Janeiro Brazil __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] plotCI
As the warnings (not errors) suggest, the error bars are just too small to plot. On 24/09/06, Bernardo Rangel tura [EMAIL PROTECTED] wrote: Hi R masters! I need a Help with plot confidence intervals for one equation. I use library gplots and plotCI command in this script: require(gplots) ano -1980:2002 rf-exp(91.37162-0.04720281*ano) ciw.f-sqrt(1.766073e-08) plotCI(ano,rf,uiw=ciw.f) But in the graph not shown the errors bar and I have this error msg zero-length arrow is of indeterminate angle and so skipped Well, where is my eror? Thanks in advance Bernardo Rangel Tura, MD, PhD National Institute of Cardiology Laranjeiras Rio de Janeiro Brazil __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- = David Barron Said Business School University of Oxford Park End Street Oxford OX1 1HP [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Data frames questions
-Original Message- From: X.H Chen [mailto:[EMAIL PROTECTED] Sent: Sunday, September 24, 2006 12:16 AM To: [EMAIL PROTECTED]; r-help@stat.math.ethz.ch Subject: Re: [R] Data frames questions 1) Is there a way to build an empty data frame, containing nothing but the data frame variable names? Yes, you can do it one way as followings: df1-as.data.frame(matrix(nrow=2,ncol=2),row.names=c(R1,R2)) This results in a dataframe with two rows and two columns NA in it. In order to build an empty dataframe one you could use: df1 - data.frame( X1=1, x2=3, l1=TRUE, d3=as.Date(2003-07-14) )[NULL,] str( df1 ) The key is the NULL for the rows, it removes the data but keeps the content. Best, Bendix -- Bendix Carstensen Senior Statistician Steno Diabetes Center Niels Steensens Vej 2 DK-2820 Gentofte Denmark tel: +45 44 43 87 38 mob: +45 30 75 87 38 fax: +45 44 43 07 06 [EMAIL PROTECTED] www.biostat.ku.dk/~bxc -- (snip) __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] plotCI
Bernardo Rangel tura wrote: Hi R masters! I need a Help with plot confidence intervals for one equation. I use library gplots and plotCI command in this script: require(gplots) ano -1980:2002 rf-exp(91.37162-0.04720281*ano) ciw.f-sqrt(1.766073e-08) plotCI(ano,rf,uiw=ciw.f) But in the graph not shown the errors bar and I have this error msg zero-length arrow is of indeterminate angle and so skipped Well, where is my eror? Hi Bernardo, As David Barron said, the error bars are very small. However, the plotCI function in the plotrix package will produce a graph for you. Jim __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Complex survey analysis help
Hi dear all, I have a complex survey data to analyse. I have a stratified survey with three stages level. The first stage is a PPS, but all other are SRSWOR. The solution propose in survey package is to considere PPS as SRS with repetion. I have try this E3stage-svydesign(ids=~stage1id+stage2id+stage3id, fpc=~fpc1+fpc2+fpc3, ...) This is the value for WOR sampling at all stage. What value should I give to fpc1 to have the same value of variance that in sampling with repetion ? I try fpc1-rep(0,length(data)) I get a error message. Sincerly ! Excuse me for my poor english level, I'm a french speaker. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] R contractor Needed - Atlanta GA
Hello, need an R contractor to help on a project, project requires a strong econometrics background, especially package MSBVAR, LME, and the ASSIST packages. We need to estimate some models and produce a user interface to enable simulation of these models. Please email me if your interested and can work on this for 2-3 months. -zubin __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Statitics Textbook - any recommendation?
How about this book by Julian Faraway. http://www.stat.lsa.umich.edu/~faraway/book/ It covers only regression and anova, but I really like the book. It gives a good overview of the important topics in linear regression and anova. Also it is on the web and hence free. Ritwik On 9/22/06, Wolfgang Lindner [EMAIL PROTECTED] wrote: Iuri Gavronski schrieb: Other text I am trying to find is multivariate data analysis (EFA, cluster, mult regression, MANOVA, etc.) with examples with R. Hi Iuri, for your second answer I would recommend B. Everitt: An R and S-PLUS Companion to Multivariate Analysis. Springer 2005. isbn 1-85233-882-2. Best Wolfgang -- privat: Wolfgang Lindner, Stieglitzweg 6, D-42799 Leichlingen __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Ritwik Sinha Graduate Student Epidemiology and Biostatistics Case Western Reserve University http://darwin.cwru.edu/~rsinha __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Data frames questions
On 9/23/06, X.H Chen [EMAIL PROTECTED] wrote: 1) Is there a way to build an empty data frame, containing nothing but the data frame variable names? Yes, you can do it one way as followings: df1-as.data.frame(matrix(nrow=2,ncol=2),row.names=c(R1,R2)) 2) Is there a way to reorder the variables in a data frame, e.g. When I go to write out a data frame using write.table or write.matrix, I want the output in a certain order... df2-as.data.frame(matrix(1:4,nrow=2,ncol=2),row.names=c(R3,R4)) df2-df2[c(2,1),] I understood the question to be asking how to rearrange the variables (i.e. columns of the data frame) instead of the rows (observations). The same technique can be used but with the reordering vector on the right hand side of the comma. If you have named columns it may be more accurate to use the names rather than the positions to get the order you want. str(swiss) `data.frame': 47 obs. of 6 variables: $ Fertility : num 80.2 83.1 92.5 85.8 76.9 76.1 83.8 92.4 82.4 82.9 ... $ Agriculture : num 17 45.1 39.7 36.5 43.5 35.3 70.2 67.8 53.3 45.2 ... $ Examination : int 15 6 5 12 17 9 16 14 12 16 ... $ Education : int 12 9 5 7 15 7 7 8 7 13 ... $ Catholic: num 9.96 84.84 93.40 33.77 5.16 ... $ Infant.Mortality: num 22.2 22.2 20.2 20.3 20.6 26.6 23.6 24.9 21 24.4 ... head(swiss) Fertility Agriculture Examination Education Catholic Infant.Mortality Courtelary80.217.0 1512 9.96 22.2 Delemont 83.145.1 6 984.84 22.2 Franches-Mnt 92.539.7 5 593.40 20.2 Moutier 85.836.5 12 733.77 20.3 Neuveville76.943.5 1715 5.16 20.6 Porrentruy76.135.3 9 790.57 26.6 head(swiss[, c(Agriculture, Education, Examination, Catholic)]) Agriculture Education Examination Catholic Courtelary 17.012 15 9.96 Delemont45.1 9 684.84 Franches-Mnt39.7 5 593.40 Moutier 36.5 7 1233.77 Neuveville 43.515 17 5.16 Porrentruy 35.3 7 990.57 3) How to I append to the bottom of a dataframe? df2-rbind(df2,c(5,6)) Xiaohui Chen Dept. of Statistics UBC, Canada From: Jonathan Greenberg [EMAIL PROTECTED] To: R-help r-help@stat.math.ethz.ch Subject: [R] Data frames questions Date: Sat, 23 Sep 2006 14:54:00 -0700 Hi there, couple of questions on data frames: 1) Is there a way to build an empty data frame, containing nothing but the data frame variable names? 2) Is there a way to reorder the variables in a data frame, e.g. When I go to write out a data frame using write.table or write.matrix, I want the output in a certain order... 3) How to I append to the bottom of a dataframe? Thanks! --j -- Jonathan A. Greenberg, PhD NRC Research Associate NASA Ames Research Center MS 242-4 Moffett Field, CA 94035-1000 Office: 650-604-5896 Cell: 415-794-5043 AIM: jgrn307 MSN: [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] how to delete some columns from a matrix based on some other indicator variable
Hi, The problem might be mode of the vector r. Try this D[,as.character(r)==1] But I am not sure that is the problem. Sometimes factors tend to complicate things. Look for factor in the R FAQ page. Ritwik. On 9/20/06, David Barron [EMAIL PROTECTED] wrote: You don't need a loop. You could try r - c(0,0,1,1) matD - matrix(1:12,nrow=3) matD [,1] [,2] [,3] [,4] [1,]147 10 [2,]258 11 [3,]369 12 matD[,r==1] matD[,r==1] [,1] [,2] [1,]7 10 [2,]8 11 [3,]9 12 On 20/09/06, Ya-Hsiu Chuang [EMAIL PROTECTED] wrote: Hello, I am not very familiar with R and need help in deleting a few columns in a matrix. Suppose I have a indicator variable called r and it's defined as r = (0, 0, 1, 1). A matrix D is a 3X4 matrix. If I want a new matrix which contains only the columns of D corresponding to the elements of r that equal to 1. how can i write a loop which creat a new matrix that contains only the last 2 columns of D in this case? thanks __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- = David Barron Said Business School University of Oxford Park End Street Oxford OX1 1HP __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Ritwik Sinha Graduate Student Epidemiology and Biostatistics Case Western Reserve University http://darwin.cwru.edu/~rsinha __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] R gui console problem
Hi all, My R GUI got a weird perk. It loads only first page of scripts, about 28 rows. I didn't change any configuration or installed anything special. I use R 2.3.1, windows. Help please. Thank you. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Print and supressing printing in function
Another newbie question for you all: In a function, say I have: countme - function() { for(i in 1:10) { i } } How do I get R to print i as it runs (e.g. By calling countme) -- right now it seems to supress most output. On a related note, my program uses remove.vars, which always prints its output -- how to I *supress* that output? Thanks! --j -- Jonathan A. Greenberg, PhD NRC Research Associate NASA Ames Research Center MS 242-4 Moffett Field, CA 94035-1000 Office: 650-604-5896 Cell: 415-794-5043 AIM: jgrn307 MSN: [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Print and supressing printing in function
On Sun, 2006-09-24 at 11:31 -0700, Jonathan Greenberg wrote: Another newbie question for you all: In a function, say I have: countme - function() { for(i in 1:10) { i } } How do I get R to print i as it runs (e.g. By calling countme) -- right now it seems to supress most output. On a related note, my program uses remove.vars, which always prints its output -- how to I *supress* that output? Thanks! You need to explicitly print() the value. Thus: countme - function() { for(i in 1:10) { print(i) } } countme() [1] 1 [1] 2 [1] 3 [1] 4 [1] 5 [1] 6 [1] 7 [1] 8 [1] 9 [1] 10 HTH, Marc Schwartz __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Print and supressing printing in function
Marc Schwartz said the following on 9/24/2006 1:56 PM: On Sun, 2006-09-24 at 11:31 -0700, Jonathan Greenberg wrote: Another newbie question for you all: In a function, say I have: countme - function() { for(i in 1:10) { i } } How do I get R to print i as it runs (e.g. By calling countme) -- right now it seems to supress most output. On a related note, my program uses remove.vars, which always prints its output -- how to I *supress* that output? Thanks! You need to explicitly print() the value. Thus: countme - function() { for(i in 1:10) { print(i) } } countme() [1] 1 [1] 2 [1] 3 [1] 4 [1] 5 [1] 6 [1] 7 [1] 8 [1] 9 [1] 10 HTH, Marc Schwartz __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. (Answering remove.vars question) Please read ?remove.vars. (You neglected to mention this function is part of the gdata package.) There is an info argument you want to set to FALSE. HTH, --sundar __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Print and supressing printing in function
On Sun, 2006-09-24 at 14:14 -0500, Sundar Dorai-Raj wrote: Marc Schwartz said the following on 9/24/2006 1:56 PM: On Sun, 2006-09-24 at 11:31 -0700, Jonathan Greenberg wrote: Another newbie question for you all: In a function, say I have: countme - function() { for(i in 1:10) { i } } How do I get R to print i as it runs (e.g. By calling countme) -- right now it seems to supress most output. On a related note, my program uses remove.vars, which always prints its output -- how to I *supress* that output? Thanks! You need to explicitly print() the value. Thus: countme - function() { for(i in 1:10) { print(i) } } countme() [1] 1 [1] 2 [1] 3 [1] 4 [1] 5 [1] 6 [1] 7 [1] 8 [1] 9 [1] 10 HTH, Marc Schwartz (Answering remove.vars question) Please read ?remove.vars. (You neglected to mention this function is part of the gdata package.) There is an info argument you want to set to FALSE. Thanks for noticing my oversight Sundar. Marc __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Complex survey analysis help
On Sun, 24 Sep 2006, justin bem wrote: Hi dear all, I have a complex survey data to analyse. I have a stratified survey with three stages level. The first stage is a PPS, but all other are SRSWOR. The solution propose in survey package is to considere PPS as SRS with repetion. No, the solution proposed is to consider it as PPS with replacement. I have try this E3stage-svydesign(ids=~stage1id+stage2id+stage3id, fpc=~fpc1+fpc2+fpc3, ...) This is the value for WOR sampling at all stage. What value should I give to fpc1 to have the same value of variance that in sampling with repetion ? I try fpc1-rep(0,length(data)) I get a error message. For sampling with replacement you just omit the fpc and specify the first-stage id and the sampling weights E3stage -svydesign(ids=~stageid1, weights=~weights) -thomas Thomas Lumley Assoc. Professor, Biostatistics [EMAIL PROTECTED] University of Washington, Seattle __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] R gui console problem
On 9/24/2006 1:41 PM, T Mu wrote: Hi all, My R GUI got a weird perk. It loads only first page of scripts, about 28 rows. I didn't change any configuration or installed anything special. I use R 2.3.1, windows. Help please. There's no way someone could help you based on the description you posted. As every message in this mailing list says, PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Duncan Murdoch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.