Re: [R] Missing information in source()
Hello Thank you all for most useful responses. I was looking for answers in the wrong place, that is why I have not responded before! Tom Backer Johnsen > On 7 Nov 2017, at 21:25, Rui Barradas <ruipbarra...@sapo.pt> wrote: > > Hello, > > Try > > print(head(...)) > > Hope this helps, > > Rui Barradas > > Em 07-11-2017 20:01, Tom Backer Johnsen escreveu: >> Dear R-help, >> >> I am running a Mac under Sierra, with R version 3.4.2 and RStudio 1.1.383. >> When running head () or tail () on an object in a script using source >> (
[R] Missing information in source()
Dear R-help, I am running a Mac under Sierra, with R version 3.4.2 and RStudio 1.1.383. When running head () or tail () on an object in a script using source
[R] Name of frame
Is it possible to get hold of the name of a frame? Tom __ R-help@r-project.org 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] Name of frame
Hmm. I need to do some pondering on that one. I do not really understand it, at least not yet. Tom Barry Rowlingson wrote: On Thu, Mar 11, 2010 at 12:30 PM, Tom Backer Johnsen bac...@psych.uib.no wrote: Is it possible to get hold of the name of a frame? I can't see a direct way, but you could capture the output of print: framename=function(frame){capture.output(print(frame))} foo=function(x){framename(sys.frame(1))} foo() [1] environment: 0x8eb451c any good? Barry __ R-help@r-project.org 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] reading quattro pro spreadsheet .qpw into R
stephen sefick wrote: I have many quattro pro spreadsheets and no quattro pro. Is there a way to access the data using R, or any other solution that anyone can think of? thanks, One possibility is to download the trial version of Corel Office and use that to convert the files to something more common, er even a simple .csv file, which is way easy to read into R. Tom __ R-help@r-project.org 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] From R to LaTeX to pdf?
As a general observation, few, if any, statistical packages, generate tables in the format what you might think you need or want. R is not an exception. Then it is better to transfer the table to a spreadsheet, shift things around, add headers, etc.. The R2HTML library is useful for that operation. When things are the way you want it, transfer it to LaTex via a text file, e.g. .csv. Tom Joel Fürstenberg-Hägg wrote: Hi all, Anyone experienced in the LaTeX format? I'm trying to use the xtable package to create nice anova tables, but how do I do to produce a pdf from the resulting LaTeX table? I've tried WinShell and MiKTeX, but I couldn't get any of them working... Here's an example of the output in R: % latex table generated in R 2.9.2 by xtable 1.5-6 package % Tue Nov 24 14:17:32 2009 \begin{tabular}{lr} \hline Df Sum Sq Mean Sq F value Pr($$F) \\ \hline cat 2 40.50 20.25 6.66 0.0019 \\ Residuals 107 325.13 3.04 \\ \hline \end{tabular} Best regards, Joel _ Lagra alla dina foton på Skydrive. Det är enkelt och säkert! http://www.skydrive.live.com [[alternative HTML version deleted]] __ R-help@r-project.org 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@r-project.org 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] From R to LaTeX to pdf?
I am sure you are right. I myself have not looked at the LaTeX function in Hmisc, that really sounds interesting, and thank you. On the other hand I had the impression (which may be wrong) that the original question was posed by someone with not too much experience. If that is the case the suggestion to combine custom functions in R with Sweave might be overwhelming at the very least. My alternative was definitely much less elegant, but would work for someone with less experience. I use R in my courses, but allow my students to use other packages. I am nevertheless always surprised at how many prefer R. In any case, I tell students how to transfer results from any statistical program into MS Word which most prefer. Since my field is psychology, the important standard is APA, which is quite complicated. In that situation, you really have to transfer things via a spreadsheet. You would be stupid not to, especially in respect to SPSS. Tom Erik Iverson wrote: While what you say is true for base R, someone already mentioned Hmisc's latex function, and I have written several custom functions to output tables in LaTeX, the benefit being the elimination of manual formatting and intervention when preparing tables. Add this in with Sweave and make files, and you have a chain where you can drop in a new dataset, type make, and have a brand new report with no manual intervention. Erik -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Tom Backer Johnsen Sent: Tuesday, November 24, 2009 9:06 AM To: Joel Fürstenberg-Hägg Cc: r-help@r-project.org Subject: Re: [R] From R to LaTeX to pdf? As a general observation, few, if any, statistical packages, generate tables in the format what you might think you need or want. R is not an exception. Then it is better to transfer the table to a spreadsheet, shift things around, add headers, etc.. The R2HTML library is useful for that operation. When things are the way you want it, transfer it to LaTex via a text file, e.g. .csv. Tom Joel Fürstenberg-Hägg wrote: Hi all, Anyone experienced in the LaTeX format? I'm trying to use the xtable package to create nice anova tables, but how do I do to produce a pdf from the resulting LaTeX table? I've tried WinShell and MiKTeX, but I couldn't get any of them working... Here's an example of the output in R: % latex table generated in R 2.9.2 by xtable 1.5-6 package % Tue Nov 24 14:17:32 2009 \begin{tabular}{lr} \hline Df Sum Sq Mean Sq F value Pr($$F) \\ \hline cat 2 40.50 20.25 6.66 0.0019 \\ Residuals 107 325.13 3.04 \\ \hline \end{tabular} Best regards, Joel _ Lagra alla dina foton på Skydrive. Det är enkelt och säkert! http://www.skydrive.live.com [[alternative HTML version deleted]] __ R-help@r-project.org 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@r-project.org 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@r-project.org 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] reference on fisher.test()
For me, the classical reference for FET is: @BOOK{Siegel56, title = {Nonparametric Statistics for the Behavioral Sciences}, publisher = {McGraw-Hill}, year = {1956}, author = {Siegel, Sidney}, address = {New York} } Tom Prof Brian Ripley wrote: On Fri, 16 Oct 2009, Robin Hankin wrote: Hi fexact.c points you to the original ACM paper: Well, you'll get a better idea from the help page as to the real 'original' source reference: the reference below is to a revised version in a remark. And indeed Agresti's book (first edition on the help page, also has a 2002 second edition) is a good source for the 'minutiae'. /* ALGORITHM 643, COLLECTED ALGORITHMS FROM ACM. THIS WORK PUBLISHED IN TRANSACTIONS ON MATHEMATICAL SOFTWARE, VOL. 19, NO. 4, DECEMBER, 1993, PP. 484-488. - You may find the discussion in the vignette(fishervig) in the aylmer package helpful. HTH Robin Peter Dalgaard wrote: Peng Yu wrote: On Thu, Oct 15, 2009 at 4:19 PM, RICHARD M. HEIBERGER r...@temple.edu wrote: On Thu, Oct 15, 2009 at 4:56 PM, Peng Yu pengyu...@gmail.com wrote: Can somebody point me a book on Fisher's exact test? I looked a few webpages. But the descriptions on the webpages are not very complete. Is there a book on that covers all the aspect of Fisher's exact test that is implemented in R? Section 15.2 of my book (Statistical Analysis and Data Display, with Burt Holland and published by Springer) shows a detailed example. It doesn't mention odd ratio. The general idea of basing the inference on the noncentral hypergeometric distribution is something I have first seen in BreslowDay's famous 1980 book on case-control studies, including the fact that the conditional MLE differs from the ordinary OR. (I'm sure there's an earlier reference, but I happened to be a grad student when that book came out...) The rest of what R does is carbon copied from similar procedures for the binomial distribution. I wouldn't know what kind of book to look for for that sort of minutiae. Alan Agresti is a possible source. -- Robin K. S. Hankin Uncertainty Analyst University of Cambridge 19 Silver Street Cambridge CB3 9EP 01223-764877 __ R-help@r-project.org 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@r-project.org 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] Request for some help
Abdul: First, read the posting guide. You will find a link to that one at the bottom of all messages. Also, read some of the documentation for R. Sorry, there is no way to avoid that. A very good source is the R web page (Google for the letter R, the link will be at the top of the list). In that page find the link to manuals on the left. If you really are a beginner, click on the contributed documentation toward the bottom of the page. In that page you will find several introductions of various kinds. I am sure you will something useful there. Tom abdul hanan wrote: Dera Graham I would highly be thankful if u help me how to do 1. Wilk's Lambda test 2. Box plots and 3. pooled within group standardization in discriminant analysis with 6 variables in R. Actually I am new to R but I have an assignment to analyse some questions only in R and there is drawback for me, no one in our dept. knows about R. Really I am very much depressed and afraid that I will loose my marks. Furthermore, I have using R Gui package Please, please help me if u know. I have taken this email form internet while searching how to do Wilks Lambda test. Regards [[alternative HTML version deleted]] __ R-help@r-project.org 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. -- ++ | Tom Backer Johnsen, Psychometrics Unit, Faculty of Psychology | | University of Bergen, Christies gt. 12, N-5015 Bergen, NORWAY | | Tel : +47-5558-9185Fax : +47-5558-9879 | | Email : bac...@psych.uib.noURL : http://www.galton.uib.no/ | ++ __ R-help@r-project.org 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] Citing R
What is the correct citation to R in BibTeX format? I have looked in the R pages but so far without any luck. Tom __ R-help@r-project.org 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] Citing R
Stephan Kolassa wrote: citation() Really obvious. Sorry. Tom HTH, Stephan Tom Backer Johnsen schrieb: What is the correct citation to R in BibTeX format? I have looked in the R pages but so far without any luck. Tom __ R-help@r-project.org 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. -- ++ | Tom Backer Johnsen, Psychometrics Unit, Faculty of Psychology | | University of Bergen, Christies gt. 12, N-5015 Bergen, NORWAY | | Tel : +47-5558-9185Fax : +47-5558-9879 | | Email : bac...@psych.uib.noURL : http://www.galton.uib.no/ | ++ __ R-help@r-project.org 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] Genstat into R - Randomisation test
Peter Dalgaard wrote: Mike Lawrence wrote: Looks like that code implements a non-exhaustive variant of the randomization test, sometimes called a permutation test. Isn't it the other way around? (Permutation tests can be exhaustive by looking at all permutations, if a randomization test did that, then it wouldn't be random.) Eugene Edgington wrote an early book (1980) on this subject called Randomization tests, published by Dekker. As far as I remember, he differentiates between Systematic permutation tests where one looks at all possible permutations. This is of course prohibitive for anything beyond trivially small samples. For larger samples he uses what he calls Random permutations, where a random sample of the possible permutations is used. Tom Peter Dalgaard wrote: Mike Lawrence wrote: Looks like that code implements a non-exhaustive variant of the randomization test, sometimes called a permutation test. Isn't it the other way around? (Permutation tests can be exhaustive by looking at all permutations, if a randomization test did that, then it wouldn't be random.) -- ++ | Tom Backer Johnsen, Psychometrics Unit, Faculty of Psychology | | University of Bergen, Christies gt. 12, N-5015 Bergen, NORWAY | | Tel : +47-5558-9185Fax : +47-5558-9879 | | Email : bac...@psych.uib.noURL : http://www.galton.uib.no/ | ++ __ R-help@r-project.org 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] Running an R script from Delphi 7
Gentlepersons: A long time ago I used to be able to start R (version 2.6.1) from a Delphi 7 program and run a script by using a procedure like the following: function StartRAndWait (CommandLine : string) : Boolean; var Proc_info: TProcessInformation; Startinfo: TStartupInfo; ExitCode: longword; CreateOK : Boolean; begin Result := False; { Initialize the structures } FillChar(proc_info, sizeof (TProcessInformation), #0); FillChar(startinfo, sizeof (TStartupInfo), #0); Startinfo.cb := sizeof (TStartupInfo); Startinfo.dwFlags := STARTF_USESHOWWINDOW or STARTF_USESTDHANDLES; Startinfo.wShowWindow := SW_HIDE; { Attempt to create the process. If successful wait for it to end} // CreateOK := CreateProcess(nil, nil, nil, nil, nil, CreateOK := CreateProcess(Nil, PChar('C:\Program Files\R\R-2.8.1\bin\R.exe ' + CommandLine), nil, nil, False, CREATE_NEW_PROCESS_GROUP+NORMAL_PRIORITY_CLASS, nil, nil, StartInfo, proc_info); if (CreateOK) then begin WaitForSingleObject (proc_info.hProcess, INFINITE); GetExitCodeProcess(proc_info.hProcess, ExitCode); Result := True end; CloseHandle(proc_info.hThread); CloseHandle(proc_info.hProcess); end; Now it seems to hang on the call on WaitForSingleObject toward the end. My current version of R is 2.8.1 if that is relevant. Does anybody have any suggestions? Tom __ R-help@r-project.org 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] Running an R script from Delphi 7
Arghh! How stupid can you (I) be. It is R.exe that is called and not RCMD.exe. Hence the program is waiting for a response to the question about saving the workspace. Tom Tom Backer Johnsen wrote: Gentlepersons: A long time ago I used to be able to start R (version 2.6.1) from a Delphi 7 program and run a script by using a procedure like the following: function StartRAndWait (CommandLine : string) : Boolean; var Proc_info: TProcessInformation; Startinfo: TStartupInfo; ExitCode: longword; CreateOK : Boolean; begin Result := False; { Initialize the structures } FillChar(proc_info, sizeof (TProcessInformation), #0); FillChar(startinfo, sizeof (TStartupInfo), #0); Startinfo.cb := sizeof (TStartupInfo); Startinfo.dwFlags := STARTF_USESHOWWINDOW or STARTF_USESTDHANDLES; Startinfo.wShowWindow := SW_HIDE; { Attempt to create the process. If successful wait for it to end} // CreateOK := CreateProcess(nil, nil, nil, nil, nil, CreateOK := CreateProcess(Nil, PChar('C:\Program Files\R\R-2.8.1\bin\R.exe ' + CommandLine), nil, nil, False, CREATE_NEW_PROCESS_GROUP+NORMAL_PRIORITY_CLASS, nil, nil, StartInfo, proc_info); if (CreateOK) then begin WaitForSingleObject (proc_info.hProcess, INFINITE); GetExitCodeProcess(proc_info.hProcess, ExitCode); Result := True end; CloseHandle(proc_info.hThread); CloseHandle(proc_info.hProcess); end; Now it seems to hang on the call on WaitForSingleObject toward the end. My current version of R is 2.8.1 if that is relevant. Does anybody have any suggestions? Tom __ R-help@r-project.org 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. -- ++ | Tom Backer Johnsen, Psychometrics Unit, Faculty of Psychology | | University of Bergen, Christies gt. 12, N-5015 Bergen, NORWAY | | Tel : +47-5558-9185Fax : +47-5558-9879 | | Email : bac...@psych.uib.noURL : http://www.galton.uib.no/ | ++ __ R-help@r-project.org 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] Programming objects in R
This is interesting. The fact that there are so few texts on the subject probably means that very few are using OO programming methods in R. I will probably look in the Python direction. Pity. I would have preferred R. Tom krzysztof.sakre...@gmail.com wrote: I have been using Chambers for the same purpose but I think he focuses too much on discussion and too little on technique. The book is frustrating to use and I often have to dig to find simple usage cases. . Unfortunately there seems to be no other book which contains the same info. I've been hoping O'Reilly puts out an R programming book but nothing yet. Best, Krzysztof Sent via BlackBerry by ATT -Original Message- From: Tom Backer Johnsen bac...@psych.uib.no Date: Tue, 31 Mar 2009 12:31:17 To: r-help@r-project.org Subject: [R] Programming objects in R I am planning a project where an object-oriented approach would be appropriate, and for a number of reasons I would prefer using either Python or R. My problem at the moment is to find out how to do OO programming in R. Are there any introductory texts anywhere ? Tom -- ++ | Tom Backer Johnsen, Psychometrics Unit, Faculty of Psychology | | University of Bergen, Christies gt. 12, N-5015 Bergen, NORWAY | | Tel : +47-5558-9185Fax : +47-5558-9879 | | Email : bac...@psych.uib.noURL : http://www.galton.uib.no/ | ++ __ R-help@r-project.org 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] Programming objects in R
Wacek Kusnierczyk wrote: Tom Backer Johnsen wrote: This is interesting. The fact that there are so few texts on the subject probably means that very few are using OO programming methods in R. I will probably look in the Python direction. Pity. I would have preferred R. if you insist on oo, python might be a better choice. r has two built-in oo systems plus a few additional ones in various packages. of the two basic ones, s3 is simple to use though some features may confuse you; in his The R Inferno [1], Pat Burns calls this system 'a bit ad hoc'. the other, s4, is much more complex, probably too complex for its own developers. additionally, s3 and s4 intefere with each other in ugly ways, as some recent posts show. here's one opinion: library(fortunes) fortune('handcuff') if you really have to stay with r, R.oo, for example, might be an alternative. you can always access r from within python when statistic computations are needed, while staying in the cosy realm of a much more coherent programming language. Very true. Sounds like sensible advice. Tom vQ [1] http://www.burns-stat.com/pages/Tutor/R_inferno.pdf Tom krzysztof.sakre...@gmail.com wrote: I have been using Chambers for the same purpose but I think he focuses too much on discussion and too little on technique. The book is frustrating to use and I often have to dig to find simple usage cases. . Unfortunately there seems to be no other book which contains the same info. I've been hoping O'Reilly puts out an R programming book but nothing yet. Best, Krzysztof Sent via BlackBerry by ATT -Original Message- From: Tom Backer Johnsen bac...@psych.uib.no Date: Tue, 31 Mar 2009 12:31:17 To: r-help@r-project.org Subject: [R] Programming objects in R I am planning a project where an object-oriented approach would be appropriate, and for a number of reasons I would prefer using either Python or R. My problem at the moment is to find out how to do OO programming in R. Are there any introductory texts anywhere ? Tom -- ++ | Tom Backer Johnsen, Psychometrics Unit, Faculty of Psychology | | University of Bergen, Christies gt. 12, N-5015 Bergen, NORWAY | | Tel : +47-5558-9185Fax : +47-5558-9879 | | Email : bac...@psych.uib.noURL : http://www.galton.uib.no/ | ++ __ R-help@r-project.org 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] Programming objects in R
I am planning a project where an object-oriented approach would be appropriate, and for a number of reasons I would prefer using either Python or R. My problem at the moment is to find out how to do OO programming in R. Are there any introductory texts anywhere ? Tom -- ++ | Tom Backer Johnsen, Psychometrics Unit, Faculty of Psychology | | University of Bergen, Christies gt. 12, N-5015 Bergen, NORWAY | | Tel : +47-5558-9185Fax : +47-5558-9879 | | Email : bac...@psych.uib.noURL : http://www.galton.uib.no/ | ++ __ R-help@r-project.org 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] Programming objects in R
Patrick Burns wrote: I think that 'Software for Data Analysis' by John Chambers should certainly be on the reading list. It seems that that is true. I have a number of R books, but not that one. Thanks for the suggestion. Tom 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) Tom Backer Johnsen wrote: I am planning a project where an object-oriented approach would be appropriate, and for a number of reasons I would prefer using either Python or R. My problem at the moment is to find out how to do OO programming in R. Are there any introductory texts anywhere ? Tom -- ++ | Tom Backer Johnsen, Psychometrics Unit, Faculty of Psychology | | University of Bergen, Christies gt. 12, N-5015 Bergen, NORWAY | | Tel : +47-5558-9185Fax : +47-5558-9879 | | Email : bac...@psych.uib.noURL : http://www.galton.uib.no/ | ++ __ R-help@r-project.org 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] popular R packages
s...@xlsolutions-corp.com wrote: Hi Spencer, XLSolutions is currently analyzing r-help archived questions to rank packages for the upcoming R-PLUS 3.3 Professional version and we will be happy to share the outcome with interested parties. Please email d...@xlsolutions-corp.com I would expect that the correlation between popularity on the one hand and usefulness as well as quality to be relatively low. If it was possible to rate the downloaders in respect to seriousness and whether they actually use the package for some sensible purpose I would be more interested. Consider a highly specialized and good quality package used by a relatively small group of distinguished reseachers. Would that have a high rank? No. But important? Possibly yes. Tom Regards - Sue Turner Senior Account Manager XLSolutions Corporation North American Division 1700 7th Ave Suite 2100 Seattle, WA 98101 Phone: 206-686-1578 Email: s...@xlsolutions-corp.com web: www.xlsolutions-corp.com --- On Sat, 3/7/09, Spencer Graves spencer.gra...@prodsyse.com wrote: From: Spencer Graves spencer.gra...@prodsyse.com Subject: Re: [R] popular R packages To: Wacek Kusnierczyk waclaw.marcin.kusnierc...@idi.ntnu.no Cc: r-help@r-project.org, Jeroen Ooms j.c.l.o...@uu.nl, Thomas Adams thomas.ad...@noaa.gov Date: Saturday, March 7, 2009, 5:22 PM I just did RSiteSearch(library(xxx)) with xxx = the names of 6 packages familiar to me, with the following numbers of hits: hits package 169 lme4 165 nlme 6 fda 4 maps 2 FinTS 2 DierckxSpline Software could be written to (1) extract the names of current packages from CRAN then (2) perform queries similar to this on all such packages and summarize the results. I don't have the time now to write code for this, but I've written similar code before for step (1); it can be found in scripts/TsayFiles.R in the FinTS package on CRAN. For step (2), Sundar Dorai-Raj wrote code that is is included in the preliminary RSiteSearch package available from R-Forge via install.'packages(RSiteSearch,repos=http://r-forge.r-project.org;)'. Code to do this could probably be written (a) in a matter of seconds by many of those in the R Core team or (b) in a matter of hours by virtually any reader of this list using the examples I just cited. And it could provide numbers without a need to convince others to keep download statistics and make them available later. Hope this helps. Spencer Graves Wacek Kusnierczyk wrote: i have kept r installed on more than ten computers during the past few years, some of them running win + more than one linux distro, all of them having r, most often installed from a separate download. i know of many cases where students download r for the purpose of a course in statistics -- often an introductory course for students who otherwise have little to do with stats. some of them do it more than once during the semester, and many of them never use r again. taking into account that basic statistics courses are taught to most university students and that r is surely the most popular free statistical computing environment, download-based usage estimates may be a bit optimistic, unless 'usage' is taken to include 'learn-pass-forget'. vQ Tal Galili wrote: I agree with Thomas, over the years I have installed R on at least 5 computers. BTW: does any one knows how the website statistics of r-project are being analyzed? Since I can't see any google analytics or other tracking code in the main website, I am guessing someone might be running some log-file analyzer - but I'd rather hear that then assume. On Sun, Mar 8, 2009 at 12:45 AM, Thomas Adams thomas.ad...@noaa.gov wrote: I don't think At least one of the participants in the 2004 thread suggested that it would be a good thing to track the numbers of downloads by package. is reasonable because I download R packages for 2 home computers (laptop desktop) and 2 at work (1 Linux 1 Mac). There must be many such cases… Tom __ R-help@r-project.org 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@r-project.org 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@r-project.org 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. -- ++ | Tom Backer Johnsen
Re: [R] installing R on Ubuntu
Dear me. Is the installation of R under Ubuntu really that complex? I have a dual boot machine (Linux / Windows, where I use the latter the most) and have plans to try R under Linux, but have not done so yet. Is it possible to simplify the Linux install procedure to make R more accessible to novices? Compare that to Windows. (1) Download installation program (2) Run installation program. That is it. Tom Paul Heinrich Dietrich wrote: I've read some of R's literature on Linux, including the R Admin manual, and didn't find it very useful, which is probably my own limitation. But I did finally manage to get it working well. I'm posting this to help others. The following worked when installing R 2.8.1 on Ubuntu 8.04 Hardy Heron. Here are truly step-by-step instructions for those who don't know Linux (like me): Installation and Initial Set-Up of R for Ubuntu Linux 1. Open the Bash terminal (Applications Accessories Terminal) 2. Type these lines to add the security key to access the latest version of the R Ubuntu package: u...@computer:~$ gpg --keyserver subkeys.pgp.net --recv-key E2A11821 u...@computer:~$ gpg -a --export E2A11821 | sudo apt-key add - 3. Use the Bash terminal to open your sources.list file with gedit (text editor) for editing: u...@computer:~$ sudo gedit /etc/apt/sources.list 4. Add this line to the bottom of the sources.list file: deb http://rh-mirror.linux.iastate.edu/CRAN/bin/linux/ubuntu hardy/ 5. Save the file and go back to the Bash terminal. 6. Type this to update apt-get's database before you install R: u...@computer:~$ sudo apt-get update 7. Install R with this command: u...@computer:~$ sudo apt-get install r-base 8. Go to System Administration Synaptic Package Manager, and download the build-essential package. 9. To use R, simply enter R in the Bash terminal. To quit, enter q(). Additional programs will be needed to install other packages or work with other programs: 1. Install compilers for C++ and Fortran u...@computer:~$ sudo apt-get install g++ gfortran 2. Install the developer versions of Blas and Lapack (what are these?) u...@computer:~$ apt-get install libblas-dev liblapack-dev Updating Packages in R 1. Open the Bash terminal and start R with root permissions u...@computer:~$ sudo R 2. Type update.packages() Installing the R Commander GUI 1. Open the Bash terminal and type: u...@computer:~$ apt-get install r-cran-rcmdr Using the R Commander GUI library(Rcmdr) ...or once the library is open and Commander has been shut down, type: commander() Notes It looks like most of R has been put here: /etc/R (Rprofile.site is here) /usr/lib/R Downloaded Packages seem to go here: /usr/local/lib/R/site-library/ -- ++ | Tom Backer Johnsen, Psychometrics Unit, Faculty of Psychology | | University of Bergen, Christies gt. 12, N-5015 Bergen, NORWAY | | Tel : +47-5558-9185Fax : +47-5558-9879 | | Email : bac...@psych.uib.noURL : http://www.galton.uib.no/ | ++ __ R-help@r-project.org 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] installing R on Ubuntu
Dirk Eddelbuettel wrote: On 8 February 2009 at 20:36, Tom Backer Johnsen wrote: | Dear me. Is the installation of R under Ubuntu really that complex? I | have a dual boot machine (Linux / Windows, where I use the latter the | most) and have plans to try R under Linux, but have not done so yet. Is | it possible to simplify the Linux install procedure to make R more | accessible to novices? Yes. 'sudo apt-get install r-base ess ggobi' and you have working R, ESS and Ggobi. Start Emacs, type 'M-x R' and you have an R session inside Emacs. Is that really easier to accomplish in Windows? No. If it is that simple to install R under a Debian vaiant of Linux, it definitely is easier. On the other hand, using Emacs is not (as far as I know) the thing for novices. What I would prefer is something that is as simple to use as the Windows (or even better, the Mac interface) for R. Tom Dirk | | Compare that to Windows. (1) Download installation program (2) Run | installation program. That is it. | | Tom | | Paul Heinrich Dietrich wrote: | I've read some of R's literature on Linux, including the R Admin manual, and | didn't find it very useful, which is probably my own limitation. But I did | finally manage to get it working well. I'm posting this to help others. | The following worked when installing R 2.8.1 on Ubuntu 8.04 Hardy Heron. | Here are truly step-by-step instructions for those who don't know Linux | (like me): | | Installation and Initial Set-Up of R for Ubuntu Linux | | 1. Open the Bash terminal (Applications Accessories Terminal) | 2. Type these lines to add the security key to access the latest version of | the R Ubuntu package: | u...@computer:~$ gpg --keyserver subkeys.pgp.net --recv-key E2A11821 | u...@computer:~$ gpg -a --export E2A11821 | sudo apt-key add - | 3. Use the Bash terminal to open your sources.list file with gedit (text | editor) for editing: | u...@computer:~$ sudo gedit /etc/apt/sources.list | 4. Add this line to the bottom of the sources.list file: | deb http://rh-mirror.linux.iastate.edu/CRAN/bin/linux/ubuntu hardy/ | 5. Save the file and go back to the Bash terminal. | 6. Type this to update apt-get's database before you install R: | u...@computer:~$ sudo apt-get update | 7. Install R with this command: | u...@computer:~$ sudo apt-get install r-base | 8. Go to System Administration Synaptic Package Manager, and download | the build-essential package. | 9. To use R, simply enter R in the Bash terminal. To quit, enter q(). | | | Additional programs will be needed to install other packages or work with | other programs: | 1. Install compilers for C++ and Fortran | u...@computer:~$ sudo apt-get install g++ gfortran | 2. Install the developer versions of Blas and Lapack (what are these?) | u...@computer:~$ apt-get install libblas-dev liblapack-dev | | | Updating Packages in R | 1. Open the Bash terminal and start R with root permissions | u...@computer:~$ sudo R | 2. Type update.packages() | | | Installing the R Commander GUI | 1. Open the Bash terminal and type: | u...@computer:~$ apt-get install r-cran-rcmdr | | | Using the R Commander GUI | library(Rcmdr) | ...or once the library is open and Commander has been shut down, type: | commander() | | | Notes | It looks like most of R has been put here: | /etc/R (Rprofile.site is here) | /usr/lib/R | | | Downloaded Packages seem to go here: | /usr/local/lib/R/site-library/ | | | -- | ++ | | Tom Backer Johnsen, Psychometrics Unit, Faculty of Psychology | | | University of Bergen, Christies gt. 12, N-5015 Bergen, NORWAY | | | Tel : +47-5558-9185Fax : +47-5558-9879 | | | Email : bac...@psych.uib.noURL : http://www.galton.uib.no/ | | ++ | | __ | R-help@r-project.org 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. -- ++ | Tom Backer Johnsen, Psychometrics Unit, Faculty of Psychology | | University of Bergen, Christies gt. 12, N-5015 Bergen, NORWAY | | Tel : +47-5558-9185Fax : +47-5558-9879 | | Email : bac...@psych.uib.noURL : http://www.galton.uib.no/ | ++ __ R-help@r-project.org 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] bootstrapping in regression
Tom Backer Johnsen wrote: Thomas Mang wrote: Hi, Please apologize if my questions sounds somewhat 'stupid' to the trained and experienced statisticians of you. Also I am not sure if I used all terms correctly, if not then corrections are welcome. I have asked myself the following question regarding bootstrapping in regression: Say for whatever reason one does not want to take the p-values for regression coefficients from the established test statistics distributions (t-distr for individual coefficients, F-values for whole-model-comparisons), but instead apply a more robust approach by bootstrapping. In the simple linear regression case, one possibility is to randomly rearrange the X/Y data pairs, estimate the model and take the beta1-coefficient. Do this many many times, and so derive the null distribution for beta1. Finally compare beta1 for the observed data against this null-distribution. There is a very basic difference between bootstrapping and random permutations. What you are suggesting is to shuffle values between cases or rows in the frame. That amounts to a variant of a permutation test, not a bootstrap. What you do in a bootstrap test is different, you regard your sample as a population and then sample from that population (with replacement), normally by extracting a large number of random samples of the same size as the original sample and do the computations for whatever you are interested in for each sample. In other words, with bootstrapping, the pattern of values within each case or row is unchanged, and you sample complete cases or rows. With a permutation test you keep the original sample of cases or rows, but shuffle the observations on the same variable between cases or rows. Have a look at the 'boot' package. Tom What I now wonder is how the situation looks like in the multiple regression case. Assume there are two predictors, X1 and X2. Is it then possible to do the same, but just only rearranging the values of one predictor (the one of interest) at a time? Say I want again to test beta1. Is it then valid to many times randomly rearrange the X1 data (and keeping Y and X2 as observed), fit the model, take the beta1 coefficient, and finally compare the beta1 of the observed data against the distributions of these beta1s ? For X2, do the same, randomly rearrange X2 all the time while keeping Y and X1 as observed etc. Is this valid ? Second, if this is valid for the 'normal', fixed-effects only regression, is it also valid to derive null distributions for the regression coefficients of the fixed effects in a mixed model this way? Or does the quite different parameters estimation calculation forbid this approach (Forbid in the sense of bogus outcome) ? Thanks, Thomas __ R-help@r-project.org 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. -- ++ | Tom Backer Johnsen, Psychometrics Unit, Faculty of Psychology | | University of Bergen, Christies gt. 12, N-5015 Bergen, NORWAY | | Tel : +47-5558-9185Fax : +47-5558-9879 | | Email : bac...@psych.uib.noURL : http://www.galton.uib.no/ | ++ __ R-help@r-project.org 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] Can't find files after install package (Windows)
Did you include the statement library (gcl) before the call on source () ? Tom bcbob43 wrote: --I was not registered when I first sent this. I registered and it looks like I have to resend so sorry if this gets sent twice ... I am a total newbie at R but experienced with computers. If this is not the right forum for this question, please let me know one that is. I searched in the R manuals in the Help section, the Nabble help and Rseek but no luck. I am trying to install the package gcl on my recently installed R 2.8.1 I searched on cran for the windows version and found a zip file for the package In RGui, I ran Packages|Install Package(s) from local zip files This ran without any error messages When I look in the 'library' directory of my R installation I see a subdirectory named 'gcl' with subdirectories 'demo','man','R' I try to run gcldemo.r in the Demo directory and get the following messages: source(C:\\R-2.8.1\\library\\gcl\\demo\\gcldemo.r) Data table: V1V2V3V4 V5 1 0.628 0.525 0.634 0.714 1 2 0.317 0.746 0.994 0.661 0 3 0.275 0.669 0.709 0.208 1 4 0.458 0.179 0.198 0.996 1 5 0.926 0.162 0.857 0.309 0 6 0.456 0.082 0.109 0.306 0 7 0.894 0.951 0.896 0.076 1 8 0.415 0.731 0.626 0.463 0 9 0.694 0.656 0.335 0.187 1 10 0.193 0.478 0.615 0.590 0 computing fuzzy rule classifier function cf... Error in eval.with.vis(expr, envir, enclos) : could not find function gcl I have exited RGui and restarted it but still get same error Any help appreciated. Bob p.s. I was not registered when I first sent this. I registered and it looks like I have to resend so sorry of this gets sent twice -- ++ | Tom Backer Johnsen, Psychometrics Unit, Faculty of Psychology | | University of Bergen, Christies gt. 12, N-5015 Bergen, NORWAY | | Tel : +47-5558-9185Fax : +47-5558-9879 | | Email : bac...@psych.uib.noURL : http://www.galton.uib.no/ | ++ __ R-help@r-project.org 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] The R Inferno
Extremely nice. Tons of useful information presented in a very entertaining way. Thanks! Tom Patrick Burns wrote: The R Inferno is now on the Burns Statistics website at http://www.burns-stat.com/pages/Tutor/R_inferno.pdf Abstract: If you are using R and you think you're in hell, this is a map for you. Also, I've expanded the outline concerning R on the Burns Statistics 'Links' page. Suggestions (off-list) for additional items are encouraged. 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) __ R-help@r-project.org 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. -- ++ | Tom Backer Johnsen, Psychometrics Unit, Faculty of Psychology | | University of Bergen, Christies gt. 12, N-5015 Bergen, NORWAY | | Tel : +47-5558-9185Fax : +47-5558-9879 | | Email : bac...@psych.uib.noURL : http://www.galton.uib.no/ | ++ __ R-help@r-project.org 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] New York Times Article: Data Analysts Captivated by R's Power
Sure, that statement is in it self somewhat amusing. But the article itself is very good PR. I am sending off copies of the link to many of my colleagues, some sceptic, others not sceptic at all. Thanks! Tom Arthur Burke wrote: Readers of this list might be interested in the following article in the New York Times and might find amusing the notion that Some people familiar with R describe it as a supercharged version of Microsoft's Excel spreadsheet software http://www.nytimes.com/2009/01/07/technology/business-computing/07progra m.html?_r=1ref=technology Art -- Art Burke Northwest Regional Educational Laboratory 101 SW Main St, Suite 500 Portland, OR 97204-3213 Phone: 503-275-9592 / 800-547-6339 Fax: 503-275-0450 bur...@nwrel.org [[alternative HTML version deleted]] __ R-help@r-project.org 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. -- ++ | Tom Backer Johnsen, Psychometrics Unit, Faculty of Psychology | | University of Bergen, Christies gt. 12, N-5015 Bergen, NORWAY | | Tel : +47-5558-9185Fax : +47-5558-9879 | | Email : bac...@psych.uib.noURL : http://www.galton.uib.no/ | ++ __ R-help@r-project.org 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] Question involving loops
hwong1 wrote: a. Write a R function zerdiag.v1(m) using loop to output a square matrix whose diagonal elements are zero and the other elements are filled in by consecutive integers from 1 to m row-wise. For example, zerdiag.v1(6) = [0, 1, 2] [3, 0, 4] [5, 6, 0] This function should have error checking ability. If the input m cannot form a square matrix, then the function will return an error message: Input number is incorrect. b. Write a R function zerdiag.v2(m) to produce the same output as in part (a) without using a loop. c. Test your functions in part (a) and (b) using m=12 and m=14 respectively. Any help with this question would be much appreciated. Thank you! This looks like an assignment to me. Tom -- ++ | Tom Backer Johnsen, Psychometrics Unit, Faculty of Psychology | | University of Bergen, Christies gt. 12, N-5015 Bergen, NORWAY | | Tel : +47-5558-9185Fax : +47-5558-9879 | | Email : [EMAIL PROTECTED]URL : http://www.galton.uib.no/ | ++ __ R-help@r-project.org 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] Examples of advanced data visualization
Hans W. Borchers wrote: Dear R-help, I am looking for ideas and presentations of new and advanced data visualization methods. As an example of what I am searching for, the 'Many Eyes' pages at http://manyeyes.alphaworks.ibm.com/manyeyes/ may provide a good paradigm. I would be interested even if it will not be easy to implement such examples in R, e.g. because of the interactive nature of these graphical displays. The question is interesting, but what I have a somewhat negative reaction to is the next passage: Please answer to my e-mail address. In case enough interesting material comes up, I will enter a summary here. It is nice that you are willing to summarize whatever appears, but somewhat arrogant in my eyes. There might be things appearing that you do not regard as of first interest that might be of interest to others. Therefore, the all parts of the discussion or responses should be public as well. The response of David Winsemius pointing at (among other things) at the presentation of Rosling at TED is in my eyes a very good start. In other words, I therefore suggest that the list ignores the last paragraph in the question from you. Hans Werner Borchers ABB Corporate Research Tom __ R-help@r-project.org 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] igraph and tkgraph
Gábor Csárdi wrote: Tom, On Fri, Nov 14, 2008 at 4:35 PM, Tom Backer Johnsen [EMAIL PROTECTED] wrote: Gabor: Actually, I meant a script GUI management of ugraph I managed to locate on the net. Oh, ok, it will be part of igraph from the next version. But its capabilities are very limited. We are considering writing a full-fledged GUI to igraph, but I haven't found the right tools for it yet, so this will happen only next year I think. Unfinished it may be, but nevertheless a potentially very interesting tool. Disregarding that, thank you for the suggestions. igraph is definitly a non-trivial affair, with a lot of options and corresponding flexibility. I made some changes to what you wrote: A - matrix(sample(c(-1, 0, 0, 0, 1), 25, replace=T), 5) g - graph.adjacency(A, mode=directed, weighted=T, diag=F) E(g)$lty - ifelse(E(g)$weight 0, 1, 2) tkplot (g, layout=layout.kamada.kawai) This gives me something that is very close to what I want, apart from a suspicion that if the relations between two vertices is non-symmetric, only one of the is shown. Is it possible to have a pair of, say slightly curved arrows as edges between them in that case? Not in the 0.5.1 version, but with the coming 0.6 version this is possible. You can download a preliminary package from here: http://cneurocvs.rmki.kfki.hu/igraph/download/igraph_0.6.tar.gz or if you're using windows, then I can build a windows binary package for you. Let me know if you need one. Yes, thank I would like to have a Windows binary if possible, but do not feel rushed. It is not urgent in any way. To make the edges curved, all you need is adding 'edge.curved=TRUE' to the arguments of plot or tkplot. To make them less curved, specify a number smaller than 0.5, the bigger the number the more curved they will be. First class! Tom Best, Gabor Tom Gábor Csárdi wrote: Tom, you mean 'tkplot' in the igraph package? Look at ?igraph.plotting on how to set up plotting parameters, e.g. if you want different line types for the positive/negative relations, then you can make use of the 'lty' parameter: A - matrix(sample(c(-1,0,1), 100, replace=TRUE), 10) g - graph.adjacency(A, mode=upper, weighted=TRUE, diag=FALSE) E(g)$lty - ifelse(E(g)$weight 0, 1, 2) tkplot(g, layout=layout.kamada.kawai) Gabor On Fri, Nov 14, 2008 at 12:40 PM, Tom Backer Johnsen [EMAIL PROTECTED] wrote: I have a number of (directed) graphs based on social groups, where the members have expresed likes and dislikes in respect to the other members. tkgraph makes it simple to draw the graphs in a very pleasing way, but I would like to differentiate between positive and negative relations in the graph by having the edges for the negative relations dashed and the positive ones continuous. Is that possible? If so how? Tom __ R-help@r-project.org 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. -- ++ | Tom Backer Johnsen, Psychometrics Unit, Faculty of Psychology | | University of Bergen, Christies gt. 12, N-5015 Bergen, NORWAY | | Tel : +47-5558-9185Fax : +47-5558-9879 | | Email : [EMAIL PROTECTED]URL : http://www.galton.uib.no/ | ++ -- ++ | Tom Backer Johnsen, Psychometrics Unit, Faculty of Psychology | | University of Bergen, Christies gt. 12, N-5015 Bergen, NORWAY | | Tel : +47-5558-9185Fax : +47-5558-9879 | | Email : [EMAIL PROTECTED]URL : http://www.galton.uib.no/ | ++ __ R-help@r-project.org 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] igraph and tkgraph
Gábor Csárdi wrote: On Sun, Nov 16, 2008 at 3:01 PM, Gábor Csárdi [EMAIL PROTECTED] wrote: Tom, On Fri, Nov 14, 2008 at 4:35 PM, Tom Backer Johnsen [EMAIL PROTECTED] wrote: [...] suspicion that if the relations between two vertices is non-symmetric, only one of the is shown. Is it possible to have a pair of, say slightly curved arrows as edges between them in that case? Not in the 0.5.1 version, but with the coming 0.6 version this is possible. You can download a preliminary package from here: http://cneurocvs.rmki.kfki.hu/igraph/download/igraph_0.6.tar.gz or if you're using windows, then I can build a windows binary package for you. Let me know if you need one. Ok, I have created a windows binary package, here it is: http://cneurocvs.rmki.kfki.hu/igraph/download/igraph_0.6.zip Thanks! Tom __ R-help@r-project.org 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] igraph and tkgraph
Gábor Csárdi wrote: On Sun, Nov 16, 2008 at 3:01 PM, Gábor Csárdi [EMAIL PROTECTED] wrote: Tom, On Fri, Nov 14, 2008 at 4:35 PM, Tom Backer Johnsen [EMAIL PROTECTED] wrote: [...] suspicion that if the relations between two vertices is non-symmetric, only one of the is shown. Is it possible to have a pair of, say slightly curved arrows as edges between them in that case? Not in the 0.5.1 version, but with the coming 0.6 version this is possible. You can download a preliminary package from here: http://cneurocvs.rmki.kfki.hu/igraph/download/igraph_0.6.tar.gz or if you're using windows, then I can build a windows binary package for you. Let me know if you need one. Ok, I have created a windows binary package, here it is: http://cneurocvs.rmki.kfki.hu/igraph/download/igraph_0.6.zip Sorry, I do not have the permission to access the server. Tom __ R-help@r-project.org 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] igraph and tkgraph
I have a number of (directed) graphs based on social groups, where the members have expresed likes and dislikes in respect to the other members. tkgraph makes it simple to draw the graphs in a very pleasing way, but I would like to differentiate between positive and negative relations in the graph by having the edges for the negative relations dashed and the positive ones continuous. Is that possible? If so how? Tom __ R-help@r-project.org 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] igraph and tkgraph
Gabor: Actually, I meant a script GUI management of ugraph I managed to locate on the net. Disregarding that, thank you for the suggestions. igraph is definitly a non-trivial affair, with a lot of options and corresponding flexibility. I made some changes to what you wrote: A - matrix(sample(c(-1, 0, 0, 0, 1), 25, replace=T), 5) g - graph.adjacency(A, mode=directed, weighted=T, diag=F) E(g)$lty - ifelse(E(g)$weight 0, 1, 2) tkplot (g, layout=layout.kamada.kawai) This gives me something that is very close to what I want, apart from a suspicion that if the relations between two vertices is non-symmetric, only one of the is shown. Is it possible to have a pair of, say slightly curved arrows as edges between them in that case? Tom Gábor Csárdi wrote: Tom, you mean 'tkplot' in the igraph package? Look at ?igraph.plotting on how to set up plotting parameters, e.g. if you want different line types for the positive/negative relations, then you can make use of the 'lty' parameter: A - matrix(sample(c(-1,0,1), 100, replace=TRUE), 10) g - graph.adjacency(A, mode=upper, weighted=TRUE, diag=FALSE) E(g)$lty - ifelse(E(g)$weight 0, 1, 2) tkplot(g, layout=layout.kamada.kawai) Gabor On Fri, Nov 14, 2008 at 12:40 PM, Tom Backer Johnsen [EMAIL PROTECTED] wrote: I have a number of (directed) graphs based on social groups, where the members have expresed likes and dislikes in respect to the other members. tkgraph makes it simple to draw the graphs in a very pleasing way, but I would like to differentiate between positive and negative relations in the graph by having the edges for the negative relations dashed and the positive ones continuous. Is that possible? If so how? Tom __ R-help@r-project.org 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. -- ++ | Tom Backer Johnsen, Psychometrics Unit, Faculty of Psychology | | University of Bergen, Christies gt. 12, N-5015 Bergen, NORWAY | | Tel : +47-5558-9185Fax : +47-5558-9879 | | Email : [EMAIL PROTECTED]URL : http://www.galton.uib.no/ | ++ __ R-help@r-project.org 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] in R when I get negative adjusted R^2 using lm, what might be the problem?
Greg Snow wrote: No problem, adjusted R-squared can be negative. If there truly is no relationship, then the adjusted R-squared should average to 0, so sometimes it must be negative. All of your R-squared and adjusted R-squared values suggest that there is not much of a relationship (less without the transform). Nevertheless, there remains the logical problem of a negative squared value. In any case, given the relatively large difference between the R-square and the adjusted value, he probably has a relative large number of independent variables compared to the number of rows in the data set. And the dependent variable is probably quite skewed as well. Tom __ R-help@r-project.org 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] Agent-based social simulation and R
Thomas Petzoldt wrote: Hi Tom, you may have a look at the CRAN package simecol, that has some examples how to implement different types of dynamic models in R (differential equations, grid models, individual based models). Individual-based models (IBMs) are a model family used in ecology, which are in its essence almost the same as ABMs in other areas. See http://simecol.r-forge.r-project.org for the package, examples, pdf's, and in particular the useR!2008 slides. Thomas Petzoldt Very nice. My compliments. I wil have to seriously consider that tool. Thanks. Tom __ R-help@r-project.org 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] Agent-based social simulation and R
Thomas Petzoldt wrote: Hi Tom, you may have a look at the CRAN package simecol, that has some examples how to implement different types of dynamic models in R (differential equations, grid models, individual based models). Individual-based models (IBMs) are a model family used in ecology, which are in its essence almost the same as ABMs in other areas. See http://simecol.r-forge.r-project.org for the package, examples, pdf's, and in particular the useR!2008 slides. Thank you for the suggestions. I'll have a look at that alternative as well. For the time being the prime candidate in the R world seems to be the igraph package, which is oriented towards graph theory and SNA, something that would be convenient (less programming). Tom __ R-help@r-project.org 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] Agent-based social simulation and R
Simone Gabbriellini wrote: Tom, I don't know if there are better ways, but this is the way I do: I use Python for building the AB model, and RPy as an interface to R for statistical analysis. One of the best package for SNA in R is igraph, which has a nice Python version. But if you prefere statnet (which is great too), you can simply handle it via RPy. I've learned this strategy from Pietro Terna - http://web.econ.unito.it/terna/ Thank you for useful information and suggestions. I will certainly look into what you mention. I am at the moment looking at the igraph package, which seems to have what I need, and includes visualization as well. As for Python, that is nice, but if I can do most of what I want in R, I would prefer that. Tom ++ | Tom Backer Johnsen, Psychometrics Unit, Faculty of Psychology | | University of Bergen, Christies gt. 12, N-5015 Bergen, NORWAY | | Tel : +47-5558-9185Fax : +47-5558-9879 | | Email : [EMAIL PROTECTED]URL : http://www.galton.uib.no/ | ++ __ R-help@r-project.org 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] Agent-based social simulation and R
Do anyone know anything about the use of R for agent-based social simulation? It should be possible, and would be convenient for the simple reason that there are several nice packages containing useful stuff for SNA (Social Network Analysis). Information about packages, web sites, experienced persons in the field, etc. would be very welcome. Tom ++ | Tom Backer Johnsen, Psychometrics Unit, Faculty of Psychology | | University of Bergen, Christies gt. 12, N-5015 Bergen, NORWAY | | Tel : +47-5558-9185Fax : +47-5558-9879 | | Email : [EMAIL PROTECTED]URL : http://www.galton.uib.no/ | ++ __ R-help@r-project.org 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] Agent-based social simulation and R
Martin Elff wrote: Hi Tom, my package 'memisc' contains a sort of an infrastructure for doing simulations. As a fun exercise I also used it to create a 'toy' agent based simulation of Schelling's neighbourhood model. Although it is not a serious application, at least it shows that agent based simulation is possible in R. Just run 'demo(schelling)' after loading 'memisc'. Interesting. I'll have to look trough the code. How far away do the agents see? Anything beyond their immidiate neighbors? Tom __ R-help@r-project.org 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] Transferring results from R to MS Word
Dieter Menne wrote: Tom Backer Johnsen backer at psych.uib.no writes: There are also some parts of the documentation that I do not understand. The list of functions includes things like HTML.lm, as far as I can see are invisible, both in respect to documentation and usage. This might be relic of a function written by my some year ago, which were part of the distribution for some time, but probably removed later. Hmm. If that is true, that is not very promising. It could indicate that the maintenace of the package might be patchy. Tom __ R-help@r-project.org 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] License Question
David Smith wrote: Hi Tom, We're in the process of updating the information on our website for academic users, but in general we're making RPro available to academic users free of charge. I'm just gathering the information from the department in charge of the academic program, and I'll make a public reply to r-help when I get that info. Just wanted to respond to your question directly in the interim. Thanks. I am looking forward to more information. RPro isn't going the route of a closed menu approach -- it's the same R command-line and script mode you're used to from R. We're focussing more on performance, parallel computation, and additional packages. Good. On the other hand, this sounds like it is (or will be) somewhat similar to the interfaces that already are avialble, e.g. Tinn-R or Rcmdr. So, what are the advantages? I'd be happy to answer any other questions you might have of RPro -- feel free to call or email. Thank you. Tom __ R-help@r-project.org 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] Transferring results from R to MS Word
Greg Snow wrote: Any timing is of course your decision, but my observation (being one of my company's test cases for updating office) is that transitioning from MSWord 2003 to OpenOffice Writer will be less work/stress than transitioning from MSWord 2003 to MSWord 2007. That agrees with my own observation, I have Office 2007 installed and often have to hunt around for things. However, I looked at OpenOffice some time ago, and one of the impressions that remains is that it took a long time to load. I may be wrong about that. Tom __ R-help@r-project.org 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] Transferring results from R to MS Word
Greg Snow wrote: Another alternative (since you asked) is the RExcel project (http://rcom.univie.ac.at). I don't know if it will work better for your projects or not, but it may be worth a look. The basic idea is that it uses Excel as a front end and R as the background computational engine as an Excel plugin. It has tools for transferring data automatically between Excel and R that may be easier for what you want (or not). There are also mechanisms for putting R code in a cell, having the code run through R and the output put into other cells in the spreadsheet. Thanks for the tip. I have already started looking into the documentation for that alternative. So far it looks interesting. Tom __ R-help@r-project.org 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] Transferring results from R to MS Word
Felipe Carrillo wrote: Are you still can't get the data into R? I sent you this -mail last week, did you read it? Yes I did read it, and I have installed the package and looked at the documentation. What I (after an admittently superficial inspection due to limited available time this weekend, the choir I am a member of had a concert yesterday on a monumental mass by Gounod) do not at the moment see is what the advantage of these functions are over standard read.table () and write.table (). I suppose I need to have another look. Using write.table () or similar things has at least two disadvantages as far as I can see. One is that it only works on objects which can be coerced into a table or frame. With other types of objects like summary(lm(formula)) you get an error message. Secondly, you end up with one file (or worksheet) for each thing you want to transfer, which may easily be a mess or confusing (or both). That is why I would prefer something along the lines of HTML, which means that several things may be pasted into the same worksheet, based on a keep things together that belong together kind of attitude. So, if you want one table combining means, standard deviations, and variable intercorrelations you do not want things in three different sheets or files, you want them in the same worksheet to begin with. However, at the moment it seems that there are bugs in the R2HTML package, hopefully they will be eliminated in the near future. There are also some parts of the documentation that I do not understand. The list of functions includes things like HTML.lm, as far as I can see are invisible, both in respect to documentation and usage. Tom __ R-help@r-project.org 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] Transferring results from R to MS Word2
Felipe Carrillo wrote: I've responded to this one in the original thread. Tom __ R-help@r-project.org 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] Transferring results from R to MS Word
Liviu Andronic wrote: On Sat, Oct 25, 2008 at 9:05 PM, Tom Backer Johnsen [EMAIL PROTECTED] wrote: I am a new user of R. My problem is how to read excel data files. How can I read a file called stock in R. What statement I should use? It could help to start learning R with a GUI like Rcmdr. Among other features, it supports importing Excel and CSV files. Liviu That is a good alternative. Tom -- ++ | Tom Backer Johnsen, Psychometrics Unit, Faculty of Psychology | | University of Bergen, Christies gt. 12, N-5015 Bergen, NORWAY | | Tel : +47-5558-9185Fax : +47-5558-9879 | | Email : [EMAIL PROTECTED]URL : http://www.galton.uib.no/ | ++ __ R-help@r-project.org 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] Transferring results from R to MS Word
Frank E Harrell Jr wrote: Tom Backer Johnsen wrote: Frank E Harrell Jr wrote: Tom Backer Johnsen wrote: I hadn't thought of the 'different random sample' approach. That's neat. Frank Yes, I am quite proud of that. The program that does the sampling and mailing is called Distras. Is that problem part of an open source project? That is my intention. Currently the program is written in Delphi (version 7), but it should be relatively easy to transfer it into a version that can be compiled with an open source Pascal compiler. Tom __ R-help@r-project.org 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] Transferring results from R to MS Word
To reply to myself, for anything that can be coerced into a table (matrices, vectors) the best solution seems to to use the write.table () function to write a .csv file, which is easily opened with a spreadsheet. The alternative is to use the HTML2clip () function (or the HTML function) in the R2HTML library and then paste the clipboard into Excel. That alternative seems to be OK for objects as returned by the lm () function, but little else. Among other things, the function is extremely heavyhanded in respect to rounding. To see what I mean, try HTML2clip (mean(attitude)). So, are there any other alternatives? Tom __ R-help@r-project.org 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] Transferring results from R to MS Word
Frank E Harrell Jr wrote: Tom Backer Johnsen wrote: Frank E Harrell Jr wrote: Tom Backer Johnsen wrote: Frank E Harrell Jr wrote: Tom Backer Johnsen wrote: I hadn't thought of the 'different random sample' approach. That's neat. Frank Yes, I am quite proud of that. The program that does the sampling and mailing is called Distras. Is that problem part of an open source project? That is my intention. Currently the program is written in Delphi (version 7), but it should be relatively easy to transfer it into a version that can be compiled with an open source Pascal compiler. I hope you'll keep the community posted on that. If you ever have a need for a function in R for linux that makes e-mailing easy, I have one. Now, that is interesting. I have not thought abut mailing from R. The main reason for writing the program in Delphi was that I had the compiler already and that is simple to program something that could mail. Having a copy of a mailing function for Linux would be useful in any case, so my response would simply be: Yes please. Would that function work with Ubuntu? One issue I need to face is that for project assignments involving more comprehensive analyses of datasets there are many right answers so automatic checking of results is difficult. Yes, that would be tricky. The problems my students get are quite simpleminded. In any case, the checking is not automatic, I still have to compare the answers from the students with my solution manually. Tom Frank Tom -- ++ | Tom Backer Johnsen, Psychometrics Unit, Faculty of Psychology | | University of Bergen, Christies gt. 12, N-5015 Bergen, NORWAY | | Tel : +47-5558-9185Fax : +47-5558-9879 | | Email : [EMAIL PROTECTED]URL : http://www.galton.uib.no/ | ++ __ R-help@r-project.org 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] Transferring results from R to MS Word
Gabor Grothendieck wrote: Seems there is a bug in one of the HTML methods in that digits= either does not get passed or used in certain cases. It does seem that the HTML.data.frame method is not affected so this would be a workaround: HTML2clip(as.data.frame(mean(attitude)), digits = 10) Ah. That is really useful. Thanks. However, it would be nice if the bug could be fixed in some way or another. I may be wrong, but I think that I have used the HTML function before with less problems. I suspect that the bug is a relatively recent one. Tom On Sun, Oct 26, 2008 at 9:58 AM, Tom Backer Johnsen [EMAIL PROTECTED] wrote: To reply to myself, for anything that can be coerced into a table (matrices, vectors) the best solution seems to to use the write.table () function to write a .csv file, which is easily opened with a spreadsheet. The alternative is to use the HTML2clip () function (or the HTML function) in the R2HTML library and then paste the clipboard into Excel. That alternative seems to be OK for objects as returned by the lm () function, but little else. Among other things, the function is extremely heavyhanded in respect to rounding. To see what I mean, try HTML2clip (mean(attitude)). So, are there any other alternatives? Tom __ R-help@r-project.org 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. -- ++ | Tom Backer Johnsen, Psychometrics Unit, Faculty of Psychology | | University of Bergen, Christies gt. 12, N-5015 Bergen, NORWAY | | Tel : +47-5558-9185Fax : +47-5558-9879 | | Email : [EMAIL PROTECTED]URL : http://www.galton.uib.no/ | ++ __ R-help@r-project.org 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] Transferring results from R to MS Word
Gabor Grothendieck wrote: I have sent an email to the maintainer about it. Thanks! Tom __ R-help@r-project.org 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] Transferring results from R to MS Word
Hans-Peter Suter wrote: what about: ?write.xls from my xlsReadWrite package? Sorry, I did not even think to look for something along the lines of what the name of the package suggests. I'll have a look at it! Tom __ R-help@r-project.org 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] Transferring results from R to MS Word
Frank E Harrell Jr wrote: Tom Backer Johnsen wrote: Greg Snow wrote: You may want to try the odfWeave package. It uses openoffice which can read and write MSWord documents. This is an alternative to the HTML Excel Word route. Now that is an interesting alternative. Not for this term though, to get the students to learn R and at the same time to change word processor would be far from optimal. Tom Several years ago I had new students learning S and LaTeX at the same time, using a LaTeX server to produce pdf so they didn't have to install LaTeX. It was 3 weeks of hell then they did fine. Yes, I have been thinking along those lines myself, but I have not had the courage to do so, at least not yet. The students are in what may be called a School of psychology (somewhat like medicine), the majority are girls with few ambitions toward using computers or science, in other words they have a distinctly soft orientation. The teaching of research methods and basic statistics for that kind of audience really is a challenge. The reason why I want to have larger accuracy is as follows: The students have a type home exam, I handed out the questions yesterday, and if they want to pass, they have to submit their response on Thursday. In addition they all received a unique data set in the mail, I have written a small program that generates a 50% random subset of a master data set and mails the data set to each student. I can then run a script file in R which will generate what each student should get with his or her data set on all questions. The purpose is of course to make it somewhat tricky for the students to directly copy between themselves, and my checking is easier if there are more decimals. Tom Frank -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare [EMAIL PROTECTED] 801.408.8111 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] project.org] On Behalf Of Tom Backer Johnsen Sent: Friday, October 24, 2008 1:31 PM To: [EMAIL PROTECTED] Subject: [R] Transferring results from R to MS Word R-users At the moment I am teaching a course on the use of R for data analysis. Part of course requirements involves the transfer of results from R to something that resembles the APA (American Psychological Associations) type tables to MS Word. Until now I have used the HTML function in the R2HTML library, with a call like this: HTML(summary(model1), file(clipboard, w), digits=4) Where model1 is an object containing results from a linear model (function lm ()). I have to add that I do not remember where I got the digits argument from. The main point is that the output is transferred to Excel as the first step where the output can be deleted and shuffled in order to produce a correctly formatted table according to APA standards which then is transferred to MS Word with a copy and paste operation. The problem is simply that what is tranferred to Excel varies with what you throw at the HTML function. Nothing is rounded of with an lm() model. With a function like sd () I seem to consistently get 2 decimal points transferred, less than what I want, while there are variations in respect to the number of decimals when I transfer the result on the summary () using a frame as the argument. The optimal thing for me (and the students) would be to consistently have all the decimals tranferred to Excel, any rounding to could be done there before the transfer of the table to MS Word. Alternatively, that something like the argument digits=x works in a consistent manner with at least most objects. So: What do I tell my students on what to do using R2HTML in order to obtain consistent results? Alternativly: are there other alternatives I and my students could use for the transfer of results from R via Excel to MS Word? I really would appreciate some suggestions. Tom -- ++ | Tom Backer Johnsen, Psychometrics Unit, Faculty of Psychology | | University of Bergen, Christies gt. 12, N-5015 Bergen, NORWAY | | Tel : +47-5558-9185Fax : +47-5558-9879 | | Email : [EMAIL PROTECTED]URL : http://www.galton.uib.no/ | ++ __ R-help@r-project.org 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] Transferring results from R to MS Word
Jasim Al-Ajmi wrote: Dear Tom I am a new user of R. My problem is how to read excel data files. How can I read a file called stock in R. What statement I should use? Thanks for your help. Thye simplest is to save your file as a .CSV file. This is a plain text file where the elements are separated with semicolons or commas. The names of the variables (columns) should be in the first row of the sheet. Look in the documentation for read.table (there are other alternatives as well). Call read.table naming your file (or use file.choose()) setting header=T, sep= to whatever seperates the values in your file, and na.strings = to whatever you identify your missing values with. Tom Best regards Jasim On Fri, Oct 24, 2008 at 10:30 PM, Tom Backer Johnsen [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: R-users At the moment I am teaching a course on the use of R for data analysis. Part of course requirements involves the transfer of results from R to something that resembles the APA (American Psychological Associations) type tables to MS Word. Until now I have used the HTML function in the R2HTML library, with a call like this: HTML(summary(model1), file(clipboard, w), digits=4) Where model1 is an object containing results from a linear model (function lm ()). I have to add that I do not remember where I got the digits argument from. The main point is that the output is transferred to Excel as the first step where the output can be deleted and shuffled in order to produce a correctly formatted table according to APA standards which then is transferred to MS Word with a copy and paste operation. The problem is simply that what is tranferred to Excel varies with what you throw at the HTML function. Nothing is rounded of with an lm() model. With a function like sd () I seem to consistently get 2 decimal points transferred, less than what I want, while there are variations in respect to the number of decimals when I transfer the result on the summary () using a frame as the argument. The optimal thing for me (and the students) would be to consistently have all the decimals tranferred to Excel, any rounding to could be done there before the transfer of the table to MS Word. Alternatively, that something like the argument digits=x works in a consistent manner with at least most objects. So: What do I tell my students on what to do using R2HTML in order to obtain consistent results? Alternativly: are there other alternatives I and my students could use for the transfer of results from R via Excel to MS Word? I really would appreciate some suggestions. Tom __ R-help@r-project.org mailto:R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html http://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- ++ | Tom Backer Johnsen, Psychometrics Unit, Faculty of Psychology | | University of Bergen, Christies gt. 12, N-5015 Bergen, NORWAY | | Tel : +47-5558-9185Fax : +47-5558-9879 | | Email : [EMAIL PROTECTED]URL : http://www.galton.uib.no/ | ++ __ R-help@r-project.org 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] Transferring results from R to MS Word
R-users At the moment I am teaching a course on the use of R for data analysis. Part of course requirements involves the transfer of results from R to something that resembles the APA (American Psychological Associations) type tables to MS Word. Until now I have used the HTML function in the R2HTML library, with a call like this: HTML(summary(model1), file(clipboard, w), digits=4) Where model1 is an object containing results from a linear model (function lm ()). I have to add that I do not remember where I got the digits argument from. The main point is that the output is transferred to Excel as the first step where the output can be deleted and shuffled in order to produce a correctly formatted table according to APA standards which then is transferred to MS Word with a copy and paste operation. The problem is simply that what is tranferred to Excel varies with what you throw at the HTML function. Nothing is rounded of with an lm() model. With a function like sd () I seem to consistently get 2 decimal points transferred, less than what I want, while there are variations in respect to the number of decimals when I transfer the result on the summary () using a frame as the argument. The optimal thing for me (and the students) would be to consistently have all the decimals tranferred to Excel, any rounding to could be done there before the transfer of the table to MS Word. Alternatively, that something like the argument digits=x works in a consistent manner with at least most objects. So: What do I tell my students on what to do using R2HTML in order to obtain consistent results? Alternativly: are there other alternatives I and my students could use for the transfer of results from R via Excel to MS Word? I really would appreciate some suggestions. Tom __ R-help@r-project.org 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] Text (eg. summary) to text file, Howto?
Peter Dalgaard wrote: Martin Privat wrote: Simple question... I would like to dump some summries of lm()'s to small seperate text files. I have looked at: print(), but it don't support output to file cat(), but it claims that 'sum1' is a list write, but that just uses cat()... The script goes something like this: ... lmMax - lm(NUMAMMON ~ *MM*DD) sum1 - summary(lmMax) # help needed here... how to dump sum1 to a small text file??? ... sink(foo.txt) sum1 sink() That works for one summary, but the second by default overwrites the first if you use the same file (yes, I have seen the separate word). It might be useful for him to have a look at the append option for sink (). Tom __ R-help@r-project.org 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 and computer heat
Alexandre Aguiar wrote: Hi, I noticed the temperature of my laptop rises sharply during execution of a long R script that generates several hundred plots, all of them saved to files. No screen output. Temps reached above 90 Celsius degrees in the box and above 80 C deg in the processor. The machine turns on cooler at maximum speed and exhaled air is really hot. Tried similar operations (batch graphic and music format conversion) and temp rises were usual. System: laptop, Turion 64, Kubuntu Linux, Xorg X server 1.4.0.90, KDE 3.5.9, R 2.7.2 compiled with MBCS, PCRE, etc. Could it be fake due to an interaction of some R piece with system monitors? Alexandre My guess is that it the graphics card which is hard at work. Tom __ R-help@r-project.org 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] Novice question about getting data into R
Silvia Lomascolo wrote: refdata = read.table(K:\\MerchantData\\RiskModel\\refund_distribution.csv, header = TRUE) Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, : line 1 did not have 42 elements refdata = read.table(K:\\MerchantData\\RiskModel\\refund_distribution.csv) Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, : line 2 did not have 42 elements R interprets that you have 42 columns from the variable names. Do you? See if removing spaces between column names helps (e.g., week.1 instead of week 1). Also, because yours is a csv file, fields are separated by comas. You can either use the read.csv command instead of the read.table (see ?read.table for details), or add the argument sep=, to tell R that fields are separated by comas. You might also need to specify, if you have empty cells, what to do with them (e.g., na.strings=) You are of course right about the NA's (missing values, empty cells) as well as the possible blanks in the column names. It might nevertheless be a good idea for him to at least submit a few of the lines at the top of the file. A .csv file as generated by Excel on Windows is not necessarily comma-separated. That depends on the list separator setting under Regional Language Settings found in the Control Panel. On my machine, the list separator is a semicolon for a .csv file. The reason is simple, in Norway, the standard decimal separator is a comma, and you do not want to confuse the system too much. So, that particular point is dependent on the settisngs for his locale (language, country). Tom -- ++ | Tom Backer Johnsen, Psychometrics Unit, Faculty of Psychology | | University of Bergen, Christies gt. 12, N-5015 Bergen, NORWAY | | Tel : +47-5558-9185Fax : +47-5558-9879 | | Email : [EMAIL PROTECTED]URL : http://www.galton.uib.no/ | ++ __ R-help@r-project.org 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] Using the shape () function
hadley wickham wrote: You might try using the reshape package instead: last - function(x) x[length(x)] names(d) - c(value, person, time) cast(d, person ~ time, last) The first and the last line I think is clear, although I will have to experiment more to understand the call on cast () better. However, what I do not understand is the purpose of the second line. I can print out names(d) right after the reading the frame with the read.table function. If I print names (d) right after that statement has been executed, then I see no difference. Even so, it seems to be necessary for the call on cast to work. It seems that names is not the same as names. Something along the lines of a with () or attach () perhaps? It's a small change - but cast requires the value column to be called value (no s!) Aha! Thank you! Tom Hadley __ R-help@r-project.org 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] Using the shape () function
In a research project we are using a web-based tools for collecting data from questionnaire. The system generates files that are simple to read as a data frame in the long format, which are simple to convert to the wide format. Something that might happen are: (a) there are two (multiple) references to the same cell, and (b) if there are missing values? So, the data set has two references to S2/T2 and none to the S2/T1 combination: d values person time 1 1 S1 T1 2 2 S1 T2 3 3 S1 T3 4 4 S1 T4 5 22 S2 T2 6 6 S2 T2 7 7 S2 T3 8 8 S2 T4 9 9 S3 T1 10 10 S3 T2 11 11 S3 T3 12 12 S3 T4 reshape (d, idvar=person, v.names=c(values), timevar=time, direction=wide) person values.T1 values.T2 values.T3 values.T4 1 S1 1 2 3 4 5 S2NA22 7 8 9 S3 9101112 The missing cell gets an NA as expected. But the surprise is in the case where there are two references to the same cell. The the *first* is used (22 rather than 6). Is there some way of forcing reshape () to use the *last* value? Tom __ R-help@r-project.org 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] Using the shape () function
hadley wickham wrote: On Tue, Jun 17, 2008 at 9:28 AM, Tom Backer Johnsen [EMAIL PROTECTED] wrote: In a research project we are using a web-based tools for collecting data from questionnaire. The system generates files that are simple to read as a data frame in the long format, which are simple to convert to the wide format. Something that might happen are: (a) there are two (multiple) references to the same cell, and (b) if there are missing values? So, the data set has two references to S2/T2 and none to the S2/T1 combination: d values person time 1 1 S1 T1 2 2 S1 T2 3 3 S1 T3 4 4 S1 T4 5 22 S2 T2 6 6 S2 T2 7 7 S2 T3 8 8 S2 T4 9 9 S3 T1 10 10 S3 T2 11 11 S3 T3 12 12 S3 T4 reshape (d, idvar=person, v.names=c(values), timevar=time, direction=wide) person values.T1 values.T2 values.T3 values.T4 1 S1 1 2 3 4 5 S2NA22 7 8 9 S3 9101112 The missing cell gets an NA as expected. But the surprise is in the case where there are two references to the same cell. The the *first* is used (22 rather than 6). You might try using the reshape package instead: last - function(x) x[length(x)] names(d) - c(value, person, time) cast(d, person ~ time, last) The first and the last line I think is clear, although I will have to experiment more to understand the call on cast () better. However, what I do not understand is the purpose of the second line. I can print out names(d) right after the reading the frame with the read.table function. If I print names (d) right after that statement has been executed, then I see no difference. Even so, it seems to be necessary for the call on cast to work. It seems that names is not the same as names. Something along the lines of a with () or attach () perhaps? Tom You can find out more at http://had.co.nz/reshape Hadley __ R-help@r-project.org 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] Frame from long to wide format
I have this frame in the long format which I want to convert to wide format. There are three columns in the frame, the id for the rows in the wide format, the name of the column where the final value (the third column) is to be placed. The complicating factor is that the long format is not complete in at least two ways, (a) there may be more than one reference to one cell in the wide format, in that case I want to use the last one, and (b) there may be no references to a cell in the wide format, and in that case I want the cell to be an NA. I have looked at and done some experiments with the unstack () function, this does not seem to do what I want. For instance, if there are more than one reference to a cell in the wide format, an extra row may be added or a list structure is produced. What I want is to generate a frame in a loose manner, more or less by the generation of a frame with the number of rows corresponding to the individuals (unique values) and columns (also unique values). If there are no references in the long format to a given cell, then the value should be NA, if there are more than one, the last one should be used. I can see (I think) how I could program this by the generation of a frame with the correct row and column names, fill that with NA's, and then use a for loop to assign a value for the long format to the correct cell in the frame. That is not elegant, but would work. Is it possible to be pointed towards alternatives? __ R-help@r-project.org 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 in caluclaring the multiple regression
man4ish wrote: I am trying to calculate the regression for the follwing input data stored in 'data.txt' file.I am reading this and storing it in the variable i .then i am trying to get the predicted value using f1 as dependent and others f2f10 as independent variables.It is giving the following error. Also i want that i shoul get one predicted value for each row(y). What should i do. Please help me out i will be thankful to you. i-read.table(data.txt,header=FALSE) i V1 V2 V3 V4 V5 V6 V7 V8 V9 V10 V11 1 molecule f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 2 m1 3 7 0 3 0 0 0 1 1 1 3 m2 2 7 0 2 0 2 0 1 0 1 4 m3 0 0 0 3 0 0 0 3 1 0 5 m4 3 7 0 1 3 0 0 0 0 1 attach(i) out-lm(y~x1+x2+x3+x4+x5+x6+x7+x8+x9+x10) Error in eval(expr, envir, enclos) : object y not found The explanation for the error message is trivial, there are no variables in the data frame with the names you specify in the call on lm (). The first row in the frame contains what probably are the intended names .. as data. Use header=TRUE in the read .table. On the other hand there are several other problem as well, the contents of the dependent variable as well as the number of dependent variables compared with the number of rows in the frame. Tom __ R-help@r-project.org 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] Re ad From EXCEL
ermimi wrote: Hello!!! I have been read a much about as read data from Excel File, but I haven´t found the necesary information to read the data. Now, I can create a channel : channel - odbcConnectExcel(file.xls) but I don´t know as read the data?? I hope that you could help me. Thank you very much. You are making an attempt at the most complex way of doing this. The simplest by far is (a) to read the data from the clipboard with the read.table () function, or (b) save the spreadsheet as a .csv type file and use the same function to read the file with the appropriate arguments for separators etc.. I tend to use the latter approach. In any case, once imported to R, the frame should be carefully checked against the contents of the spreadsheet. Tom __ R-help@r-project.org 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] Response to R across the university
Antony Unwin wrote: . The course itself went very well. We encouraged people to bring their laptops and work in groups. Using JGR as the interface to R helped a lot, as it was easier for people to load their own data and use the help. Of course, JGR is compulsory in Augsburg. Giving everyone a Butterbreze (a local delicacy) halfway through may have contributed to the good humour of the course as well! I apologize for my ignorance, but what is JGR? Tom __ R-help@r-project.org 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] [Fwd: Re: Assigning to multiple variables]
Scott Romans wrote: If we have a function that returns 2 or more values (such as dim as applied to a matrix), can we assign these 2 or more values to an equal number of differently named variables in one line? For example, is there any way to do something like this: [NumberRows NumberColumns] - dim(MatrixA) In that case R returns an object (a vector) with two values where the first is the number of rows and the second is the number of columns. Almost everything in R are objects. So: d - dim(attitude) rows - d[1] rows [1] 30 Tom __ R-help@r-project.org 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] [Fwd: Re: Response to R across the university]
Well, I downloaded the install JGR package for Windows and that seemed to work fine, after the installation I ended up with a modified R window which looked nice and uncluttered. Which I like. Very much. On the other hand, I cannot see how to launch the thing again once I have closed that window. There is supposed to be a launcher somewhere (JGR.exe?), but I have not been able to find it. It does not seem to be part of the installation, nor have I been able to locate it at the JGR site. However, there might be a possible problem on my side, at the moment I am working with a setup for Windows from the local IT department here in Bergen which behaves very strangely (I am going to pull the plug on on that one very soon), but there might possibly be a problem elsewhere. Would it be possible for someone to check? Tom __ R-help@r-project.org 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] Latent class analysis
Which package(s) contain something on latent class analysis? Tom -- ++ | Tom Backer Johnsen, Psychometrics Unit, Faculty of Psychology | | University of Bergen, Christies gt. 12, N-5015 Bergen, NORWAY | | Tel : +47-5558-9185Fax : +47-5558-9879 | | Email : [EMAIL PROTECTED]URL : http://www.galton.uib.no/ | ++ __ R-help@r-project.org 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] Latent class analysis
Thanks! Ingmar Visser wrote: and also check packages: flexmix, polca, depmix and a few others ... On 15 Feb 2008, at 11:01, Dimitris Rizopoulos wrote: check function lca() in package 'e1071'. Best, Dimitris Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +32/(0)16/336899 Fax: +32/(0)16/337015 Web: http://med.kuleuven.be/biostat/ http://www.student.kuleuven.be/~m0390867/dimitris.htm - Original Message - From: Tom Backer Johnsen [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, February 15, 2008 10:32 AM Subject: [R] Latent class analysis Which package(s) contain something on latent class analysis? Tom -- ++ | Tom Backer Johnsen, Psychometrics Unit, Faculty of Psychology | | University of Bergen, Christies gt. 12, N-5015 Bergen, NORWAY | | Tel : +47-5558-9185Fax : +47-5558-9879 | | Email : [EMAIL PROTECTED]URL : http://www.galton.uib.no/ | ++ __ R-help@r-project.org 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. Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm __ R-help@r-project.org 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. Ingmar Visser Department of Psychology, University of Amsterdam Roetersstraat 15 1018 WB Amsterdam The Netherlands t: +31-20-5256723 -- ++ | Tom Backer Johnsen, Psychometrics Unit, Faculty of Psychology | | University of Bergen, Christies gt. 12, N-5015 Bergen, NORWAY | | Tel : +47-5558-9185Fax : +47-5558-9879 | | Email : [EMAIL PROTECTED]URL : http://www.galton.uib.no/ | ++ __ R-help@r-project.org 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] Row percentages for a table object
I an stumbling on something that is probably very simple, but I cannot see the solution. I have an object generated by the table () function and want to recompute this table so each cell represents the percentage of the corresponding row sum. Of course a dedicated function can be written (which I have done), containing the necessary loops etc., but there should be a simpler way. I'd prefer something simple and as transparent as possible since it is for use in a text I am writing for my students. I have fiddled around with the apply () function but have so far been unable to find something that works. Any suggestions? Tom __ R-help@r-project.org 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] Row percentages for a table object
Tom Backer Johnsen wrote: Henrique Dallazuanna wrote: Try this: prop.table(table(data), 1) Ah. I misunderstood Peter Dalgaard (unnskyld Peter!). That gives what I want. Thank you! Tom On 07/02/2008, Tom Backer Johnsen [EMAIL PROTECTED] wrote: I an stumbling on something that is probably very simple, but I cannot see the solution. I have an object generated by the table () function and want to recompute this table so each cell represents the percentage of the corresponding row sum. Of course a dedicated function can be written (which I have done), containing the necessary loops etc., but there should be a simpler way. I'd prefer something simple and as transparent as possible since it is for use in a text I am writing for my students. I have fiddled around with the apply () function but have so far been unable to find something that works. Any suggestions? Tom __ R-help@r-project.org 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. -- ++ | Tom Backer Johnsen, Psychometrics Unit, Faculty of Psychology | | University of Bergen, Christies gt. 12, N-5015 Bergen, NORWAY | | Tel : +47-5558-9185Fax : +47-5558-9879 | | Email : [EMAIL PROTECTED]URL : http://www.galton.uib.no/ | ++ __ R-help@r-project.org 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] The R book
Christofer wrote: Hi Tom, Do you have a soft copy of that? Can I get a copy of that book? As far as I know, you have to buy it. That is what I did. Tom Regards, -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tom Backer Johnsen Sent: Wednesday, January 09, 2008 9:51 PM To: [EMAIL PROTECTED] Subject: [R] The R book I have just recieved The R book by Michael Crawley, and I am deeply impressed. Really. Chapter 2, Essentials of the R language taught me a lot. More than 900 pages of concentrated Information. Recommended! Tom -- ++ | Tom Backer Johnsen, Psychometrics Unit, Faculty of Psychology | | University of Bergen, Christies gt. 12, N-5015 Bergen, NORWAY | | Tel : +47-5558-9185Fax : +47-5558-9879 | | Email : [EMAIL PROTECTED]URL : http://www.galton.uib.no/ | ++ __ R-help@r-project.org 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] Randomization tests, grouped data
The other day I was looking into one of the classics in resampling, Eugene Edgington's Randomization Tests. This type of test is simple to do in R with things like a simple correlation, the sample () function is perfect for the purpose. However, things are more complex if you have grouped data, like a one-way ANOVA. The reason is that you have to avoid the consideration of what Edgington calls mirror samples, shuffles that only move data within the groups. After all, one only wants to consider changes bewteen groups. In that case (I think) the sample () function is too general. Are there something that can handle this in R? Tom __ R-help@r-project.org 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] Randomization tests, grouped data
Tom Backer Johnsen wrote: The other day I was looking into one of the classics in resampling, Eugene Edgington's Randomization Tests. This type of test is simple to do in R with things like a simple correlation, the sample () function is perfect for the purpose. However, things are more complex if you have grouped data, like a one-way ANOVA. The reason is that you have to avoid the consideration of what Edgington calls mirror samples, shuffles that only move data within the groups. After all, one only wants to consider changes bewteen groups. In that case (I think) the sample () function is too general. Are there something that can handle this in R? After a few hours thinking on and off about the problem, I suspect that the question may be stupid or silly (or both). If that is the case, I would very much like to know why. Again, Tom __ R-help@r-project.org 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] Randomization tests, grouped data
Johannes Hüsing wrote: Tom Backer Johnsen [EMAIL PROTECTED] [Fri, Jan 11, 2008 at 06:57:41PM CET]: [...] Are there something that can handle this in R? Have you considered the coin package? I'll have a look at it. After a few hours thinking on and off about the problem, I suspect that the question may be stupid or silly (or both). If that is the case, I would very much like to know why. I am not quite clear in my thinking anymore, but there are 2^2n permutations, of which (2n choose n) happen to yield the same effect. These cases are part of life and should be counted in the permutation test just as well. You might save a little bit of computation time by singling these group-preserving permutations out, but this is not worth the while at all. ' Sure, but the question is simply: Do the permutations that only shuffle things within groups introduce some kind of a bias? I have a feeling that this is worse if the groups are not equally large. Tom -- ++ | Tom Backer Johnsen, Psychometrics Unit, Faculty of Psychology | | University of Bergen, Christies gt. 12, N-5015 Bergen, NORWAY | | Tel : +47-5558-9185Fax : +47-5558-9879 | | Email : [EMAIL PROTECTED]URL : http://www.galton.uib.no/ | ++ __ R-help@r-project.org 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] An R is slow-article
Gustaf Rydevik wrote: Hi all, Reading the wikipedia page on R, I stumbled across the following: http://fluff.info/blog/arch/0172.htm It does seem interesting that the C execution is that much slower from R than from a native C program. Could any of the more technically knowledgeable people explain why this is so? The author also have some thought-provoking opinions on R being no-good and that you should write everything in C instead (mainly because R is slow and too good at graphics, encouraging data snooping). See http://fluff.info/blog/arch/0041.htm While I don't agree (granted, I can't really write C), it was interesting to read something from a very different perspective than I'm used to. The important aspect of R is not that it is less fast for a particular kind of operation than a dedicated program written in a compiled language like C, Pascal, or Fortran for a particular kind of analysis. That is not really surprising, and not relevant for anything but the most extreme situations given the speed (and low price) of modern computers. What is really relevant is (a) the context of any operation, R is a well documented language where a very large number number of operations may be combined in an extremely large number of ways where the probability of errors is very low, and (b) all aspects of the language is peer reviewed. Both points are extremely important in any research context, where everything, including the software used in computations, should be possible to document. These qualities are difficult to achieve in homebrewed programs. Therefore one should not resort to programming anything on your own unless the operations you need are definitely not present in the language you are using. Apart from that, you have to think about cost in respect to the time and resources used to develop your own substitutes for something that already exists. He also says that R encourages fishing trips in the data. Well, that may be somewhat true for R as well as any of the major statistical packages. But that is a problem that really is in a different domain, one of attitudes on how to do research in the first place. Tom Best regards, Gustaf _ Department of Epidemiology, Swedish Institute for Infectious Disease Control work email: gustaf.rydevik at smi dot ki dot se skype:gustaf_rydevik __ R-help@r-project.org 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. -- ++ | Tom Backer Johnsen, Psychometrics Unit, Faculty of Psychology | | University of Bergen, Christies gt. 12, N-5015 Bergen, NORWAY | | Tel : +47-5558-9185Fax : +47-5558-9879 | | Email : [EMAIL PROTECTED]URL : http://www.galton.uib.no/ | ++ __ R-help@r-project.org 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] The R book
I have just recieved The R book by Michael Crawley, and I am deeply impressed. Really. Chapter 2, Essentials of the R language taught me a lot. More than 900 pages of concentrated Information. Recommended! Tom -- ++ | Tom Backer Johnsen, Psychometrics Unit, Faculty of Psychology | | University of Bergen, Christies gt. 12, N-5015 Bergen, NORWAY | | Tel : +47-5558-9185Fax : +47-5558-9879 | | Email : [EMAIL PROTECTED]URL : http://www.galton.uib.no/ | ++ __ R-help@r-project.org 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] Is R portable?
Recently I came across an interesting web site: http://portableapps.com/. The idea is simple, this is software that is possible to install and run on some type of USB memory, a stick or one of these hard disks. I can think of a number of situations where this could be handy. In addition memory sticks are getting cheaper and more powerful by the day. So: Is it possible to run R off one of these sticks? I am also informed that it is possible to run Latex in this manner. Tom __ R-help@r-project.org 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] Is R portable?
Roland Rau wrote: Hi Tom, did you check the R for Windows FAQ? http://cran.r-project.org/bin/windows/base/rw-FAQ.html#Can-I-run-R-from-a-CD-or-USB-drive_003f Puh. My apologies. I should have done so before I asked the question. Sorry. Tom Hope this helps, Roland Tom Backer Johnsen wrote: Recently I came across an interesting web site: http://portableapps.com/. The idea is simple, this is software that is possible to install and run on some type of USB memory, a stick or one of these hard disks. I can think of a number of situations where this could be handy. In addition memory sticks are getting cheaper and more powerful by the day. So: Is it possible to run R off one of these sticks? I am also informed that it is possible to run Latex in this manner. Tom __ R-help@r-project.org 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. -- ++ | Tom Backer Johnsen, Psychometrics Unit, Faculty of Psychology | | University of Bergen, Christies gt. 12, N-5015 Bergen, NORWAY | | Tel : +47-5558-9185Fax : +47-5558-9879 | | Email : [EMAIL PROTECTED]URL : http://www.galton.uib.no/ | ++ __ R-help@r-project.org 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] Is R portable?
Prof Brian Ripley wrote: On Tue, 4 Dec 2007, John Kane wrote: I simply installed R onto a USB stick, downloaded my normal packages to it and it works fine under Windows. Yes, on Windows, but 1) There are other OSes, 2) This didn't just happen: it needed some careful design, including some caching to make it run fast from a USB disk. Nice to discover good planning. Am I then correct in my understanding: Installing R under Windows does not require any registry entries, the installation is essentially to unpack the necessary files in the correct directories? Tom Unix-alike ports of R are not completely portable, as the path to R_HOME is encapsulated in the R and Rscript front ends. So if on, say, Linux you want to plug in a USB disc then it will only work if you installed R to that USB disk mounted at the same location in the file system, or are prepared to edit the copies of the R script (which had therefore better be mounted read-write). The standard MacOS build has standard paths encapsulated in many places. --- Roland Rau [EMAIL PROTECTED] wrote: Hi Tom, did you check the R for Windows FAQ? http://cran.r-project.org/bin/windows/base/rw-FAQ.html#Can-I-run-R-from-a-CD-or-USB-drive_003f Hope this helps, Roland Tom Backer Johnsen wrote: Recently I came across an interesting web site: http://portableapps.com/. The idea is simple, this is software that is possible to install and run on some type of USB memory, a stick or one of these hard disks. I can think of a number of situations where this could be handy. In addition memory sticks are getting cheaper and more powerful by the day. So: Is it possible to run R off one of these sticks? I am also informed that it is possible to run Latex in this manner. Tom __ R-help@r-project.org 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@r-project.org 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@r-project.org 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. -- ++ | Tom Backer Johnsen, Psychometrics Unit, Faculty of Psychology | | University of Bergen, Christies gt. 12, N-5015 Bergen, NORWAY | | Tel : +47-5558-9185Fax : +47-5558-9879 | | Email : [EMAIL PROTECTED]URL : http://www.galton.uib.no/ | ++ __ R-help@r-project.org 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] Permutation test, grouped data
I am perfectly aware that this question is not an R question, at least not yet, but I have not succeeded in finding what I want in other ways, so ... What I am looking for are two algorithms, preferabley in Pascal, but other languages may do. For (a) systematic (complete) permutations for grouped data with unequal group sizes, and (b) random permutations for the same kind of data. I know of one source: E. S. Edgington (1980): Randomization Tests (program 4.1 and program 4.3), but those are written in Fortran with a lot of GO TO's which probably would not be very efficient even if I managed to manually these programs and do a correct translation. There must be some more modern ones around, but where? I need the algorithms for a program I have written for exploring structural balance in sociometric group structures. Tom ++ | Tom Backer Johnsen, Psychometrics Unit, Faculty of Psychology | | University of Bergen, Christies gt. 12, N-5015 Bergen, NORWAY | | Tel : +47-5558-9185Fax : +47-5558-9879 | | Email : [EMAIL PROTECTED]URL : http://www.galton.uib.no/ | ++ __ R-help@r-project.org 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] Permutation test, grouped data
Brian S Cade wrote: Tom: Paul Mielke, emeritus professor at Colorado State University, probably has some of the most efficient Fortran programs for enumerating all possible permutations of small sample sizes for grouped comparisons and Monte Carlo random sampling of the possible permutations for larger group sizes. The Fortran source code is available off his CSU Statistics Department web page. The code is for Mielke's multiresponse permutation procedures (MRPP), which includes permutation versions of ANOVA or t-tests as a special case. But where do I find documentation for the programs? Is that in the Spinger book? Tom ++ | Tom Backer Johnsen, Psychometrics Unit, Faculty of Psychology | | University of Bergen, Christies gt. 12, N-5015 Bergen, NORWAY | | Tel : +47-5558-9185Fax : +47-5558-9879 | | Email : [EMAIL PROTECTED]URL : http://www.galton.uib.no/ | ++ __ R-help@r-project.org 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.