[R] Group a dinamic number of vectors in a data.frame
Hi all, I need to create a data.frame from a variable number of vectors. The number of these vectors could change so I need a dinamic way to group all in a data.frame. The number is length(abc). e.g. vectors in my workspace N1 -c(1,2,3,4) N2 -c(1,2,3,4) N3 -c(1,2,3,4) abc -c(1,2,3) the data.frame I want to create: tcm -data.frame(OneVector, TwoVector, paste(N,1:length(abc))) Obviously :) if I am here this approach doesn't work, so any kind of tip is welcome. Cheers -- Daniele Medri __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Group a dinamic number of vectors in a data.frame
one way is: N1 - rnorm(4) N2 - rnorm(4) N3 - rnorm(4) N4 - rnorm(4) X1 - LETTERS[1:4] ### nams - c(paste(N, 1:4, sep = ), X1) dat - data.frame(lapply(nams, get)) names(dat) - nams dat # check also sapply(dat, data.class) I hope it helps. 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://www.med.kuleuven.be/biostat/ http://www.student.kuleuven.be/~m0390867/dimitris.htm - Original Message - From: Daniele Medri [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Sent: Monday, February 20, 2006 4:26 PM Subject: [R] Group a dinamic number of vectors in a data.frame Hi all, I need to create a data.frame from a variable number of vectors. The number of these vectors could change so I need a dinamic way to group all in a data.frame. The number is length(abc). e.g. vectors in my workspace N1 -c(1,2,3,4) N2 -c(1,2,3,4) N3 -c(1,2,3,4) abc -c(1,2,3) the data.frame I want to create: tcm -data.frame(OneVector, TwoVector, paste(N,1:length(abc))) Obviously :) if I am here this approach doesn't work, so any kind of tip is welcome. Cheers -- Daniele Medri __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Group a dinamic number of vectors in a data.frame
data.frame(OneVector, TwoVector, sapply(apropos(^N[0-9]*$), get, simplify = FALSE)) On 2/20/06, Daniele Medri [EMAIL PROTECTED] wrote: Hi all, I need to create a data.frame from a variable number of vectors. The number of these vectors could change so I need a dinamic way to group all in a data.frame. The number is length(abc). e.g. vectors in my workspace N1 -c(1,2,3,4) N2 -c(1,2,3,4) N3 -c(1,2,3,4) abc -c(1,2,3) the data.frame I want to create: tcm -data.frame(OneVector, TwoVector, paste(N,1:length(abc))) Obviously :) if I am here this approach doesn't work, so any kind of tip is welcome. Cheers -- Daniele Medri __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Plots: displaying mathematical symbols in specific fonts
Dear SavioRs, I am doing some research where characters in different microsoft fonts serve as experimental stimuli. Hence, in plot labels, I would like to display the characters in specific microsoft fonts. I have figured out how to display letters and numbers, but I am having trouble with symbols such as capital delta. Before I go further, I am using R 2.2.1 on Windows XP with everything in English. I am trying to save my plot as a windows metafile. To display different characters in verdana, for example, I first edit the Rdevga file so that it contains verdana. I can then get verdana letters and numbers on the plot using a text() command. Things within an expression() command, however, are not displayed in the desired font. For example, windows() plot(rnorm(15),rnorm(15)) text(0,0,expression(Delta),font=10) displays a capital delta, but it is not in font #10 within Rdevga. I can get characters that have one of the first 255 ascii codes using chars8bit() in the sfsmisc package. One example is the division sign: text(0,0.2,chars8bit(247),font=10) I have not been able to display other symbols in microsoft fonts, however. Is this possible to do in R? All replies are appreciated. -- Ed Merkle, PhD Department of Psychology Wichita State University Wichita, KS __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Time on x-axis
Hello, I just started using the GNU R. I am having trouble plotting my data. I am tryin to plot the following data: TIMESTAMPLOGIN-TIME (hh:mm:ss) (s) 23:55:03 0.990972 23:55:03 0.990972 23:50:04 0.878968 23:45:04 0.969271 23:40:03 0.868848 23:35:030.88141 23:30:03 0.679571 23:25:03 0.599834 23:20:03 0.663436 23:15:03 0.567414 23:10:02 0.738379 23:05:02 0.575764 with TIMESTAMP on the x-axis. The plot() function assumes the x-axis as the total number of events, and plots the desired graph. But I want the TIMESTAMP on the x-axis. If I try to change the x-axis, the y-axis gets modified too, and all I get is just a dot as a plot. Can someone tell me how I can make R plot my graph, with TIMESTAMP as my x-axis and LOGIN_TIME as my y-axis? Thank you. Sangeetha -- Sangeetha Swaminathan Graduate Assistant Innovative Technology Center (ITC) 2444 Dunford Hall The University of Tennessee Knoxville, TN 37996 Phone [O]:(865) 974-9672 [R]:(865) 946-4340 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Time on x-axis
Try this: # test data tt - c(23:05:02, 23:10:02, 23:15:03, 23:20:03, 23:25:03, 23:30:03, 23:35:03, 23:40:03, 23:45:04, 23:50:04, 23:55:03, 23:55:03) x - c(0.575764, 0.738379, 0.567414, 0.663436, 0.599834, 0.679571, 0.88141, 0.868848, 0.969271, 0.878968, 0.990972, 0.990972) library(zoo) library(chron) z - zoo(x, times(tt)) plot(z) Read the R Help Desk article in R News 4/1 about dates and times and also read the chron article in its references. Also read the zoo vignette which you can access like this: library(zoo) vignette(zoo) and also read ?axis in case you want to customize the axes. On 2/20/06, Sangeetha Swaminathan [EMAIL PROTECTED] wrote: Hello, I just started using the GNU R. I am having trouble plotting my data. I am tryin to plot the following data: TIMESTAMPLOGIN-TIME (hh:mm:ss) (s) 23:55:03 0.990972 23:55:03 0.990972 23:50:04 0.878968 23:45:04 0.969271 23:40:03 0.868848 23:35:030.88141 23:30:03 0.679571 23:25:03 0.599834 23:20:03 0.663436 23:15:03 0.567414 23:10:02 0.738379 23:05:02 0.575764 with TIMESTAMP on the x-axis. The plot() function assumes the x-axis as the total number of events, and plots the desired graph. But I want the TIMESTAMP on the x-axis. If I try to change the x-axis, the y-axis gets modified too, and all I get is just a dot as a plot. Can someone tell me how I can make R plot my graph, with TIMESTAMP as my x-axis and LOGIN_TIME as my y-axis? Thank you. Sangeetha -- Sangeetha Swaminathan Graduate Assistant Innovative Technology Center (ITC) 2444 Dunford Hall The University of Tennessee Knoxville, TN 37996 Phone [O]:(865) 974-9672 [R]:(865) 946-4340 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] doubt on periodogram
hi all, I am using the periodogram function provided by the GeneTS library in R. The periodogram function takes a time-series as input and returns a spec(a vector of values) and their frequencies. My requirement is, I have to loop through the values in this spec and then remove some of these, depending on whether they exceed some cutoff. I could not find any function to loop through the elements of spec in periodogram. Could you inform how I can do this. Example: --- myts - ts(c(1,2,3,40,3,2,5,40,2,3,1,40), frequency=1); myper - periodogram(myts); myper $spec [,1] [1,] 1.900321e+00 [2,] 8.33e-02 [3,] 1.064833e+03 [4,] 5.83e-01 [5,] 2.766346e+00 [6,] 1.045333e+03 $freq [1] 0.0833 0.1667 0.2500 0. 0.4167 0.5000 -- my cutoff is 4.00 and I wasnt to discard all the values in the above spec vector which are less than 4. Could you help me how could I do that. I did not find any attributes or functions in periodogram through which I can do this. Thanks and Regards, Pradeep Kumar Gunda __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Nested AIC
Greetings, I have recently come into some confusion over weather or not AIC results for comparing among models requires that they be nested. Reading Burnham Anderson (2002) they are explicit that nested models are not required, but other respected statisticians have suggested that nesting is a pre-requisite for comparison. Could anyone who feels strongly regarding either position post their arguments for or against nested models and AIC? This would assist me greatly in some analysis I am currently conducting. Many thanks, Aaron m aaron macneil school of marine science and technology university of newcastle newcastle upon tyne, uk ne1 7ru m.a.macneil at ncl.ac.uk __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] mva.pairs
Hello, I am using the following code to plot an MVA plot. library(affy) library(Biobase) library(limma) library(gcrma) pd-read.phenoData(Clk.targets.2.txt,header=TRUE, row.names=1,as.is=TRUE,sep=\t) Data - ReadAffy(filenames=pData(pd)$FileName,phenoData=pd) Print(Data) eset - gcrma(Data) write.exprs(eset, file=clk.6-23-05.txt) bitmap(clk-1.mva.jpg,width=15, height=12) mva.pairs(exprs(eset)[,c(19,20,21,22,23,24)],log.it=FALSE) dev.off() but I am getting an subscript out of bound error. Any Idea ? Thanks, Vijay [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Linux Distribution Choice
Ubuntu is a good choice : ) First, I will recommend you to take a look at: http://ubuntuguide.org/ Specially... http://ubuntuguide.org/#extrarepositories It is slightly out of date, but still is useful. Once you are done with that, installing R is quit simple. From a terminal -available from the menus in your panel-, type: $ sudo aptitude install r-base r-base-core r-base-html r-recommended r-doc-pdf And that's it! On the other hand, if you want to install from the source, you may try from a terminal the following: $ sudo apt-get build-dep r-base (A lot of *.deb's here) $ sudo aptitude install checkinstall Once you are done with that, get and unpack the R-source (once again on a terminal): $ wget -c http://cran.us.r-project.org/src/base/R-2/R-2.2.1.tar.gz $ tar -xzf R-2.2.1.tar.gz $ cd R-2.2.1 $ ./configure make make check (You may like to see the results of 'make check' to asses that everything went fine) Finally: $ sudo checkinstall (You may enter some info here or leave the defaults) And that's it! Whatever you choose, I strongly recommend to run: $ sudo apt-get build-dep r-base So you can install, and build, additional packages from CRAN. You may cut and paste the terminal commands, just be sure to omit the '$' symbol. Graham Smith wrote: Thanks to everyone on this. Iyt ha sgiven me some useful insights into the different options. I am going to try Ubuntu for the time being and see how I get on. Probably revewing the situatin once I understand a bit more about how Linux works. Graham [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- U.M.A. http://sophie.fata.unam.mx/ __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] glob2rx function not working
Dear R users, Inspired by previous list discussion of the glob2rxc function, I am attempting to create a new vector called TOTAL by summing all vectors whose names begin with ABC: TOTAL = sum(list = ls(pattern = glob2rx(ABC*))) I'm running R 2.2.1 on Windows XP. Can anyone say what I'm missing? Thank you, Mark __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Plots: displaying mathematical symbols in specific fonts
On Mon, 20 Feb 2006, Ed Merkle wrote: Dear SavioRs, I am doing some research where characters in different microsoft fonts serve as experimental stimuli. Hence, in plot labels, I would like to display the characters in specific microsoft fonts. I have figured out how to display letters and numbers, but I am having trouble with symbols such as capital delta. Before I go further, I am using R 2.2.1 on Windows XP with everything in English. I am trying to save my plot as a windows metafile. To display different characters in verdana, for example, I first edit the Rdevga file so that it contains verdana. I can then get verdana letters and numbers on the plot using a text() command. Things within an expression() command, however, are not displayed in the desired font. For example, No, they are *always* displayed in font 5, as the Rdevga file actually says. Verdana is not a mathematical font, and what you are looking for is the Greek letter Delta, not the mathematical symbol. windows() plot(rnorm(15),rnorm(15)) text(0,0,expression(Delta),font=10) displays a capital delta, but it is not in font #10 within Rdevga. I can get characters that have one of the first 255 ascii codes Hmm, there are only 128 ASCII codes. I guess you mean you are in CP1252 aka WinAnsi, the Windows approximation to ISO Latin-1, and so can only access the (somewhat less than) 256 glyphs of that charset. using chars8bit() in the sfsmisc package. One example is the division sign: text(0,0.2,chars8bit(247),font=10) You don't need that: the standard octal and hex escapes work. But if you want to draw symbols you should probably be using points() and pch=. E.g. points(0, 0.2, font=10, pch=247) I have not been able to display other symbols in microsoft fonts, however. Is this possible to do in R? All replies are appreciated. Yes, but only by switching to a Greek locale. For example Sys.setlocale(LC_CTYPE, greek) plot(1:10) text(8,2, \xC4, font=10) and that only on an NT-based version of Windows and the R-devel version of R. It's easier on Unix-alikes in a UTF-8 locale, as then you can use Unicode escapes like \u0394. But Windows does not have UTF-8 locales (although one day R may fake them -- actually internally it already can but there is no I/O support). There you could also do text(8, 2, \u0394) points(5, 7, font=4, pch=0x0394) at least if you have fonts which support Greek. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] glob2rx function not working
Your expression is trying to sum a character vector containing the names of the variables that begin with ABC. Try this and try executing each portion of it to understand it better: ABC1 - ABC2 - 1 do.call(sum, lapply(apropos(glob2rx(ABC*)), get)) # 2 On 2/20/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Dear R users, Inspired by previous list discussion of the glob2rxc function, I am attempting to create a new vector called TOTAL by summing all vectors whose names begin with ABC: TOTAL = sum(list = ls(pattern = glob2rx(ABC*))) I'm running R 2.2.1 on Windows XP. Can anyone say what I'm missing? Thank you, Mark __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] help on dyn.load()
Thanks a lot! It works now. Feng From: Roger Bivand [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: Feng Tai [EMAIL PROTECTED] CC: r-help@stat.math.ethz.ch Subject: Re: [R] help on dyn.load() Date: Mon, 20 Feb 2006 08:13:49 +0100 (CET) On Mon, 20 Feb 2006, Feng Tai wrote: Hi, I used .C to call the C functions inside R. Everything works fine on the linux sever. I installed cygwin on my windows xp x64 platform and used rcmd shlib xxx.c to compile. Everything works fine till now and xxx.dll is generated. But when I use dyn.load(xxx.dll) in R, it will open another R window and the original R window becomes Not responding, nothing loaded in both R window. Anyone has similar experiences before. Thanks a lot. It has been the case that you are recommended not to build shared library objects under Cygwin, but rather to follow the instructions in: http://www.murdoch-sutherland.com/Rtools/ carefully - that is build under Windows using the chosen tools. The other .dll files you report functioning correctly were built in this way, so the easiest thing to do is to build in the same way. BTW: I tried some other .dll files from the existed library. everything works ok. so I think maybe something wrong with my C code. But why it works fine on the linux server? Any guess or suggestion for this? Feng __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Roger Bivand Economic Geography Section, Department of Economics, Norwegian School of Economics and Business Administration, Helleveien 30, N-5045 Bergen, Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43 e-mail: [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] glob2rx function not working
[EMAIL PROTECTED] writes: Dear R users, Inspired by previous list discussion of the glob2rxc function, I am attempting to create a new vector called TOTAL by summing all vectors whose names begin with ABC: TOTAL = sum(list = ls(pattern = glob2rx(ABC*))) I'm running R 2.2.1 on Windows XP. Can anyone say what I'm missing? Probably, but I'll save the sarcasm... Consider this: ls() [1] as.alist.call f fire [4] Hgb perulung walk2 [7] x y zelazo ls(pattern=glob2rx(f*)) [1] ffire sum(list=ls(pattern=glob2rx(f*))) Error in sum(..., na.rm = na.rm) : invalid 'mode' of argument which is because sum(c(f,fire)) Error in sum(..., na.rm = na.rm) : invalid 'mode' of argument and has nothing to do with glob2rx, which is working fine. You may be looking for constructions like do.call(sum,lapply(ls(pattern=glob2rx(ABC*)), get))) or sum(unlist(lapply(ls(pattern=glob2rx(ABC*)), get))) -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Linux Distribution Choice
Ulises, Thanks for the helpful post but allow me to add one or two corrections: On 20 February 2006 at 11:40, Ulises M. Alvarez wrote: | Ubuntu is a good choice : ) | | First, I will recommend you to take a look at: | http://ubuntuguide.org/ | | Specially... | http://ubuntuguide.org/#extrarepositories | | It is slightly out of date, but still is useful. | | Once you are done with that, installing R is quit simple. From a | terminal -available from the menus in your panel-, type: | | $ sudo aptitude install r-base r-base-core r-base-html r-recommended | r-doc-pdf | | And that's it! The key here is the archive you point to. Ubuntu freezes every six months, so 5.10 does by design not have R 2.2.0 and 2.2.1 which were released after 5.10. See the R FAQ for the address of the Debian stable backport (and our thanks to Chris Steigies for building them); once you add the line to /etc/apt/sources.list you even get current packages so that $ apt-get install r-base can do its work. aptitude, wajig, ... and dozen other frontends then will as well, of course. The r-base meta package should imply all the one you listed above. This ought to work on Ubutu as well as was discussed on r-help last week. It may fail if and when Debian's and Ubuntu's libraries diverge. | On the other hand, if you want to install from the source, you may try | from a terminal the following: | | $ sudo apt-get build-dep r-base | (A lot of *.deb's here) Actually, 'apt-get install r-base-dev' should do the trick and was designed by Doug for just that. | $ sudo aptitude install checkinstall | | Once you are done with that, get and unpack the R-source (once again on | a terminal): | | $ wget -c http://cran.us.r-project.org/src/base/R-2/R-2.2.1.tar.gz | $ tar -xzf R-2.2.1.tar.gz | $ cd R-2.2.1 | $ ./configure make make check | (You may like to see the results of 'make check' to asses that | everything went fine) Configuring that way omits a lot of little goodies we have in the Debian package. I'd go with the prebuild ones, or locally rebuild from Debian sources. | Finally: | | $ sudo checkinstall | (You may enter some info here or leave the defaults) | | And that's it! | | Whatever you choose, I strongly recommend to run: | $ sudo apt-get build-dep r-base Again, 'r-base-dev' should cover that. | So you can install, and build, additional packages from CRAN. You may Or just use the 50-some existing ones in Debian and (K)Ubuntu. Do a $ apt-cache rdepends r-base-core to see all the packages depending on r-base-core, which includes all CRAN, Omegahat, ... packages we currently have. Dirk | cut and paste the terminal commands, just be sure to omit the '$' symbol. | | Graham Smith wrote: | Thanks to everyone on this. Iyt ha sgiven me some useful insights into the | | different options. I am going to try Ubuntu for the time being and see how I | get on. Probably revewing the situatin once I understand a bit more about | how Linux works. | | | | | Graham | | [[alternative HTML version deleted]] | | __ | R-help@stat.math.ethz.ch mailing list | https://stat.ethz.ch/mailman/listinfo/r-help | PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html | | | -- | U.M.A. | http://sophie.fata.unam.mx/ | | __ | R-help@stat.math.ethz.ch mailing list | https://stat.ethz.ch/mailman/listinfo/r-help | PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Hell, there are no rules here - we're trying to accomplish something. -- Thomas A. Edison __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] doubt on periodogram
Pradeep Gunda pradeep.gunda at gmail.com writes: hi all, I am using the periodogram function provided by the GeneTS library in R. myts - ts(c(1,2,3,40,3,2,5,40,2,3,1,40), frequency=1); myper - periodogram(myts); myper something like myper$spec - myper$spec[myper$spec4] Please take some time to sit down and read An Introduction to R, which came with your copy of R -- pages 11 and 12 will be especially helpful. If you find it too technical, try one of the many books or contributed pieces of documentation listed on the main R web site. cheers Ben Bolker __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] get predicted values of models fit by lmer()?
Greetings. I'm having trouble using lmer beyond a first step. After fitting my data using lmer(), I can use summary(model) to see a list of statistics and summary information. But I also need the predicted values, values of parameters for fixed and random effects and plots, etc. I don't how to preceed. Are there such methods for models fit by lmer()? Mingyu Feng Department of Computer Science Worcester Polytechnic Institute 508-831-5006 [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Boxplot Help for Neophyte
R helpers I am getting to grips with R but came across a small problem today that I could not fix by myself. I have 3 text files, each with a single column of data. I read them in using: myData1-scan(C:/Program Files/R/myData1.txt) myData2-scan(C:/Program Files/R/myData2.txt) myData3-scan(C:/Program Files/R/myData3.txt) I wanted to produce a chart with 3 boxplots of the data and used: boxplot(myData1, myData2, myData3) This worked fine so I consulted R [help(bxp)] to add some format and labels e.g. title= , xlab =, ylab= , notch=TRUE etc. I managed to figure that ok. However, I could not figure out how to get the labels myData1, myData2, and myData3 on the boxplot x-axis to denote which box was which (though I knew by looking). Can anybody help with this? I trawled through my downloaded R pdfs but could not find a way. Regards Alex Park __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Boxplot Help for Neophyte
Hi Alex, how about, myData-data.frame(myData1=myData1,myData2=myData2,myData3=myData3) boxplot(myData) Nolwenn ** Nolwenn Le Meur, PhD Fred Hutchinson Cancer Research Center Computational Biology 1100 Fairview Ave. N., M2-B876 P.O. Box 19024 Seattle, WA 98109-1024 On Mon, 20 Feb 2006, Alex Park wrote: R helpers I am getting to grips with R but came across a small problem today that I could not fix by myself. I have 3 text files, each with a single column of data. I read them in using: myData1-scan(C:/Program Files/R/myData1.txt) myData2-scan(C:/Program Files/R/myData2.txt) myData3-scan(C:/Program Files/R/myData3.txt) I wanted to produce a chart with 3 boxplots of the data and used: boxplot(myData1, myData2, myData3) This worked fine so I consulted R [help(bxp)] to add some format and labels e.g. title= , xlab =, ylab= , notch=TRUE etc. I managed to figure that ok. However, I could not figure out how to get the labels myData1, myData2, and myData3 on the boxplot x-axis to denote which box was which (though I knew by looking). Can anybody help with this? I trawled through my downloaded R pdfs but could not find a way. Regards Alex Park __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Boxplot Help for Neophyte
On Mon, 2006-02-20 at 20:27 +, Alex Park wrote: R helpers I am getting to grips with R but came across a small problem today that I could not fix by myself. I have 3 text files, each with a single column of data. I read them in using: myData1-scan(C:/Program Files/R/myData1.txt) myData2-scan(C:/Program Files/R/myData2.txt) myData3-scan(C:/Program Files/R/myData3.txt) I wanted to produce a chart with 3 boxplots of the data and used: boxplot(myData1, myData2, myData3) This worked fine so I consulted R [help(bxp)] to add some format and labels e.g. title= , xlab =, ylab= , notch=TRUE etc. I managed to figure that ok. However, I could not figure out how to get the labels myData1, myData2, and myData3 on the boxplot x-axis to denote which box was which (though I knew by looking). Can anybody help with this? I trawled through my downloaded R pdfs but could not find a way. Regards Alex Park Alex, You can use the 'names' argument to boxplot(): boxplot(myData1, myData2, myData3, names = c(myData1, myData2, myData)) If you want additional flexibility, note that by default (unless you change the 'at' argument), the group plots are drawn at integer axis values of 1:n, where 'n' is the number of groups. See the 'at' argument in ?boxplot. You can then use mtext() to draw further text if desired. HTH, Marc Schwartz __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Need frequency distribution for x,y coordinates
mark shanks wrote: Hi, I have a set of data in x,y coordinates across the range of -5 to 5 in each dimension. I would like to obtain the frequency distribution of the different points, and then graph them so you can see which of the points are the most frequently occurring. This would seem to be easy in Matlab, which has the hist3 command for doing frequency distributions/histograms in 3 dimensions. However, as far as I can tell, R does not have a hist3 command. If a 2D display is okay, you can use the color2D.matplot function in the plotrix package to plot the output of something like kde2d in MASS: x-seq(-5,5,by=0.1) xdens-kde2d(sample(x,500,TRUE),sample(x,500,TRUE),n=11) color2D.matplot(xdens$z,c(1,0),c(0,1),c(0,0), show.legend=TRUE,xlab=Columns,ylab=Rows) Jim __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] panel-VAR
Hi, Anybody knows if there is a package for panel VAR ? thanks __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Tobit Regression (residual Assumption)
Hi folks, I exchanged a couple of emails privately about tobit regression and advised that he (bambang pramono) ask the list for pointers to a basic, widely available, introductory reference. I think it would be a great help if someone would kindly suggest such a reference. Thanks, Jim __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] lattice: calling functions
On 2/14/06, Duncan Murdoch [EMAIL PROTECTED] wrote: On 2/14/2006 9:38 AM, Gabor Grothendieck wrote: On 2/14/06, Duncan Murdoch [EMAIL PROTECTED] wrote: On 2/14/2006 8:56 AM, Wolfram Fischer wrote: I defined three functions: fun0 - function( x=1:5, y=1:5, ... ) xyplot( y ~ x, ... ) fun1 - function( x=1:5, y=1:5, ... ) fun2( y ~ x, ... ) fun2 - function( ... ) xyplot( ... ) The call of fun0() works as expected. The call of fun1() causes the following error: 'Error in eval(expr, envir, enclos) : object y not found' How should I define fun2 to avoid the error? fun2 is fine, it's fun1 that has problems. It is passing a formula through fun2 to xyplot without telling xyplot where to evaluate the arguments. If you change it to fun1 - function( x=1:5, y=1:5, ... ) fun2( y ~ x, data=enviroment(), ... ) data=NULL works too, which is apparently what lm has. The point being that the environment of the formula is looked at, but the default data=parent.frame() subverts that because of the way eval works (using enclos only when envir is a list or data frame. What's wrong with environments?). Even the following works: fun1 - function( x=1:5, y=1:5, ... ) fun2( y ~ x, data = data.frame(x = x), ... ) I don't understand non-standard evaluation all that well, so I'll happily consider any suggestions. I'll try changing the defaults to NULL and see if there are any obvious problems. Deepayan it will tell xyplot to look in the current environment at the time of the call, i.e. the fun1 evaluation environment where x and y live. Although this does seem to be how xyplot works, I think it indicates there is a problem with it. The help file for xyplot indicates that for the xyplot formula method the default environment is the caller environment whereas it ought to be the environment of the formula: data: For the 'formula' method, a data frame containing values for any variables in the formula, as well as 'groups' and 'subset' if applicable. By default the environment where the function was called from is used. For example, if we replace xyplot with lm it does work as expected: fun1 - function( x=1:5, y=1:5, ... ) fun2( y ~ x, ... ) fun2 - function( ... ) lm( ... ) fun1() You're right, I forgot formulas have associated environments. I've added the lattice maintainer to the cc list. Duncan Murdoch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] need a R-code formatter?
Hi all, I am using Tin-R as my editor; I use it because it allows me to send several selected lines to R-console and execute them... In some sense, this is my line-by-line debugger. But it doesn't have a code formatter, I have to layout the indention myself -- when there are many { } blocks with different layers, this editor does not help me beautify the code... I am looking for some editor with better debugging support and with a R-code formatter? Thanks a lot! Michael. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] power law
Dear list, Does anyone know how to fit the power law distribution? I have the empirical distribution and would like to check whether it fits power law (with the power estimated from the data). Any hints are appreciated Best regards Galina [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] how to close all windows?
Hi all, I have 10+ graphic windows and 10+ R help window opening now... How do I close them all at once? Thanks a lot! [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Reanding a windows file
Dear R users Some one knows how to read a windows file with the adress like D:\CSV\Work\test.csv without change the \ by / by myself?! There is some function or parameter that read like the adress windows form. I tried to search somethig to substitute the \ by /, but I don't find... Thanks Alexandra Almeida Alexandra R. Mendes de Almeida - Internet rápida e grátis. Instale o discador agora! [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] SVM weights
Hello I am using e1071, svm. After tuning the parameters, I would like to get the weights assigned to the different features of my feature vector. This is to perform a feature reduction step by eliminating features with low discrimination values. How can i get the weight vector? best __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] standardizing data
Hello R team, IŽm looking for a way to standardize (z transformation= standard deviation 1 and mean 0) a row of x y coordinates in order to conduct a trend analysis. Does anyone know the command in R? many thanks for help in advance Christian __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Group a dinamic number of vectors in a data.frame
Hi all, I need to create a data.frame from a variable number of vectors. The number of these vectors could change so I need a dinamic way to group all in a data.frame. The number is length(abc). e.g. vectors in my workspace N1 -c(1,2,3,4) N2 -c(1,2,3,4) N3 -c(1,2,3,4) abc -c(1,2,3) the data.frame I want to create: tcm -data.frame(OneVector, TwoVector, paste(N,1:length(abc))) Obviously :) if I am here this approach doesn't work, so any kind of tip is welcome. Cheers -- Daniele Medri __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] How to read more than 1 table?
Question 1) I want to read many csv-tables and run the same commands for all of them. Is there some simpler solution than this below to solve this problem? for (g in 1:6) { if (g==1){k=kt1_0057} if (g==2){k=kt1_0101} if (g==3){k=kt1_0613} if (g==4){k=staten} if (g==5){k=tenpenny} if (g==6){k=fiddrunk} TABLE=read.table(paste(/home/user/,k,.csv,sep=),sep = ,, na.strings=.,header=F,fill=TRUE); print(TABLE) } Question 2) Is it possible to create new variables for example with the assistance of for-loop without initialising them beforehand? __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Using LAPACK in C-code to be loaded in R - getting-started-help
I want to speed up computations (involving matrices) by writing some C-code to be loaded. In the C-code, I need to invert matrices etc. As I've understood the writing R extensions doc, I can use use #include R_ext/Linpack.h in my .c-file and get access to linpack's facilities within my C-code. Is that correct? If so, can anyone point me to examples on how this is actually done in practice? Best regards Søren __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] [R-pkgs] Zigurrat updated
I've updated the Ziggurat normal and exponential generator in SuppDists in accordance with Leong, et.al (2005). A comment on the implementation of the Ziggurat Method. Jour. Stat. Sci. 12-7, 1-4. The fix takes care of problems for very large sets of random values. I tested it a bit on small samples and it seems ok. It will be on CRAN shortly. -- Bob Wheeler --- http://www.bobwheeler.com/ ECHIP, Inc. --- Randomness comes in bunches. ___ R-packages mailing list [EMAIL PROTECTED] https://stat.ethz.ch/mailman/listinfo/r-packages __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Reanding a windows file
Alexandra R. M. de Almeida [EMAIL PROTECTED] writes: Dear R users Some one knows how to read a windows file with the adress like D:\CSV\Work\test.csv without change the \ by / by myself?! There is some function or parameter that read like the adress windows form. I tried to search somethig to substitute the \ by /, but I don't find... Well, there's no problem with the backslashed form except if you try copying it literally into R source code. If you do, you run into problems with R interpreting the backslash as an escape character, which itself needs to be escaped (doubling the backslashes). You might for instance proceed as follows: x - readLines(,1) # input data on next line D:\CSV\Work\test.csv x [1] D:\\CSV\\Work\\test.csv mydata - read.csv(x) Notice that x as such has only single backslashes, it is just the print routine that inserts escape characters: cat(x,\n) D:\CSV\Work\test.csv nchar(x) [1] 20 123456789*123456789* -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] standardizing data
Christian Jones [EMAIL PROTECTED] writes: Hello R team, I´m looking for a way to standardize (z transformation= standard deviation 1 and mean 0) a row of x y coordinates in order to conduct a trend analysis. Does anyone know the command in R? many thanks for help in advance Christian What do you mean be a row of x y coordinates?? An N x 2 matrix? scale() could well be the answer. -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] standardizing data
Hey there, Did you try scale(x)? This centers and scales the data in a matrix x. Will On Feb 19, 2006, at 1:05 PM, Christian Jones wrote: Hello R team, IŽm looking for a way to standardize (z transformation= standard deviation 1 and mean 0) a row of x y coordinates in order to conduct a trend analysis. Does anyone know the command in R? many thanks for help in advance Christian __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting- guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] var-covar matrices comparison:
Hi, Using package gclus in R, I have created some graphs that show the trends within subgroups of data and correlations among 9 variables (v1-v9). Being interested for more details on these data I have produced also the var-covar matrices. Question: From a pair of two subsets of data (with 9 variables each, I have two var-covar matrices for each subgroup, that differ for a treatment on one group (treatment A) vs (non-Treatment A). Is there a software that can compare if two var-covar matrices are statistically the same? Below are a pair of two matrices, from several others. Thank you in advance for any input. Aldi First group var-covar matrix (the data were under treatment a) v1v2 v3 v4 v5 v6 v7v8 v9 v1 730.87 3.406 -283.41-74.68 107.57 -1355.13 -112.46 14.000 5.776 v2 3.41 24.950 105.45 -121.31 -307.68 -285.4029.65 -2.500 -7.796 v3 -283.41 105.451 6292.19 -2676.46 -970.80 29296.23 10715.29 3.156 -66.313 v4 -74.68-121.307 -2676.46 124492.30 -2289.47 -20377.34 -409.71 183.500 563.102 v5 107.57-307.681 -970.80 -2289.47 7045.62 12118.09 954.51 38.258 96.355 v6 -1355.13-285.404 29296.23 -20377.34 12118.09 218555.93 70126.71 137.000-130.667 v7 -112.46 29.645 10715.29 -409.71 954.51 70126.71 28239.57 67.989 -26.370 v814.00 -2.500 3.16183.50 38.26137.0067.99 24.500 9.000 v9 5.78 -7.796 -66.31563.10 96.35 -130.67 -26.37 9.000 22.776 Second group var-covar matrix (the data were NOT under treatment a) v1v2 v3 v4 v5 v6 v7v8 v9 v1 2696.25 27.05 201.06 2745.54 -344.39540.48654.20 34.363 7.623 v227.05 86.37 -96.89 -497.28 -1185.10 -3108.71 -910.38 -4.254 -9.115 v3 201.06 -96.89 10647.26 8378.07 595.81 66122.43 26237.21 -65.093 -51.998 v4 2745.54 -497.28 8378.07 408391.25 -3887.28 40477.40 30652.01 450.539 50.311 v5 -344.39-1185.10 595.81 -3887.28 29204.00 65320.00 15238.41 -98.237 102.975 v6 540.48-3108.71 66122.43 40477.40 65320.00 549955.14 194691.90-555.552 -95.210 v7 654.20 -910.38 26237.21 30652.01 15238.41 194691.90 82698.88 -70.417 -75.585 v834.36 -4.25 -65.09450.54 -98.24 -555.55-70.42 79.689 8.164 v9 7.62 -9.11 -52.00 50.31 102.97-95.21-75.58 8.164 30.492 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Reanding a windows file
On 2/16/2006 12:39 PM, Alexandra R. M. de Almeida wrote: Dear R users Some one knows how to read a windows file with the adress like D:\CSV\Work\test.csv without change the \ by / by myself?! There is some function or parameter that read like the adress windows form. I tried to search somethig to substitute the \ by /, but I don't find... Use file.choose(), and don't type anything at all. Duncan Murdoch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] How to read more than 1 table?
Atte Tenkanen wrote: Question 1) I want to read many csv-tables and run the same commands for all of them. Is there some simpler solution than this below to solve this problem? for (g in 1:6) { if (g==1){k=kt1_0057} if (g==2){k=kt1_0101} if (g==3){k=kt1_0613} if (g==4){k=staten} if (g==5){k=tenpenny} if (g==6){k=fiddrunk} TABLE=read.table(paste(/home/user/,k,.csv,sep=),sep = ,, na.strings=.,header=F,fill=TRUE); put your filenames in a character vector filenames: filenames - paste( c(kt1_0057, ...), .csv, sep=) tables - lapply( filenames, function(x) read.table(file=x, na.strings= ..., ...) ) and if you want to repeat the same task for your six tables do it with lapply() or sapply() print(TABLE) } Question 2) Is it possible to create new variables for example with the assistance of for-loop without initialising them beforehand? This way: sapply(1:10, function(i) your.task(i) ) sapply() will do the initialization for you! Kjetil __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] need a R-code formatter?
You can use emacs with ESS - and/or try to encourage (kindly) the creator of Tinn-R to create such a code-formatter... Best Søren Fra: [EMAIL PROTECTED] på vegne af Michael Sendt: on 15-02-2006 07:05 Til: R-help@stat.math.ethz.ch Emne: [R] need a R-code formatter? Hi all, I am using Tin-R as my editor; I use it because it allows me to send several selected lines to R-console and execute them... In some sense, this is my line-by-line debugger. But it doesn't have a code formatter, I have to layout the indention myself -- when there are many { } blocks with different layers, this editor does not help me beautify the code... I am looking for some editor with better debugging support and with a R-code formatter? Thanks a lot! Michael. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] How to read more than 1 table?
for (k in list.files()){ ... } best Søren Fra: [EMAIL PROTECTED] på vegne af Atte Tenkanen Sendt: ma 20-02-2006 22:40 Til: r-help@stat.math.ethz.ch Emne: [R] How to read more than 1 table? Question 1) I want to read many csv-tables and run the same commands for all of them. Is there some simpler solution than this below to solve this problem? for (g in 1:6) { if (g==1){k=kt1_0057} if (g==2){k=kt1_0101} if (g==3){k=kt1_0613} if (g==4){k=staten} if (g==5){k=tenpenny} if (g==6){k=fiddrunk} TABLE=read.table(paste(/home/user/,k,.csv,sep=),sep = ,, na.strings=.,header=F,fill=TRUE); print(TABLE) } Question 2) Is it possible to create new variables for example with the assistance of for-loop without initialising them beforehand? __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Using LAPACK in C-code to be loaded in R - getting-started-help
Are you talking about LAPACK (title) or LINPACK (body)? On Mon, 20 Feb 2006, Søren Højsgaard wrote: I want to speed up computations (involving matrices) by writing some C-code to be loaded. In the C-code, I need to invert matrices etc. As I've understood the writing R extensions doc, I can use use #include R_ext/Linpack.h in my .c-file and get access to linpack's facilities within my C-code. Is that correct? Only for some of the functions listed in that file: please consult it. If so, can anyone point me to examples on how this is actually done in practice? On CRAN, Linpack: RandomFields fracdiff glmmML mgcv LAPACK: lots, e.g, MNP kernlab knncat rmetasim supclust -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595__ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Unable to configure R 2.2.1 on Solaris 5.10 x86_64
Hello, Apologies for the post here. I have read the R-Admin (learned a lot!) and searched the web for days, but still fail at compiling R on my Ultra 20 running solaris 10 x86 1/06. This is the tail of './configure' output: . checking for dlopen in -ldl... yes checking readline/history.h usability... no checking readline/history.h presence... no checking for readline/history.h... no checking readline/readline.h usability... no checking readline/readline.h presence... no checking for readline/readline.h... no checking for rl_callback_read_char in -lreadline... no checking for main in -lncurses... no checking for main in -ltermcap... yes checking for rl_callback_read_char in -lreadline... no checking for history_truncate_file... no configure: error: --with-readline=yes (default) and headers/libs are not available My R-2.2.1/config.site has the following changes from default: CC=cc -xtarget=opteron -xarch=amd64 CFLAGS=-xO5 -xlibmil -dalign CPPFLAGS=-I/opt/sfw/include -I/opt/sfw/include/readline \ -I/opt/csw/include -I/opt/SUNWspro/include -I/opt/csw/include/readline F77=f95 -xarch=amd64 -xtarget=opteron FFLAGS=-xO5 -xlibmil -dalign LDFLAGS=-L/opt/SUNWspro/lib/amd64/ -L/opt/sfw/lib -L/opt/csw/lib CXX=CC -xarch=amd64 -xtarget=opteron CXXFLAGS=-xO5 -xlibmil -dalign R_BROWSER=mozilla MAKE=gmake My .zshrc file has the following (as I saw that some of the LDFLAGS should match my LD_LIBRARY_PATH and CONFIG_SHELL=/bin/ksh): LD_LIBRARY_PATH=/opt/sfw/include:/opt/sfw/include/readline:/usr/local/lib:/usr/X/lib:/usr/lib:/usr/ucblib:/lib:/usr/ccs/lib:/etc/lib:/usr/dt/lib:/opt/SUNWspro/lib/amd64/:/opt/sfw/lib:/opt/csw/lib Readline (version 4.2 from the Sun Companion CD) is located in /opt/sfw/include/readline. Both the readline.h and history.h files are there. Version 5.0 is located in /opt/csw/include/readline (from Blastwave). As you can see, I am new at compiling in general and Solaris specifically. Any help would be greatly appreciated. System information: System = SunOS Release = 5.10 KernelID = Generic_118844-26 Machine = i86pc OEM# = 0 Origin# = 1 NumCPU = 1 thanks, aric __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] linear discriminant analysis in MASS
Hello R people I now know how to run my discriminant analysis with the lda function in MASS: lda.alain=lda(Groupes ~ Ht.D0 + Lc.Dc + Ram + IDF, gr, CV = FALSE) and it works fine. But I am missing a test and cannot find any help on how to get it, if it exist. The S equivalent: discrim(structure(.Data = Groupes ~ Ht.D0 + Lc.Dc + Ram + IDF, class = formula), data = gr, family = Canonical(cov.structure = homoscedastic), na.action = na.omit, prior = proportional) outputs a nice matrix of Mahalanobis distances between groups and even tests (Hotelling's T Squared) for significant distances. Why don't I just take the S output you say? Because like you, I'd rather put in my paper that I did it using R of course! Does anyone know of a way to get this test out of lda? Or of another R package that does it? Thanks Alain (on peut me répondre en français aussi, évidemment!) -- Alain Paquette Laboratoire d'écologie végétale Institut de recherche en biologie végétale Université de Montréal 4101 rue Sherbrooke Est Montréal (Québec) H1X 2B2 [EMAIL PROTECTED] labo (514) 872-8488 fax (514) 872-9406 http://www.irbv.umontreal.ca/francais/personnel/cogliastro-paquette.htm __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] bVar slot of lmer objects and standard errors
Hello, I'm sorry to resurrect this thread that I started almost two months ago. I've been pretty busy since I posted my question and the issue is not that high on my priority list. Thanks to all those who replied, and I hope I can tickle your interest again. As a reminder, my question was how one can extract the conditional posterior variance of a random effect from the bVar slot of an lmer model. Thanks to your answers, I now understand that I have to use the diagonal elements of the conditional matrices. However, I am not quite sure what this means: Douglas Bates wrote: I'd have to go back and check but I think that these are the upper triangles of the symmetric matrix (as Spencer suggested) that are the conditional variance-covariance matrices of the two-dimensional random effects for each school up to a scale factor. That is, I think each face needs to be multiplied by s^2 to get the actual variance-covariance matrix. What is s^2? Where can I find it in the lmer object? I tried reading the source, but gave up fairly quickly. Thanks in advance for your replies, and this time I promise I'll be more responsive. Uli My original post: Hello, I am looking for a way to obtain standard errors for emprirical Bayes estimates of a model fitted with lmer (like the ones plotted on page 14 of the document available at http://www.eric.ed.gov/ERICDocs/data/ericdocs2/content_storage_01/000b/80/2b/b3/94.pdf). Harold Doran mentioned (http://tolstoy.newcastle.edu.au/~rking/R/help/05/08/10638.html) that the posterior modes' variances can be found in the bVar slot of lmer objects. However, when I fit e.g. this model: lmertest1-lmer(mathtot~1+(m_escs_c|schoolid),hlmframe) then [EMAIL PROTECTED] is a three-dimensional array with dimensions (2,2,28). The factor schoolid has 28 levels, and there are random effects for the intercept and m_escs_c, but what does the third dimension correspond to? In other words, what are the contents of bVar, and how can I use them to get standard errors? Thanks in advance for your answers and Merry Christmas, Uli Keller __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Linux Distribution Choice
I thought I'd add my vote for Gentoo, which has been my distro of choice for some time (although Slackware is very good as well, and teaches you a lot about *NIX in general). The main advantage of gentoo is that updating is very easy using the portage system (as pointed out by jon butchar), but unlike other distributions which have packages which are compiled for generic x86 architechtures, you get one that is custom compiled to your architechture and with the options you want compiled in (throught the USE flags). This is the point that Alexandre Santos Aguiar was making. Its a little more complicated to install the say Ubuntu where you just drop the disc in the CD-ROM and point and click you way through, but the documentation is second to none, and is extremly detailed. In addition the forums are really useful as well (although you may want to use Google to search them as the default search engine isn't that brilliant). If you were to go with this option then I would recommend writing your own script for installing packages (again from source). An example of one that I have written can be found at http://slack.ser.man.ac.uk/progs/R/scripts/install.genetics.R This way all the packages are installed from source and custom compiled as well. HTH's Neil -- Religion is the work of the Devil - Anon Email - [EMAIL PROTECTED] / [EMAIL PROTECTED] Website - http://slack.ser.man.ac.uk/ Blog - http://slack---line.blogspot.com/ Flickr - http://www.flickr.com/photos/slackline/ __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] How to sum values across multiple variables using a wildcard?
I have a dataframe called data with 5 records (in rows) each of which has been scored on each of many variables (in columns). Five of the variables are named var1, var2, var3, var4, var5 using headers. The other variables are named using other conventions. I can create a new variable called var6 with the value 15 for each record with this code: var6=var1+var2+var3+var4+var5 but this is tedious for my real dataset with dozens of variables. I would rather use a wildcard to add up all the variables that begin with Var like this pseudocode: Var6=sum(var*) Any suggestions for implementing this in R? Thanks! Mark __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] do.call, browser and traceback
A problem that I've encountered when using do.call a lot is very large stack traces, eg: f - function(x) stop() do.call(error, mtcars) traceback() f - function(x) browser() do.call(f, mtcars) I have hacked together my own version of traceback to fix this by limiting the length of each line to 80 characters, but I can't see any way to do something similar for browser. Any suggestions? Thanks, Hadley __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Tobit Regression (residual Assumption)
The second edition of Jeff Wooldridge's Introductory Econometrics, a modern approach has a subsection on tobit regression and should be widely available. It was written for undergraduate economics majors. --Gray On 2/13/06, Jim Lemon [EMAIL PROTECTED] wrote: Hi folks, I exchanged a couple of emails privately about tobit regression and advised that he (bambang pramono) ask the list for pointers to a basic, widely available, introductory reference. I think it would be a great help if someone would kindly suggest such a reference. Thanks, Jim __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Gray Calhoun Economics Department UC San Diego __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] do.call, browser and traceback
If f is long then you can get some savings like this: do.call(f, mtcars) # note: used f rather than f This does not solve the whole problem but its a step. On 2/20/06, hadley wickham [EMAIL PROTECTED] wrote: A problem that I've encountered when using do.call a lot is very large stack traces, eg: f - function(x) stop() do.call(error, mtcars) traceback() f - function(x) browser() do.call(f, mtcars) I have hacked together my own version of traceback to fix this by limiting the length of each line to 80 characters, but I can't see any way to do something similar for browser. Any suggestions? Thanks, Hadley __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] How to sum values across multiple variables using a wildcard?
See: ?rowSums On 2/20/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I have a dataframe called data with 5 records (in rows) each of which has been scored on each of many variables (in columns). Five of the variables are named var1, var2, var3, var4, var5 using headers. The other variables are named using other conventions. I can create a new variable called var6 with the value 15 for each record with this code: var6=var1+var2+var3+var4+var5 but this is tedious for my real dataset with dozens of variables. I would rather use a wildcard to add up all the variables that begin with Var like this pseudocode: Var6=sum(var*) Any suggestions for implementing this in R? Thanks! Mark __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] R and packages
Dear R People: Here is yet another strange problem. I'm using R in one of my classes. However, the computer lab has something called Deep Freeze and the students cannot save anything to the hard drive. I had R installed and things were working well. They would save their .Rdata files to disks. Now, we need to add more packages. We can't download and we can't bring them in via zip files (already tried both!) When the zip files are expanded, of course they build new directories.. I'm completely annoyed because learning to download packages and installing them from local zips are actually important tasks! We're also losing good teaching/learning time! Anyhow, what I would like to do is produce a sort of combination R installation exe with our extra libraries as part of the package. Does anyone have any suggestions on how this could be done, please? This is R for Windows, Version 2.2.1 Thanks for any help! Sorry about the totally weird problem! Sincerely, Erin Hodgess Associate Professor Department of Computer and Mathematical Sciences University of Houston - Downtown mailto: [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] How to sum values across multiple variables using a wildcard?
data - data.frame(var1=c(1,2,3), var2=c(3,4,5), var3=c(4,5,6), foo = c(100,200,300)) # sum rows with var in their name rowSums(data[, grep(var, names(data))]) 1 2 3 8 11 14 [EMAIL PROTECTED] wrote: I have a dataframe called data with 5 records (in rows) each of which has been scored on each of many variables (in columns). Five of the variables are named var1, var2, var3, var4, var5 using headers. The other variables are named using other conventions. I can create a new variable called var6 with the value 15 for each record with this code: var6=var1+var2+var3+var4+var5 but this is tedious for my real dataset with dozens of variables. I would rather use a wildcard to add up all the variables that begin with Var like this pseudocode: Var6=sum(var*) Any suggestions for implementing this in R? Thanks! Mark __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Simon Blomberg, B.Sc.(Hons.), Ph.D, M.App.Stat. Centre for Resource and Environmental Studies The Australian National University Canberra ACT 0200 Australia T: +61 2 6125 7800 email: Simon.Blomberg_at_anu.edu.au F: +61 2 6125 0757 CRICOS Provider # 00120C __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] How to sum values across multiple variables using a wildcard?
On Mon, 2006-02-20 at 18:41 -0600, [EMAIL PROTECTED] wrote: I have a dataframe called data with 5 records (in rows) each of which has been scored on each of many variables (in columns). Five of the variables are named var1, var2, var3, var4, var5 using headers. The other variables are named using other conventions. I can create a new variable called var6 with the value 15 for each record with this code: var6=var1+var2+var3+var4+var5 but this is tedious for my real dataset with dozens of variables. I would rather use a wildcard to add up all the variables that begin with Var like this pseudocode: Var6=sum(var*) Any suggestions for implementing this in R? Thanks! Mark Here is one approach using grep(). Given a data frame called MyDF with the following structure: str(MyDF) `data.frame': 10 obs. of 20 variables: $ other4 : num -0.869 0.376 -2.022 0.619 -0.129 ... $ var8 : num -0.380 1.428 -1.075 -0.796 -0.588 ... $ var4 : num -0.0850 -0.7335 -0.5019 -1.1633 -0.0197 ... $ other9 : num 0.0210 -0.6455 0.0289 1.2405 -1.3359 ... $ var10 : num 0.647 -0.798 0.180 1.135 -0.258 ... $ other2 : num 0.1332 -0.2227 0.0423 0.6881 2.0304 ... $ other10: num 0.811 2.166 0.569 0.302 0.669 ... $ var1 : num -0.774 -1.812 -1.230 -0.969 0.245 ... $ var2 : num -0.0538 0.3712 0.8222 -0.8025 -0.6914 ... $ other6 : num 0.871 0.291 2.079 1.098 1.025 ... $ other1 : num -0.5130 0.1358 0.8744 0.0997 1.7458 ... $ var9 : num 0.664 -0.456 0.415 2.090 -0.283 ... $ other3 : num -0.425 -0.283 0.706 -1.879 -0.828 ... $ other7 : num 0.100 0.177 0.570 -0.631 -1.009 ... $ var3 : num 1.446 -0.862 0.184 1.077 0.146 ... $ var5 : num 0.402 -0.498 -0.906 0.641 1.690 ... $ var6 : num 0.892 -0.242 0.561 0.530 -0.291 ... $ other5 : num -1.210 0.815 -1.284 -0.152 0.329 ... $ other8 : num -0.265 -1.278 1.152 0.232 -1.189 ... $ var7 : num -0.616 -0.994 -0.263 1.626 -1.372 ... Note that the column names are either var* or other*. Using grep() we get the indices of the column names that contain other plus one or more following characters, where the other begins the word: grep(\\bother., names(MyDF)) [1] 1 4 6 7 10 11 13 14 18 19 See ?regexp for more information. Note that I use \\b to being the search at the starting word boundary and then . to require that there be following characters. Thus, this would not match other1 or other. You can then use the following to subset the data frame MyDF and sum the rows for the requested columns: rowSums(MyDF[, grep(\\bother., names(MyDF))]) 1 2 3 4 5 6 7 -1.344893 1.531417 2.715234 1.616971 1.307379 4.655568 4.638446 8 910 -2.640485 -2.226270 -2.158248 You could use grep(other, names(MyDF)), but this would also get other if it appears anywhere in the name. For example: grep(other, Thisotherone) [1] 1 It just depends upon your naming schema and how strict you need to be in the search. HTH, Marc Schwartz __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] How to sum values across multiple variables using a wildcard?
Thanks Gabor, Simon and Marc...I got this to work with the grep() and rowSums examples you provided. Mark On 2/20/06, Marc Schwartz [EMAIL PROTECTED] wrote: On Mon, 2006-02-20 at 18:41 -0600, [EMAIL PROTECTED] wrote: I have a dataframe called data with 5 records (in rows) each of which has been scored on each of many variables (in columns). Five of the variables are named var1, var2, var3, var4, var5 using headers. The other variables are named using other conventions. I can create a new variable called var6 with the value 15 for each record with this code: var6=var1+var2+var3+var4+var5 but this is tedious for my real dataset with dozens of variables. I would rather use a wildcard to add up all the variables that begin with Var like this pseudocode: Var6=sum(var*) Any suggestions for implementing this in R? Thanks! Mark Here is one approach using grep(). Given a data frame called MyDF with the following structure: str(MyDF) `data.frame': 10 obs. of 20 variables: $ other4 : num -0.869 0.376 -2.022 0.619 -0.129 ... $ var8 : num -0.380 1.428 -1.075 -0.796 -0.588 ... $ var4 : num -0.0850 -0.7335 -0.5019 -1.1633 -0.0197 ... $ other9 : num 0.0210 -0.6455 0.0289 1.2405 -1.3359 ... $ var10 : num 0.647 -0.798 0.180 1.135 -0.258 ... $ other2 : num 0.1332 -0.2227 0.0423 0.6881 2.0304 ... $ other10: num 0.811 2.166 0.569 0.302 0.669 ... $ var1 : num -0.774 -1.812 -1.230 -0.969 0.245 ... $ var2 : num -0.0538 0.3712 0.8222 -0.8025 -0.6914 ... $ other6 : num 0.871 0.291 2.079 1.098 1.025 ... $ other1 : num -0.5130 0.1358 0.8744 0.0997 1.7458 ... $ var9 : num 0.664 -0.456 0.415 2.090 -0.283 ... $ other3 : num -0.425 -0.283 0.706 -1.879 -0.828 ... $ other7 : num 0.100 0.177 0.570 -0.631 -1.009 ... $ var3 : num 1.446 -0.862 0.184 1.077 0.146 ... $ var5 : num 0.402 -0.498 -0.906 0.641 1.690 ... $ var6 : num 0.892 -0.242 0.561 0.530 -0.291 ... $ other5 : num -1.210 0.815 -1.284 -0.152 0.329 ... $ other8 : num -0.265 -1.278 1.152 0.232 -1.189 ... $ var7 : num -0.616 -0.994 -0.263 1.626 -1.372 ... Note that the column names are either var* or other*. Using grep() we get the indices of the column names that contain other plus one or more following characters, where the other begins the word: grep(\\bother., names(MyDF)) [1] 1 4 6 7 10 11 13 14 18 19 See ?regexp for more information. Note that I use \\b to being the search at the starting word boundary and then . to require that there be following characters. Thus, this would not match other1 or other. You can then use the following to subset the data frame MyDF and sum the rows for the requested columns: rowSums(MyDF[, grep(\\bother., names(MyDF))]) 1 2 3 4 5 6 7 -1.344893 1.531417 2.715234 1.616971 1.307379 4.655568 4.638446 8 910 -2.640485 -2.226270 -2.158248 You could use grep(other, names(MyDF)), but this would also get other if it appears anywhere in the name. For example: grep(other, Thisotherone) [1] 1 It just depends upon your naming schema and how strict you need to be in the search. HTH, Marc Schwartz __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] R and packages
On 2/20/2006 8:07 PM, Erin Hodgess wrote: Dear R People: Here is yet another strange problem. I'm using R in one of my classes. However, the computer lab has something called Deep Freeze and the students cannot save anything to the hard drive. I had R installed and things were working well. They would save their .Rdata files to disks. Now, we need to add more packages. We can't download and we can't bring them in via zip files (already tried both!) When the zip files are expanded, of course they build new directories.. You can probably use .libPaths() to add a new install location that is writeable. You'll likely get a few error messages because R can't update the help indices, but the packages should be available. I'm completely annoyed because learning to download packages and installing them from local zips are actually important tasks! We're also losing good teaching/learning time! Anyhow, what I would like to do is produce a sort of combination R installation exe with our extra libraries as part of the package. You could also do this, if you have the tools installed to do a build. See the R Installation and Administration manual, Installing R Under Windows, Building from Source, Building the Installer (section 3.1.9 in the PDF version). You can either build with extra packages from source, or make an image from an installed copy. In either case you'll need to install a lot of build tools, but fewer for the second option. Duncan Murdoch Does anyone have any suggestions on how this could be done, please? This is R for Windows, Version 2.2.1 Thanks for any help! Sorry about the totally weird problem! Sincerely, Erin Hodgess Associate Professor Department of Computer and Mathematical Sciences University of Houston - Downtown mailto: [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] R and packages
On 2/20/2006 8:07 PM, Erin Hodgess wrote: Dear R People: Here is yet another strange problem. I'm using R in one of my classes. However, the computer lab has something called Deep Freeze and the students cannot save anything to the hard drive. I had R installed and things were working well. They would save their .Rdata files to disks. Now, we need to add more packages. We can't download and we can't bring them in via zip files (already tried both!) When the zip files are expanded, of course they build new directories.. You can probably use .libPaths() to add a new install location that is writeable. You'll likely get a few error messages because R can't update the help indices, but the packages should be available. I'm completely annoyed because learning to download packages and installing them from local zips are actually important tasks! We're also losing good teaching/learning time! Anyhow, what I would like to do is produce a sort of combination R installation exe with our extra libraries as part of the package. You could also do this, if you have the tools installed to do a build. See the R Installation and Administration manual, Installing R Under Windows, Building from Source, Building the Installer (section 3.1.9 in the PDF version). You can either build with extra packages from source, or make an image from an installed copy. In either case you'll need to install a lot of build tools, but fewer for the second option. Duncan Murdoch Does anyone have any suggestions on how this could be done, please? This is R for Windows, Version 2.2.1 Thanks for any help! Sorry about the totally weird problem! Sincerely, Erin Hodgess Associate Professor Department of Computer and Mathematical Sciences University of Houston - Downtown mailto: [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] need a R-code formatter?
Søren Højsgaard wrote: You can use emacs with ESS - and/or try to encourage (kindly) the creator of Tinn-R to create such a code-formatter... ... or contribute the code formatter to the Tinn-R project which is one of the great ideas of Open Source software. The Tinn-R developers will be happy, certainly. Uwe Ligges Best Søren Fra: [EMAIL PROTECTED] på vegne af Michael Sendt: on 15-02-2006 07:05 Til: R-help@stat.math.ethz.ch Emne: [R] need a R-code formatter? Hi all, I am using Tin-R as my editor; I use it because it allows me to send several selected lines to R-console and execute them... In some sense, this is my line-by-line debugger. But it doesn't have a code formatter, I have to layout the indention myself -- when there are many { } blocks with different layers, this editor does not help me beautify the code... I am looking for some editor with better debugging support and with a R-code formatter? Thanks a lot! Michael. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] how to close all windows?
Michael wrote: Hi all, I have 10+ graphic windows and 10+ R help window opening now... How do I close them all at once? Thanks a lot! [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html See ?graphics.off Uwe Ligges __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] indexing within panels in xyplot
Dear R-helpers, I need to show a linear fit through a subset of the data within each combination of levels of two factors. So I prepared an xyplot with different panels for each level of one of the factors, and different symbols within each panel for the levels of the second factor. My problem is selecting the subset of each combination through which the line should be fit for subsequent plotting. This hopefully shows the idea: --cut here---start- toydf - expand.grid(1:100, c(A, B), c(pop1, pop2, pop3, pop4, pop5)) toydf - data.frame(facA = toydf[[3]], facB = toydf[[2]], x = toydf[[1]], y = rnorm(1000)) xyplot(y ~ x | facA, groups = facB, data = toydf, panel.groups = function(x, y, subscripts, ...) { panel.xyplot(x, y, ...) lindx - which(y[subscripts] == max(y[subscripts], na.rm = TRUE)) xleft - mean(x[lindx], na.rm = TRUE) fit - lm(y[x = xleft] ~ x[x = xleft]) panel.abline(fit) }) --cut here---end--- i.e. the left limit for fitting the line is defined by the mean of x values where y is equal to the maximum y values, *within* each combination of levels of both factors. The above is giving me: Error in lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) : 0 (non-NA) cases In addition: Warning message: no finite arguments to max; returning -Inf which shows I'm not understanding how the 'subscripts' argument works. I'd appreciate some pointers on what I'm doing wrong, as I haven't been able to find help in the help pages and List archives. Thanks, -- Sebastian P. Luque __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Group a dinamic number of vectors in a data.frame
Daniele Medri wrote: Hi all, I need to create a data.frame from a variable number of vectors. The number of these vectors could change so I need a dinamic way to group all in a data.frame. The number is length(abc). e.g. vectors in my workspace N1 -c(1,2,3,4) N2 -c(1,2,3,4) N3 -c(1,2,3,4) abc -c(1,2,3) the data.frame I want to create: tcm -data.frame(OneVector, TwoVector, paste(N,1:length(abc))) Obviously :) if I am here this approach doesn't work, so any kind of tip is welcome. For example: lab - paste(N, seq(along=abc), sep=) D - data.frame(lapply(lab, get)) names(D) - lab Uwe Ligges Cheers __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] R and packages
You want to take the sysad by the hairy of his chinny-chin-chin and explain the issue in short sentences. He or she ought to be able produce a solution without difficulty, and should not have any problems about doing so. It IS their job. JD On Monday 20 February 2006 17:07, Erin Hodgess wrote: Dear R People: Here is yet another strange problem. I'm using R in one of my classes. However, the computer lab has something called Deep Freeze and the students cannot save anything to the hard drive. I had R installed and things were working well. They would save their .Rdata files to disks. Now, we need to add more packages. We can't download and we can't bring them in via zip files (already tried both!) When the zip files are expanded, of course they build new directories.. I'm completely annoyed because learning to download packages and installing them from local zips are actually important tasks! We're also losing good teaching/learning time! Anyhow, what I would like to do is produce a sort of combination R installation exe with our extra libraries as part of the package. Does anyone have any suggestions on how this could be done, please? This is R for Windows, Version 2.2.1 Thanks for any help! Sorry about the totally weird problem! Sincerely, Erin Hodgess Associate Professor Department of Computer and Mathematical Sciences University of Houston - Downtown mailto: [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Heckman regression / adjustment for standard errors?
Hi Brian, On Friday 17 February 2006 22:30, Brian Perron wrote: Hello folks, I am trying to estimate the two-step Heckman regression model. I would like to make an adjustment for intragroup correlations. Stata can implement this with the cluster option, but I am really hoping to stick with R. It seems that the micEcon package is the primary source for this two-step regression model (i.e., heckit), but I can't find a way to make the adjustment. Am I overlooking something with this package or other packages? The heckit() function in the micEcon package definitively has no cluster option. Unfortunately, I don't know anything about adjustment for intragroup correlations in heckman type estimations. Is this difficult to implement? Do you know a description of this procedure? (Maybe we can do this together.) Arne Brian [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Arne Henningsen Department of Agricultural Economics University of Kiel Olshausenstr. 40 D-24098 Kiel (Germany) Tel: +49-431-880 4445 Fax: +49-431-880 1397 [EMAIL PROTECTED] http://www.uni-kiel.de/agrarpol/ahenningsen/ __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] indexing within panels in xyplot
Based on your two first sentences I think the solution is to use xyplot(y ~ x | facA, groups = facB, data = toydf,type=c(p,r)) Try it and see if this is what you want. Best regards Frede Aakmann Tøgersen Scientist Danish Institute of Agricultural Sciences Research Centre Foulum Dept. of Genetics and Biotechnology Blichers Allé 20, P.O. BOX 50 DK-8830 Tjele Phone: +45 8999 1900 Direct: +45 8999 1878 E-mail: [EMAIL PROTECTED] Web: http://www.agrsci.org This email may contain information that is confidential. Any use or publication of this email without written permission from DIAS is not allowed. If you are not the intended recipient, please notify DIAS immediately and delete this email. -Oprindelig meddelelse- Fra: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] På vegne af Sebastian Luque Sendt: 21. februar 2006 08:20 Til: r-help@stat.math.ethz.ch Emne: [R] indexing within panels in xyplot Dear R-helpers, I need to show a linear fit through a subset of the data within each combination of levels of two factors. So I prepared an xyplot with different panels for each level of one of the factors, and different symbols within each panel for the levels of the second factor. My problem is selecting the subset of each combination through which the line should be fit for subsequent plotting. This hopefully shows the idea: --cut here---start- toydf - expand.grid(1:100, c(A, B), c(pop1, pop2, pop3, pop4, pop5)) toydf - data.frame(facA = toydf[[3]], facB = toydf[[2]], x = toydf[[1]], y = rnorm(1000)) xyplot(y ~ x | facA, groups = facB, data = toydf, panel.groups = function(x, y, subscripts, ...) { panel.xyplot(x, y, ...) lindx - which(y[subscripts] == max(y[subscripts], na.rm = TRUE)) xleft - mean(x[lindx], na.rm = TRUE) fit - lm(y[x = xleft] ~ x[x = xleft]) panel.abline(fit) }) --cut here---end--- i.e. the left limit for fitting the line is defined by the mean of x values where y is equal to the maximum y values, *within* each combination of levels of both factors. The above is giving me: Error in lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) : 0 (non-NA) cases In addition: Warning message: no finite arguments to max; returning -Inf which shows I'm not understanding how the 'subscripts' argument works. I'd appreciate some pointers on what I'm doing wrong, as I haven't been able to find help in the help pages and List archives. Thanks, -- Sebastian P. Luque __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html