Re: [R] R static is dynamically linked!!
You asked for R to be built as a static lib, not for the front-end to be statically linked. It is not the R lib it is dynamically linking to (that is statically linked by default whether or not you ask for a separate lib), but the OS components. R depends on dlopen-ing extensions, so there is no way to make it entirely static. On Mon, 19 May 2008, George Georgalis wrote: Hi, After doing all I could find with the confiure script... I set some env too... export enable_R_static_lib=yes export want_R_static=yes export WANT_R_STATIC_TRUE=yes ./configure \ --prefix=${i} \ --enable-R-static-lib \ --enable-static \ --without-readline \ --without-iconv \ make \ make install \ echo R ${v} installed in ${i} But the result is still dynamic: ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), for NetBSD 4.0, dynamically linked (uses shared libs), not stripped Is there some way to make this static? Yes -- R is Open Source, so modify the souces as you wish. // George -- George Georgalis, information system scientist IXOYE __ 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. -- 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@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] contr.treatments query
From ?contrasts Usage: contrasts(x, how.many) - value ... how.many: How many contrasts should be made. Defaults to one less than the number of levels of 'x'. This need not be the same as the number of columns of 'ctr'. so that is 2 in your example, and it takes the first 2 of the 3 you supplied. (The posting guide does ask you to read the help before posting.) On Tue, 20 May 2008, [EMAIL PROTECTED] wrote: Hi Folks, I'm a bit puzzled by the following (example): N-factor(sample(c(1,2,3),1000,replace=TRUE)) unique(N) # [1] 3 2 1 # Levels: 1 2 3 So far so good. Now: contrasts(N)-contr.treatment(3, base=1, contrasts=FALSE) contrasts(N) # 1 2 # 1 1 0 # 2 0 1 # 3 0 0 whereas: contr.treatment(3, base=1, contrasts=FALSE) # 1 2 3 # 1 1 0 0 # 2 0 1 0 # 3 0 0 1 contr.treatment(3, base=1, contrasts=TRUE) # 2 3 # 1 0 0 # 2 1 0 # 3 0 1 I can follow the last two fine -- they are what is implied by the code for contr.treatment(). Likewise: contrasts(factor(Nlevs -c(1,2,3))) # 2 3 # 1 0 0 # 2 1 0 # 3 0 1 But why the different result when applied to N? With thanks, Ted. E-Mail: (Ted Harding) [EMAIL PROTECTED] Fax-to-email: +44 (0)870 094 0861 Date: 20-May-08 Time: 01:12:30 -- XFMail -- __ 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. -- 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@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] For Social Network Analysis-Graph Analysis - How to convert 2 mode data to 1 mode data?
Solomon, sorry for the delay. In igraph vertices are numbered from 0, so you need keep - 0:3 and then the function i've sent seems to work. But i can see that you also have a solution now. Gabor On Sat, May 17, 2008 at 09:32:27AM -0400, Messing, Solomon O. wrote: Consider the following two mode-data: edgelist: actor event 1 Sam a 2 Sam b 3 Sam c 4 Greg a 5 Tom b 6 Tom c 7 Tom d 8 Mary b 9 Mary d Two-Mode Adjacency Matrix: a b c d Sam 1 1 1 0 Greg 1 0 0 0 Tom 0 1 1 1 Mary 0 1 0 1 To transform two mode to one mode data, we need a function that transforms the data like so: Sam is connected to Greg (via event a) Sam is connected to Tom (via event b and c) Sam is connected to Mary (via event b) Tom is connected to Mary (via event b and d) OK, now I load my data by executing the following: ### require(igraph) df - data.frame(actor = c ('Sam','Sam','Sam','Greg','Tom','Tom','Tom','Mary','Mary'), event =c('a','b','c','a','b','c','d','b','d') ) g = graph.data.frame(df, directed=F) #Coerce data to igraph object 'g' #Loading Function two.to.one: ##two.to.one() transforms 2-mode data to 1-mode two.to.one - function(g, keep) { neis - neighborhood(g, order=2) neis - lapply(seq(neis), function(x) neis[[x]][ neis[[x]] != x-1]) ## drop self-loops neis - lapply(neis, function(x) x[ x %in% keep ]) ## keep only these neis - lapply(seq(neis), function(x) t(cbind(x-1, neis[[x]]))) ## create edge lists neis[-keep-1] - NULL ## these are not needed neis - matrix(unlist(neis), byrow=TRUE, nc=2) ## a single edge list neis - neis[ neis[,1] neis[,2], ]## count an edge once only mode(neis) - character g2 - graph.edgelist(neis, dir=FALSE) V(g2)$id - V(g2)$name ## 'id' is used in Pajek g2 } #Actors are the first 4 verticies, set them to be kept: keep = V(g)[1:4] #Convert matrix with two.to.one: g2 = two.to.one(g, keep) g2 ### This yields the following output: g2 Vertices: 4 Edges: 2 Directed: FALSE Edges: [0] 3 -- 2 [1] 4 -- 1 But, this can't be right. Here there are only two edges where there should be four, and if I am inturpreting correctly, the output it is reporting that Tom is connected to Greg (he is not) and Sam is connected to Mary (which is true). When I load my function, which is designed to transform a two mode edgelist (e.g. two columns of data) into a one-mode adjacency matrix it seems to work: ### #load my function df.to.nxn - function( x, y ) { # x values will be the N x N values M - matrix( nrow = length( unique( x ) ), ncol = length( unique( x ) ), dimnames = list( unique( x ), unique( x ) ) ) M[ 1:length( unique( x ) ), 1:length( unique( x ) ) ] - 0#initialize the values to 0 - this possibly could be removed for illustrative purposes for( i in 1:length( x ) ) { # iterate through rows of data index = which( y == y[i] ) M[ as.character( x[ index ] ), as.character( x[ index ] ) ] = 1 } M # return M, an N x N matrix } #Convert matrix g3 = df.to.nxn(df$actor, df$event) g4 = graph.adjacency(g3, mode = undirected, diag = F) V(g4)$name = row.names(g3) g4 ### This yields: g4 Vertices: 4 Edges: 4 Directed: FALSE Edges: [0] Sam -- Greg [1] Sam -- Tom [2] Sam -- Mary [3] Tom -- Mary Which is what we wanted. I have not figured out how to weight edges yet (the Sam and Tom edge and the Tom and Mary edge should perhaps be weighted at 2 because 'connected twice' -- connected by two events). -Solomon ━━━ From: Gabor Csardi [mailto:[EMAIL PROTECTED] Sent: Wed 5/14/2008 4:01 AM To: Messing, Solomon O. Cc: R Help list Subject: Re: [R] For Social Network Analysis-Graph Analysis - How to convert 2 mode data to 1 mode data? Please stay on the list. On Tue, May 13, 2008 at 06:05:15PM -0400, Messing, Solomon O. wrote: Gabor, By the way, this seems to work: I'm a bit lost. So now you're converting your data frame to a matrix? Why? Or you're doing the two-mode to one-mode conversion here? It does not seem so to me. Btw.
Re: [R] Log or diary file
Thanks, but I'm looking for a more user-friendly environment that would make the transition from windows to linux easier for students using the R GUIs in windows, either the by default GUI or the SciView GUI (which, btw, are both excellent). Agus Vincent Goulet wrote: Agustin, Given this message and your previous one about starting R by clicking on the .RData file, I would suggest/recommend you have a look at the Emacs + ESS combination; see http://cran.r-project.org/doc/FAQ/R-FAQ.html#R-and-Emacs In my opinion, this is the best multi-platform (Unix, MacOS, Windows) user interface you will find for R. HTH Vincent Le lun. 19 mai à 03:24, Agustin Lobo a écrit : Hi! Is it possible to set a file to which both commands and output would get automatically saved? I've tried with sink(), but only get the output. I mean something like a combined history and sink, as you get with File/Save to File.. in the windows GUI. Tis is done with diary filename in Matlab, and you can state diary on and diary off to control what is being saved to the file. Thanks Agus -- Dr. Agustin Lobo Institut de Ciencies de la Terra Jaume Almera (CSIC) LLuis Sole Sabaris s/n 08028 Barcelona Spain Tel. 34 934095410 Fax. 34 934110012 email: [EMAIL PROTECTED] http://www.ija.csic.es/gt/obster __ 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. -- Dr. Agustin Lobo Institut de Ciencies de la Terra Jaume Almera (CSIC) LLuis Sole Sabaris s/n 08028 Barcelona Spain Tel. 34 934095410 Fax. 34 934110012 email: [EMAIL PROTECTED] http://www.ija.csic.es/gt/obster __ 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] Select certain elements from dataframe
First of all thank you very much, that helped a lot! Now I have another related problem, again I want to limit a dataframe on certain elements, the dataframe looks like this: colnames(sd_all) [1] Xmydata.a [3] mydata.xmydata.sd.a . . . [13] mydata.mad.xsnr X denotes the identifier and I want to select all rows which identifiers are in a cluster. clusterX [1] 101KF4319097339 102KF4319101170 103KF4319047549 104KF4319046389 [5] 125KF4319063638 126KF4319102180 127KF4319107122 128KF4319019607 . . . [125] 795KS4242028634 797KS4242032582 798KS4242035374 127 Levels: 101KF4319097339 102KF4319101170 103KF4319047549 ... 798KS4242035374 I tried : sd_all_clusterX-sd_all[as.character(clusterX),] but that results in all colums being NA. for example: sd_all_clusterX[8] NA NA NA.1 NA NA.2 NA NA.3 NA . . NA.126 NA Again help would be very much appreciated, Sebastian jholtman wrote: 'xx1' is a 'factor' and you have to convert to a character before selecting: data.xx1-data[ ,as.character(xx1)] On Mon, May 19, 2008 at 5:20 AM, SebastianEck [EMAIL PROTECTED] wrote: Hello, I have a specific problem, I have a large dataframe, and after clustering I want to select certain colums, the elements of a subcluster. My dataframe looks like this : colnames(data) [1] 101KF4319097339 102KF4319101170 103KF4319047549 104KF4319046389 [5] 105KF4319013260 106KF4319025582 107KF4319108763 108KF4319047040 [9] 109KF4319060241 110KF4319056658 111KF4319036131 112KF4319097194 . . . [701] 821KS4242126913 822KS4242026026 823KS4242003122 824IHT06020 [705] 825IHT06020 826IHT06005 827IHT06005 My subcluster looks like this xx1 xx1 [1] 101KF4319097339 102KF4319101170 103KF4319047549 104KF4319046389 [5] 125KF4319063638 126KF4319102180 127KF4319107122 128KF4319019607 [9] 135KF4319037854 138KF4319050003 140KF4319069150 152KF4319109279 . . . [125] 795KS4242028634 797KS4242032582 798KS4242035374 127 Levels: 101KF4319097339 102KF4319101170 103KF4319047549 ... 798KS4242035374 Now I want to select all elements from data that are in xx1, I tried data.xx1-data[ ,xx1] but that selects the just the first 127 (127 is the number of elements / length from xx1) elements from data. Any help would be very appreciated :) Sebastian -- View this message in context: http://www.nabble.com/Select-certain-elements-from-dataframe-tp17314209p17314209.html Sent from the R help mailing list archive at Nabble.com. __ 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.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem you are trying to solve? [[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. -- View this message in context: http://www.nabble.com/Select-certain-elements-from-dataframe-tp17314209p17335609.html Sent from the R help mailing list archive at Nabble.com. __ 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] contr.treatments query
Apologies -- I have just observed my oversight below! Please ignore the message below. Ted. On 20-May-08 09:14:30, Ted Harding wrote: On 20-May-08 06:10:48, Prof Brian Ripley wrote: From ?contrasts Usage: contrasts(x, how.many) - value ... how.many: How many contrasts should be made. Defaults to one less than the number of levels of 'x'. This need not be the same as the number of columns of 'ctr'. so that is 2 in your example, and it takes the first 2 of the 3 you supplied. (The posting guide does ask you to read the help before posting.) I had read it (and other), and it did not help me. The point of my query was not the fact of getting 2 columns; I was expecting that. The point was the difference, after N-factor(sample(c(1,2,3),1000,replace=TRUE)) between [A] contr.treatment(3, base=1, contrasts=TRUE) # 2 3 # 1 0 0 # 2 1 0 # 3 0 1 i.e. omitting level 1 as implied by contr - contr[, -base, drop = FALSE] in the code for contr.treatment(), and the result of [B] contrasts(N)-contr.treatment(3, base=1, contrasts=FALSE) contrasts(N) # 1 2 # 1 1 0 # 2 0 1 # 3 0 0 i.e. omitting level 3, despite having had the contrasts assigned from exactly the same expression as in [A]. Possibly Bill Venables' comments may contain the clue; but I would need to experiment to see whether that it is fact the root cause. With thanks, Ted. On Tue, 20 May 2008, [EMAIL PROTECTED] wrote: Hi Folks, I'm a bit puzzled by the following (example): N-factor(sample(c(1,2,3),1000,replace=TRUE)) unique(N) # [1] 3 2 1 # Levels: 1 2 3 So far so good. Now: contrasts(N)-contr.treatment(3, base=1, contrasts=FALSE) contrasts(N) # 1 2 # 1 1 0 # 2 0 1 # 3 0 0 whereas: contr.treatment(3, base=1, contrasts=FALSE) # 1 2 3 # 1 1 0 0 # 2 0 1 0 # 3 0 0 1 contr.treatment(3, base=1, contrasts=TRUE) # 2 3 # 1 0 0 # 2 1 0 # 3 0 1 I can follow the last two fine -- they are what is implied by the code for contr.treatment(). Likewise: contrasts(factor(Nlevs -c(1,2,3))) # 2 3 # 1 0 0 # 2 1 0 # 3 0 1 But why the different result when applied to N? With thanks, Ted. E-Mail: (Ted Harding) [EMAIL PROTECTED] Fax-to-email: +44 (0)870 094 0861 Date: 20-May-08 Time: 01:12:30 -- XFMail -- __ 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. -- 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@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. E-Mail: (Ted Harding) [EMAIL PROTECTED] Fax-to-email: +44 (0)870 094 0861 Date: 20-May-08 Time: 10:14:26 -- XFMail -- E-Mail: (Ted Harding) [EMAIL PROTECTED] Fax-to-email: +44 (0)870 094 0861 Date: 20-May-08 Time: 10:17:44 -- XFMail -- __ 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] Log or diary file
Agustin Lobo wrote: Thanks, but I'm looking for a more user-friendly environment that would make the transition from windows to linux easier for students using the R GUIs in windows, either the by default GUI or the SciView GUI (which, btw, are both excellent). Another cross-platform solution which functionally is comparable to emacs+ESS and tends to please students is the StatET plugin for Eclipse. Using a script and submitting (the relevant lines) using Ctrl-R Ctrl-V (which will paste output results directly into the script) might emulate a diary file. You can find more information at http://www.walware.de/goto/statet/ Basically, download and unzip (= installation) Eclipse classic (stable release) from http://www.eclipse.org/downloads/ Next, installation of StatET should be straightforward from the Eclipse GUI via Help - Software Updates - Find and Install... Search for new features to install Then just use http://www.walware.de/eclipseupdates as a (new) Eclipse update site and walk through the wizard. To get started (launching R, configuring for Sweave etc.), you can access the cheat sheets via Help - Cheat Sheets... - StatET: R in Eclipse. For questions, there is a dedicated mailing list at http://lists.r-forge.r-project.org/mailman/listinfo/statet-user HTH, Tobias Agus Vincent Goulet wrote: Agustin, Given this message and your previous one about starting R by clicking on the .RData file, I would suggest/recommend you have a look at the Emacs + ESS combination; see http://cran.r-project.org/doc/FAQ/R-FAQ.html#R-and-Emacs In my opinion, this is the best multi-platform (Unix, MacOS, Windows) user interface you will find for R. HTH Vincent Le lun. 19 mai à 03:24, Agustin Lobo a écrit : Hi! Is it possible to set a file to which both commands and output would get automatically saved? I've tried with sink(), but only get the output. I mean something like a combined history and sink, as you get with File/Save to File.. in the windows GUI. Tis is done with diary filename in Matlab, and you can state diary on and diary off to control what is being saved to the file. Thanks Agus -- Dr. Agustin Lobo Institut de Ciencies de la Terra Jaume Almera (CSIC) LLuis Sole Sabaris s/n 08028 Barcelona Spain Tel. 34 934095410 Fax. 34 934110012 email: [EMAIL PROTECTED] http://www.ija.csic.es/gt/obster __ 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] Select certain elements from dataframe
Hi [EMAIL PROTECTED] napsal dne 20.05.2008 10:25:00: First of all thank you very much, that helped a lot! Now I have another related problem, again I want to limit a dataframe on certain elements, the dataframe looks like this: colnames(sd_all) [1] Xmydata.a [3] mydata.xmydata.sd.a . . . [13] mydata.mad.xsnr X denotes the identifier and I want to select all rows which identifiers are in a cluster. clusterX [1] 101KF4319097339 102KF4319101170 103KF4319047549 104KF4319046389 [5] 125KF4319063638 126KF4319102180 127KF4319107122 128KF4319019607 . . . [125] 795KS4242028634 797KS4242032582 798KS4242035374 127 Levels: 101KF4319097339 102KF4319101170 103KF4319047549 ... 798KS4242035374 I tried : sd_all_clusterX-sd_all[as.character(clusterX),] Maybe you want %in% function sd_all_clusterX-sd_all[clusterX%in%sd_all$X),] # not tested Regards Petr but that results in all colums being NA. for example: sd_all_clusterX[8] NA NA NA.1 NA NA.2 NA NA.3 NA . . NA.126 NA Again help would be very much appreciated, Sebastian jholtman wrote: 'xx1' is a 'factor' and you have to convert to a character before selecting: data.xx1-data[ ,as.character(xx1)] On Mon, May 19, 2008 at 5:20 AM, SebastianEck [EMAIL PROTECTED] wrote: Hello, I have a specific problem, I have a large dataframe, and after clustering I want to select certain colums, the elements of a subcluster. My dataframe looks like this : colnames(data) [1] 101KF4319097339 102KF4319101170 103KF4319047549 104KF4319046389 [5] 105KF4319013260 106KF4319025582 107KF4319108763 108KF4319047040 [9] 109KF4319060241 110KF4319056658 111KF4319036131 112KF4319097194 . . . [701] 821KS4242126913 822KS4242026026 823KS4242003122 824IHT06020 [705] 825IHT06020 826IHT06005 827IHT06005 My subcluster looks like this xx1 xx1 [1] 101KF4319097339 102KF4319101170 103KF4319047549 104KF4319046389 [5] 125KF4319063638 126KF4319102180 127KF4319107122 128KF4319019607 [9] 135KF4319037854 138KF4319050003 140KF4319069150 152KF4319109279 . . . [125] 795KS4242028634 797KS4242032582 798KS4242035374 127 Levels: 101KF4319097339 102KF4319101170 103KF4319047549 ... 798KS4242035374 Now I want to select all elements from data that are in xx1, I tried data.xx1-data[ ,xx1] but that selects the just the first 127 (127 is the number of elements / length from xx1) elements from data. Any help would be very appreciated :) Sebastian -- View this message in context: http://www.nabble.com/Select-certain-elements-from-dataframe-tp17314209p17314209.html Sent from the R help mailing list archive at Nabble.com. __ 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.htmlhttp://www.r-project.org/ posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem you are trying to solve? [[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. -- View this message in context: http://www.nabble.com/Select-certain-elements- from-dataframe-tp17314209p17335609.html Sent from the R help mailing list archive at Nabble.com. __ 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] Starting R from .RData in linux
Marianne, I do the equivalent gnome-terminal -e R or xterm -e R and R starts on the home directory and indicating: ARGUMENT '/media/mifat32/Rexercises/.RData' __ignored__ Are you sure you do not add any other parameter? I've tried xterm -e R --restore gnome-terminal -e R --restore same result. On 05/19/08 09:06, Agustin Lobo wrote: Hi! Is it possible to start R by clicking the .RData file in linux as in Windows? I've tried with ubuntu hardy using the right button and selecting R, but does not work. Is there any way to set it up? Marianne Promberger Wrote: You presumably need to associate the file type .RData with starting a terminal and then executing R in that terminal. I'm using Xubuntu, so my file manager is Thunar, and if I right click on an .RData and select use other application then custom command, then put in xfterm4 -e R this works. On Ubuntu, your terminal is probably something else and may have different syntax. (gnome-terminal maybe? then man gnome-terminal in case the -e option doesn't work for you). m. -- Marianne Promberger Graduate student in Psychology http://www.psych.upenn.edu/~mpromber -- Dr. Agustin Lobo Institut de Ciencies de la Terra Jaume Almera (CSIC) LLuis Sole Sabaris s/n 08028 Barcelona Spain Tel. 34 934095410 Fax. 34 934110012 email: [EMAIL PROTECTED] http://www.ija.csic.es/gt/obster __ 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] contr.treatments query
On 20-May-08 06:10:48, Prof Brian Ripley wrote: From ?contrasts Usage: contrasts(x, how.many) - value ... how.many: How many contrasts should be made. Defaults to one less than the number of levels of 'x'. This need not be the same as the number of columns of 'ctr'. so that is 2 in your example, and it takes the first 2 of the 3 you supplied. (The posting guide does ask you to read the help before posting.) I had read it (and other), and it did not help me. The point of my query was not the fact of getting 2 columns; I was expecting that. The point was the difference, after N-factor(sample(c(1,2,3),1000,replace=TRUE)) between [A] contr.treatment(3, base=1, contrasts=TRUE) # 2 3 # 1 0 0 # 2 1 0 # 3 0 1 i.e. omitting level 1 as implied by contr - contr[, -base, drop = FALSE] in the code for contr.treatment(), and the result of [B] contrasts(N)-contr.treatment(3, base=1, contrasts=FALSE) contrasts(N) # 1 2 # 1 1 0 # 2 0 1 # 3 0 0 i.e. omitting level 3, despite having had the contrasts assigned from exactly the same expression as in [A]. Possibly Bill Venables' comments may contain the clue; but I would need to experiment to see whether that it is fact the root cause. With thanks, Ted. On Tue, 20 May 2008, [EMAIL PROTECTED] wrote: Hi Folks, I'm a bit puzzled by the following (example): N-factor(sample(c(1,2,3),1000,replace=TRUE)) unique(N) # [1] 3 2 1 # Levels: 1 2 3 So far so good. Now: contrasts(N)-contr.treatment(3, base=1, contrasts=FALSE) contrasts(N) # 1 2 # 1 1 0 # 2 0 1 # 3 0 0 whereas: contr.treatment(3, base=1, contrasts=FALSE) # 1 2 3 # 1 1 0 0 # 2 0 1 0 # 3 0 0 1 contr.treatment(3, base=1, contrasts=TRUE) # 2 3 # 1 0 0 # 2 1 0 # 3 0 1 I can follow the last two fine -- they are what is implied by the code for contr.treatment(). Likewise: contrasts(factor(Nlevs -c(1,2,3))) # 2 3 # 1 0 0 # 2 1 0 # 3 0 1 But why the different result when applied to N? With thanks, Ted. E-Mail: (Ted Harding) [EMAIL PROTECTED] Fax-to-email: +44 (0)870 094 0861 Date: 20-May-08 Time: 01:12:30 -- XFMail -- __ 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. -- 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@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. E-Mail: (Ted Harding) [EMAIL PROTECTED] Fax-to-email: +44 (0)870 094 0861 Date: 20-May-08 Time: 10:14:26 -- XFMail -- __ 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] Draw Polygon with a Circular Side
ermimi wrote: Hello Friends!!! I would want draw a circular histogram, and I would like draw a polygon with a circular side. This is easy if I use the functions polygon and arc, but I want that the polygon with a circular side have background colour. The polygon created with function polygon can have background colour, but the surface created with function arc can´t have background colour. How I could create a polygon with a circular side that have background colour?? Thank you very much, A greetings Luismi Hi Luismi, The phrase circular histogram brings to mind something like a wind rose. There are a few you could try: windrose in the oce and circular packages rosavent in the climatol package oz.windrose in the plotrix package and perhaps rose in the IDPmisc package Now about this polygon with a circular side. I think you mean the standard issue polygon like a rectangle except that one side is a circular arc instead of a straight line. If this bold conjecture is correct, here is an example for you: plot(0,xlim=c(-1,1),ylim=c(-1,1),xlab=,ylab=, type=n,axes=FALSE) polygon(c(0,-1,-1,0,cos(seq(pi/2,0,length.out=50)), cos(seq(2*pi,3*pi/2,length.out=50))),c(-1,-1,1,1, sin(seq(pi/2,0,length.out=50)),sin(seq(2*pi,3*pi/2,length.out=50))), border=#ff,col=#66ee33) Jim __ 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] Select certain elements from dataframe
sd_all_clusterX-sd_all[(clusterX%in%sd_all$X),] # not tested seems to do nothing, all elements of the original dataframe are now selected Petr Pikal wrote: Hi [EMAIL PROTECTED] napsal dne 20.05.2008 10:25:00: First of all thank you very much, that helped a lot! Now I have another related problem, again I want to limit a dataframe on certain elements, the dataframe looks like this: colnames(sd_all) [1] Xmydata.a [3] mydata.xmydata.sd.a . . . [13] mydata.mad.xsnr X denotes the identifier and I want to select all rows which identifiers are in a cluster. clusterX [1] 101KF4319097339 102KF4319101170 103KF4319047549 104KF4319046389 [5] 125KF4319063638 126KF4319102180 127KF4319107122 128KF4319019607 . . . [125] 795KS4242028634 797KS4242032582 798KS4242035374 127 Levels: 101KF4319097339 102KF4319101170 103KF4319047549 ... 798KS4242035374 I tried : sd_all_clusterX-sd_all[as.character(clusterX),] Maybe you want %in% function sd_all_clusterX-sd_all[clusterX%in%sd_all$X),] # not tested Regards Petr but that results in all colums being NA. for example: sd_all_clusterX[8] NA NA NA.1 NA NA.2 NA NA.3 NA . . NA.126 NA Again help would be very much appreciated, Sebastian jholtman wrote: 'xx1' is a 'factor' and you have to convert to a character before selecting: data.xx1-data[ ,as.character(xx1)] On Mon, May 19, 2008 at 5:20 AM, SebastianEck [EMAIL PROTECTED] wrote: Hello, I have a specific problem, I have a large dataframe, and after clustering I want to select certain colums, the elements of a subcluster. My dataframe looks like this : colnames(data) [1] 101KF4319097339 102KF4319101170 103KF4319047549 104KF4319046389 [5] 105KF4319013260 106KF4319025582 107KF4319108763 108KF4319047040 [9] 109KF4319060241 110KF4319056658 111KF4319036131 112KF4319097194 . . . [701] 821KS4242126913 822KS4242026026 823KS4242003122 824IHT06020 [705] 825IHT06020 826IHT06005 827IHT06005 My subcluster looks like this xx1 xx1 [1] 101KF4319097339 102KF4319101170 103KF4319047549 104KF4319046389 [5] 125KF4319063638 126KF4319102180 127KF4319107122 128KF4319019607 [9] 135KF4319037854 138KF4319050003 140KF4319069150 152KF4319109279 . . . [125] 795KS4242028634 797KS4242032582 798KS4242035374 127 Levels: 101KF4319097339 102KF4319101170 103KF4319047549 ... 798KS4242035374 Now I want to select all elements from data that are in xx1, I tried data.xx1-data[ ,xx1] but that selects the just the first 127 (127 is the number of elements / length from xx1) elements from data. Any help would be very appreciated :) Sebastian -- View this message in context: http://www.nabble.com/Select-certain-elements-from-dataframe-tp17314209p17314209.html Sent from the R help mailing list archive at Nabble.com. __ 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.htmlhttp://www.r-project.org/ posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem you are trying to solve? [[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. -- View this message in context: http://www.nabble.com/Select-certain-elements- from-dataframe-tp17314209p17335609.html Sent from the R help mailing list archive at Nabble.com. __ 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. -- View this message in context: http://www.nabble.com/Select-certain-elements-from-dataframe-tp17314209p17336691.html Sent from the R help mailing list archive at Nabble.com. __ 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
Re: [R] Select certain elements from dataframe
It would help if you would post a reproducible subset of your data. Use 'dput' if including it in the text. All we can do is make a guess since you have not even include 'str(sd_all)' so we know the structure of your data. sd_all_clusterX-sd_all[(as.character(clusterX)%in%as.character(sd_all$X)),] On Tue, May 20, 2008 at 5:43 AM, Sebastian Eck [EMAIL PROTECTED] wrote: sd_all_clusterX-sd_all[(clusterX%in%sd_all$X),] # not tested seems to do nothing, all elements of the original dataframe are now selected Petr Pikal wrote: Hi [EMAIL PROTECTED] napsal dne 20.05.2008 10:25:00: First of all thank you very much, that helped a lot! Now I have another related problem, again I want to limit a dataframe on certain elements, the dataframe looks like this: colnames(sd_all) [1] Xmydata.a [3] mydata.xmydata.sd.a . . . [13] mydata.mad.xsnr X denotes the identifier and I want to select all rows which identifiers are in a cluster. clusterX [1] 101KF4319097339 102KF4319101170 103KF4319047549 104KF4319046389 [5] 125KF4319063638 126KF4319102180 127KF4319107122 128KF4319019607 . . . [125] 795KS4242028634 797KS4242032582 798KS4242035374 127 Levels: 101KF4319097339 102KF4319101170 103KF4319047549 ... 798KS4242035374 I tried : sd_all_clusterX-sd_all[as.character(clusterX),] Maybe you want %in% function sd_all_clusterX-sd_all[clusterX%in%sd_all$X),] # not tested Regards Petr but that results in all colums being NA. for example: sd_all_clusterX[8] NA NA NA.1 NA NA.2 NA NA.3 NA . . NA.126 NA Again help would be very much appreciated, Sebastian jholtman wrote: 'xx1' is a 'factor' and you have to convert to a character before selecting: data.xx1-data[ ,as.character(xx1)] On Mon, May 19, 2008 at 5:20 AM, SebastianEck [EMAIL PROTECTED] wrote: Hello, I have a specific problem, I have a large dataframe, and after clustering I want to select certain colums, the elements of a subcluster. My dataframe looks like this : colnames(data) [1] 101KF4319097339 102KF4319101170 103KF4319047549 104KF4319046389 [5] 105KF4319013260 106KF4319025582 107KF4319108763 108KF4319047040 [9] 109KF4319060241 110KF4319056658 111KF4319036131 112KF4319097194 . . . [701] 821KS4242126913 822KS4242026026 823KS4242003122 824IHT06020 [705] 825IHT06020 826IHT06005 827IHT06005 My subcluster looks like this xx1 xx1 [1] 101KF4319097339 102KF4319101170 103KF4319047549 104KF4319046389 [5] 125KF4319063638 126KF4319102180 127KF4319107122 128KF4319019607 [9] 135KF4319037854 138KF4319050003 140KF4319069150 152KF4319109279 . . . [125] 795KS4242028634 797KS4242032582 798KS4242035374 127 Levels: 101KF4319097339 102KF4319101170 103KF4319047549 ... 798KS4242035374 Now I want to select all elements from data that are in xx1, I tried data.xx1-data[ ,xx1] but that selects the just the first 127 (127 is the number of elements / length from xx1) elements from data. Any help would be very appreciated :) Sebastian -- View this message in context: http://www.nabble.com/Select-certain-elements-from-dataframe-tp17314209p17314209.html Sent from the R help mailing list archive at Nabble.com. __ 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.htmlhttp://www.r-project.org/posting-guide.html http://www.r-project.org/ posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem you are trying to solve? [[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.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- View this message in context: http://www.nabble.com/Select-certain-elements- from-dataframe-tp17314209p17335609.html Sent from the R help mailing list archive at Nabble.com. __ 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.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] NOTE warning
Dear all I am using NAMESPACE in my package but I would like the user to be able to overwrite four functions: own.linkfun, own.linkinv, own.mu.eta and own.valideta. These are used to defined own link functions. Is there any way of doing that without getting the when I am checking the package? This is what I am getting: make.link.gamlss : linkfun: no visible binding for global variable 'own.linkfun' make.link.gamlss : linkinv: no visible binding for global variable 'own.linkinv' make.link.gamlss : mu.eta: no visible binding for global variable 'own.mu.eta' make.link.gamlss : valideta: no visible binding for global variable 'own.valideta' Thanks Mikis Stasinopoulos Companies Act 2006 : http://www.londonmet.ac.uk/companyinfo __ 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] Log or diary file
This is what I was looking for and actually TeachingDemos includes a lot of very interesting things! Thanks a lot for making it and for pointing it to me. Agus Greg Snow wrote: The R2HTML package has tools for creating an HTML log of your session (see ?HTMLStart). Or the TeachingDemos package has a text based set of tools (see ?txtStart) for creating a log of your session. Neither is perfect (and imperfect in different ways), but could be what you are looking for. Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare [EMAIL PROTECTED] (801) 408-8111 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Agustin Lobo Sent: Monday, May 19, 2008 1:24 AM To: r-help@r-project.org Subject: [R] Log or diary file Hi! Is it possible to set a file to which both commands and output would get automatically saved? I've tried with sink(), but only get the output. I mean something like a combined history and sink, as you get with File/Save to File.. in the windows GUI. Tis is done with diary filename in Matlab, and you can state diary on and diary off to control what is being saved to the file. Thanks Agus -- Dr. Agustin Lobo Institut de Ciencies de la Terra Jaume Almera (CSIC) LLuis Sole Sabaris s/n 08028 Barcelona Spain Tel. 34 934095410 Fax. 34 934110012 email: [EMAIL PROTECTED] http://www.ija.csic.es/gt/obster __ 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. -- Dr. Agustin Lobo Institut de Ciencies de la Terra Jaume Almera (CSIC) LLuis Sole Sabaris s/n 08028 Barcelona Spain Tel. 34 934095410 Fax. 34 934110012 email: [EMAIL PROTECTED] http://www.ija.csic.es/gt/obster __ 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] Select certain elements from dataframe
Hi [EMAIL PROTECTED] napsal dne 20.05.2008 11:43:07: sd_all_clusterX-sd_all[(clusterX%in%sd_all$X),] # not tested seems to do nothing, all elements of the original dataframe are now selected OK you made me to test it. As you do not provided reproducible example I used some of my data dim(zanaseni[zanaseni$pozn%in%cluserX,]) [1] 133 6 dim(zanaseni) [1] 156 6 So sd_all_clusterX-sd_all[(sd_all$X%in%clusterX),] # still not tested shall do the selection. Regards Petr Petr Pikal wrote: Hi [EMAIL PROTECTED] napsal dne 20.05.2008 10:25:00: First of all thank you very much, that helped a lot! Now I have another related problem, again I want to limit a dataframe on certain elements, the dataframe looks like this: colnames(sd_all) [1] Xmydata.a [3] mydata.xmydata.sd.a . . . [13] mydata.mad.xsnr X denotes the identifier and I want to select all rows which identifiers are in a cluster. clusterX [1] 101KF4319097339 102KF4319101170 103KF4319047549 104KF4319046389 [5] 125KF4319063638 126KF4319102180 127KF4319107122 128KF4319019607 . . . [125] 795KS4242028634 797KS4242032582 798KS4242035374 127 Levels: 101KF4319097339 102KF4319101170 103KF4319047549 ... 798KS4242035374 I tried : sd_all_clusterX-sd_all[as.character(clusterX),] Maybe you want %in% function sd_all_clusterX-sd_all[clusterX%in%sd_all$X),] # not tested Regards Petr but that results in all colums being NA. for example: sd_all_clusterX[8] NA NA NA.1 NA NA.2 NA NA.3 NA . . NA.126 NA Again help would be very much appreciated, Sebastian jholtman wrote: 'xx1' is a 'factor' and you have to convert to a character before selecting: data.xx1-data[ ,as.character(xx1)] On Mon, May 19, 2008 at 5:20 AM, SebastianEck [EMAIL PROTECTED] wrote: Hello, I have a specific problem, I have a large dataframe, and after clustering I want to select certain colums, the elements of a subcluster. My dataframe looks like this : colnames(data) [1] 101KF4319097339 102KF4319101170 103KF4319047549 104KF4319046389 [5] 105KF4319013260 106KF4319025582 107KF4319108763 108KF4319047040 [9] 109KF4319060241 110KF4319056658 111KF4319036131 112KF4319097194 . . . [701] 821KS4242126913 822KS4242026026 823KS4242003122 824IHT06020 [705] 825IHT06020 826IHT06005 827IHT06005 My subcluster looks like this xx1 xx1 [1] 101KF4319097339 102KF4319101170 103KF4319047549 104KF4319046389 [5] 125KF4319063638 126KF4319102180 127KF4319107122 128KF4319019607 [9] 135KF4319037854 138KF4319050003 140KF4319069150 152KF4319109279 . . . [125] 795KS4242028634 797KS4242032582 798KS4242035374 127 Levels: 101KF4319097339 102KF4319101170 103KF4319047549 ... 798KS4242035374 Now I want to select all elements from data that are in xx1, I tried data.xx1-data[ ,xx1] but that selects the just the first 127 (127 is the number of elements / length from xx1) elements from data. Any help would be very appreciated :) Sebastian -- View this message in context: http://www.nabble.com/Select-certain-elements-from-dataframe-tp17314209p17314209.html Sent from the R help mailing list archive at Nabble.com. __ 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. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem you are trying to solve? [[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. -- View this message in context: http://www.nabble.com/Select-certain-elements- from-dataframe-tp17314209p17335609.html Sent from the R help mailing list archive at Nabble.com. __ 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
Re: [R] function in nls argument -- robust estimation
Hi Kate and others, thanks for the info. Btw, you sent the different methods to analyze the data: nls, nls.lm and nlrob. Comparing the results visually nlrob performed better then nls, but nls.lm (using the 0.9 quantile of residuals) was still better than nlrob. My data may have a rather large amount of contamination, so that an M-estimator with a higher breakdown point should be used (least trimmed squares?). I haven't found this in R and wouldn't know how to implement it. But I can live with my results. Then remains the question of obtaining the parameter st. errors. Jackknife was suggested. Is there an R function I could use for that? cheers, Fernando Katharine Mullen wrote: Dear Martin, Thanks for the ideas regarding the relation of what Fernando is doing with robust regression. Indeed, it's an important point that he can't consider the standard error estimates on his parameters correct. I know from discussion off-list that he's happy with the results he has now; nevertheless the robust regression route may be an interesting alternative. I'm posting a scipt to R-SIG-robust now that compares the 3 ways (nls, nlrob and nls.lm w/residuals above a certain quantile set to zero). best, Kate On Sat, 10 May 2008, Martin Maechler wrote: Hi Kate and Fernando, I'm late into this thread, but from reading it I get the impression that Fernando really wants to do *robust* (as opposed to least-squares) non-linear model fitting. His proposal to set residuals to zero when they are outside a given bound is a very special case of an M-estimator, namely (if I'm not mistaken) the so-called Huber skipped-mean, an M-estimator with psi-function psi - function(x, k) ifelse(abs(x) = k, x, 0) It is known that this can be far from optimal, and either using Huber-psi or a redescender such as Tukey's biweight can be considerably better. Also note that the standard inference (std.errors, P-values, ...) that you'd get from summary(nlsfit) or anova(nls1, nl2) is *invalid* here, since you are effectively using *random* weighting. The nlrob() function in package 'robustbase' implements M-estimation of nonlinear models directly. Unfortunately, how to do correct inference in this situation is a hard problem, probably even an open research question in parts. I would expect that the bootstrap should work if you only have a few outliers. I don't have time at the moment to look at the example data and the model, and show you how to use it for nlrob(); if you find a way to you it for nls() , then the same should work for nlrob(). I'm CCing this to the specialists for Robust Stats with R mailing list, R-SIG-robust. Best regards, Martin Maechler ETH Zurich KateM == Katharine Mullen [EMAIL PROTECTED] on Fri, 9 May 2008 15:50:08 +0200 (CEST) writes: KateM You can take minpack.lm_1.1-0 (source code and MS Windows build, KateM respectively) from here: KateM http://www.nat.vu.nl/~kate/minpack.lm_1.1-0.tar.gz KateM http://www.nat.vu.nl/~kate/minpack.lm_1.1-0.zip KateM The bug that occurs when nprint = 0 is fixed. Also fixed is another KateM problem suggested your example: when the argument par is a list, calling KateM summary on the output of nls.lm was not working. KateM I'll submit the new version to CRAN soon. KateM This disscusion has been fruitful - thanks for it. KateM On Fri, 9 May 2008, Katharine Mullen wrote: You indeed found a bug. I can reproduce it (which I should have tried to do on other examples in the first place!). Thanks for finding it. It will be fixed in version 1.1-0 which I will submit to CRAN soon. On Fri, 9 May 2008, elnano wrote: Find the data (data_nls.lm_moyano.txt) here: ftp://ftp.bgc-jena.mpg.de/pub/outgoing/fmoyano Katharine Mullen wrote: Thanks for the details - it sounds like a bug. You can either send me the data in an email off-list or make it available on-line somewhere, so that I and other people can download it. __ 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. -- View this message in context: http://www.nabble.com/function-in-nls-argument-tp17108100p17146812.html Sent from the R help mailing list archive at Nabble.com. __ 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
[R] Printing output in STDOUT
Hi, Currently the R script I have is executed with this command: $ R CMD BATCH mycode.R And the output is stored in mycode.Rout. Is there a way I can issue command from shell (like above) so that the output is printed to STDOUT? It's troublesome to open the Rout file every time to debug. Regards, Edward __ 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] NOTE warning
On 20/05/2008 6:27 AM, Mikis Stasinopoulos wrote: Dear all I am using NAMESPACE in my package but I would like the user to be able to overwrite four functions: own.linkfun, own.linkinv, own.mu.eta and own.valideta. These are used to defined own link functions. Is there any way of doing that without getting the when I am checking the package? In your own code, you could explicitly get them. For example, own.linkfun - get(own.linkfun, env=globalenv()) ... However, this isn't a great design. What if the user wants to work on two different models, with different link functions? It would be better to pass the functions (or a list containing them) to your code as arguments to the call to your function. That's how glm() does it. Duncan Murdoch This is what I am getting: make.link.gamlss : linkfun: no visible binding for global variable 'own.linkfun' make.link.gamlss : linkinv: no visible binding for global variable 'own.linkinv' make.link.gamlss : mu.eta: no visible binding for global variable 'own.mu.eta' make.link.gamlss : valideta: no visible binding for global variable 'own.valideta' Thanks Mikis Stasinopoulos Companies Act 2006 : http://www.londonmet.ac.uk/companyinfo __ 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] R syntax, space smaller than space
Hallo, does nobody have an answer? I changed something in the package climatol especially in the function diagwl. Dos anybody know where I can put the code in the Internet to discuss it? I put it to: http://de.pastebin.ca/1023676 It would be kind if someone can have a look what is to make better. Pleas give me a hint where I can search to answer this questions: But mtext(paste(round(mean(tm*10))/10, ' °', C ,round(sum(p)), mm,sep=) makes the ° and the C very short together. There is no space. How can I fill a space in there which is smaller as a normal space? Also I made more transparency in the colours with: sfcol= rgb(0, 0, 0,alpha =0.2) Is there a possibility to safe the diagram as *png (because of the transparancy) ? Or an other format. I want to put it in an LaTeX file. With the pdf output I have to burst it in two pages and to experiment with the trim function of the includegraphicx package (\includegraphics[% trim= 270 280 200 200, scale=0.167, ]{../FotosBilder/Bilder/Klimadig/angermuendeklidig}) Is there a possibility to get only one pdf page only with the graphick, bet is that textwidth the same as picturwidth is. Thanks Torsten -- Torsten Wiebke ICQ: 21 80 40 58 8 Jabber: [EMAIL PROTECTED] [EMAIL PROTECTED] Yahoo: towieb __ 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] Starting R from .RData in linux
On 05/20/08 10:42, Agustin Lobo wrote: Marianne, I do the equivalent gnome-terminal -e R or xterm -e R and R starts on the home directory and indicating: ARGUMENT '/media/mifat32/Rexercises/.RData' __ignored__ Oops, turns out I get the same message, I just overlooked it. However, for me R starts in the appropriate directory and does load the objects in .RData in that directory, something I took as success given that normally I don't use this (I have alias R='R --no-restore-data --no-save' in my ~/.bashrc). So it seems R automatically loads the .RData in the given directory from wich you start it, and in your case you need to (a) get R to start from the dir that your .RDatat file is in (something Thunar does for me), then (b) if you plan to have more than one .RData file in any given dir, pass that as an arg to R. I guess (a) is a Nautilus question, (b) seems like might be unlikely/ impractical (better separate projects into separate dirs); and I don't know the answer to either (a) nor (b). m. p.s.for (a) you could also check whether gnome-terminal has an option to explicitly tell it a directory. Are you sure you do not add any other parameter? No, I don't but oops. I g I've tried xterm -e R --restore gnome-terminal -e R --restore same result. On 05/19/08 09:06, Agustin Lobo wrote: Hi! Is it possible to start R by clicking the .RData file in linux as in Windows? I've tried with ubuntu hardy using the right button and selecting R, but does not work. Is there any way to set it up? Marianne Promberger Wrote: You presumably need to associate the file type .RData with starting a terminal and then executing R in that terminal. I'm using Xubuntu, so my file manager is Thunar, and if I right click on an .RData and select use other application then custom command, then put in xfterm4 -e R this works. On Ubuntu, your terminal is probably something else and may have different syntax. (gnome-terminal maybe? then man gnome-terminal in case the -e option doesn't work for you). m. -- Marianne Promberger Graduate student in Psychology http://www.psych.upenn.edu/~mpromber -- Dr. Agustin Lobo Institut de Ciencies de la Terra Jaume Almera (CSIC) LLuis Sole Sabaris s/n 08028 Barcelona Spain Tel. 34 934095410 Fax. 34 934110012 email: [EMAIL PROTECTED] http://www.ija.csic.es/gt/obster -- Marianne Promberger Graduate student in Psychology http://www.psych.upenn.edu/~mpromber __ 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] Select certain elements from dataframe
Hi, sd_all_clusterX-sd_all[(as.character(clusterX)%in%as.character(sd_all$X)),] again selects everything from sd_all, whereas sd_all_clusterX-sd_all[(as.character(sd_all$X)%in%as.character(ClusterX)),] results in sd_all_clusterX having 681 entries, what is smaller than the whole dataset (707 entries) but much larger than the actual 127 clusterelements I want to select. Tank you that you are trying to solve the problem, and sorry for the trouble, I included a sample for my data now: Cluster: http://www.nabble.com/file/p17338101/clusterX clusterX sd_all_sample: http://www.nabble.com/file/p17338101/sd_all_sample sd_all_sample Again thank you for your help, Sebastian -- View this message in context: http://www.nabble.com/Select-certain-elements-from-dataframe-tp17314209p17338101.html Sent from the R help mailing list archive at Nabble.com. __ 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] Select certain elements from dataframe
Is this what you want: It turns out that clusterX was a dataframe - sd_all[sd_all$X %in% clusterX$X,] X mydata.mean.a mydata.mean.x mydata.sd.a mydata.sd.x mydata.log2.mean.a mydata.log2.mean.x 3 VS_0225 2.00 1.330.170.14 -0.01 -0.59 6 VS_0228 1.97 1.990.170.17 -0.02 -0.02 9 VS_0233 1.95 1.310.230.20 -0.05 -0.63 10 VS_0235 1.95 1.310.200.18 -0.04 -0.63 12 VS_0237 1.94 1.970.220.21 -0.05 -0.03 mydata.log2.sd.a mydata.log2.sd.x mydata.log2.median.a mydata.log2.median.x mydata.log2.mad.a 3 0.12 0.16 0.00 -0.58 0.12 6 0.13 0.13-0.01 -0.01 0.10 9 0.19 0.24-0.01 -0.57 0.13 10 0.16 0.21-0.01 -0.58 0.12 12 0.17 0.17-0.01 0.00 0.13 mydata.log2.mad.x snr 3 0.14 4.57 6 0.11 -0.01 9 0.18 3.63 10 0.16 4.13 12 0.13 -0.08 clusterX X 1 VS_0193 2 VS_0203 3 VS_0211 4 VS_0225 5 VS_0228 6 VS_0233 7 VS_0235 8 VS_0237 On Tue, May 20, 2008 at 7:20 AM, Sebastian Eck [EMAIL PROTECTED] wrote: Hi, sd_all_clusterX-sd_all[(as.character(clusterX)%in%as.character(sd_all$X)),] again selects everything from sd_all, whereas sd_all_clusterX-sd_all[(as.character(sd_all$X)%in%as.character(ClusterX)),] results in sd_all_clusterX having 681 entries, what is smaller than the whole dataset (707 entries) but much larger than the actual 127 clusterelements I want to select. Tank you that you are trying to solve the problem, and sorry for the trouble, I included a sample for my data now: Cluster: http://www.nabble.com/file/p17338101/clusterX clusterX sd_all_sample: http://www.nabble.com/file/p17338101/sd_all_sample sd_all_sample Again thank you for your help, Sebastian -- View this message in context: http://www.nabble.com/Select-certain-elements-from-dataframe-tp17314209p17338101.html Sent from the R help mailing list archive at Nabble.com. __ 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.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem you are trying to solve? [[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] how to save many trees within a loop?
Hi, I would like to save many trees created in a loop as different ones. I can plot them, but I can not get the whole tree properties saved. I paste the script below Also, How can I perform multivariate trees?, that is predicting a vector o values, not a simple scalar observation. Thanks in advance Angel for (i in 1:7){#loop para hacer arb arb=arb[i]#contador arb=tree(GF[,i]~Temp+Area+ISS+Zmix+Kd+Alk+DIN+SRP+RSi+CLA+Chloa, data=GF)# plot.tree(arb); tit=colnames(GF[i]);title(tit); text(arb,digits =2);#dig significativos __ 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 syntax, space smaller than space
On 5/20/2008 6:52 AM, Torsten Wiebke wrote: Hallo, does nobody have an answer? I changed something in the package climatol especially in the function diagwl. Dos anybody know where I can put the code in the Internet to discuss it? I put it to: http://de.pastebin.ca/1023676 It would be kind if someone can have a look what is to make better. It would be helpful if you created a 2 or 3 line example illustrating your problem. The link you posted is very long, and it is probably discouraging people from even looking at it. I know it discouraged me. Pleas give me a hint where I can search to answer this questions: But mtext(paste(round(mean(tm*10))/10, ' °', C ,round(sum(p)), mm,sep=) makes the ° and the C very short together. There is no space. How can I fill a space in there which is smaller as a normal space? I don't believe it's possible. You can have no space, or a full space. Also I made more transparency in the colours with: sfcol= rgb(0, 0, 0,alpha =0.2) Is there a possibility to safe the diagram as *png (because of the transparancy) ? Or an other format. I want to put it in an LaTeX file. With the pdf output I have to burst it in two pages and to experiment with the trim function of the includegraphicx package (\includegraphics[% trim= 270 280 200 200, scale=0.167, ]{../FotosBilder/Bilder/Klimadig/angermuendeklidig}) Is there a possibility to get only one pdf page only with the graphick, bet is that textwidth the same as picturwidth is. There are two independent sets of measurements when you are including R graphics in LaTeX. There is the set that R knows about: it determines how big the fonts are relative to the plot region, how big points are, etc. Then there is the size within LaTeX. There doesn't need to be any connection between them. What I normally do is plot slightly larger than I intend to display the graphic, then use \includegraphics[width=\textwidth]{graphic} to include it. I find that this makes the fonts slightly smaller, and they seem to be more consistent with the style of a paper. Duncan Murdoch __ 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] Yellow dog linux install?
Hello folks I am attempting to install R on a series of Apple G5 machines which are running Yellow Dog Linux 6.0. Has anyone had success with this, and is there something I should be doing which I am not? Upon configure, I receive the error message: checking whether mixed C/Fortran code can be run... configure: WARNING: cannot run mixed C/Fortran code configure: error: Maybe check LDFLAGS for paths to Fortran libraries? libg2c.so is found in the following places: /usr/lib/libg2c.so.0 /usr/lib/libg2c.so.0.0.0 /usr/lib/gcc/ppc64-yellowdog-linux/3.4.6/libg2c.so /usr/lib/gcc/ppc64-yellowdog-linux/3.4.6/64/libg2c.so So I've tried the following four LDFLAGS variants, both by exporting LDFLAGS in the bash shell and setting it in config.site: LDFLAGS='-L/usr/lib -L/usr/lib/gcc/ppc64-yellowdog-linux/3.4.6 -L/usr/lib/gcc/ppc64-yellowdog-linux/3.4.6/64' LDFLAGS='-L/usr/lib' LDFLAGS='-L/usr/lib/gcc/ppc64-yellowdog-linux/3.4.6' LDFLAGS='-L/usr/lib/gcc/ppc64-yellowdog-linux/3.4.6/64' Still no luck. Any ideas? Thanks, -ben __ 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 syntax, space smaller than space
Duncan Murdoch wrote: On 5/20/2008 6:52 AM, Torsten Wiebke wrote: Hallo, does nobody have an answer? I changed something in the package climatol especially in the function diagwl. Dos anybody know where I can put the code in the Internet to discuss it? I put it to: http://de.pastebin.ca/1023676 It would be kind if someone can have a look what is to make better. It would be helpful if you created a 2 or 3 line example illustrating your problem. The link you posted is very long, and it is probably discouraging people from even looking at it. I know it discouraged me. Pleas give me a hint where I can search to answer this questions: But mtext(paste(round(mean(tm*10))/10, ' °', C ,round(sum(p)), mm,sep=) makes the ° and the C very short together. There is no space. How can I fill a space in there which is smaller as a normal space? I don't believe it's possible. You can have no space, or a full space. Indeed, but if you use mathematical annotation you wil have more control. See ?plotmath for details. Some examples: plot(1:10, main = substitute(tm2 * degree * C, * p2 * mm, list(tm2 = round(mean(tm*10))/10, p2 = round(sum(p) plot(1:10, main = substitute(tm2 * degree ~~ C, * p2 * mm, list(tm2 = round(mean(tm*10))/10, p2 = round(sum(p) plot(1:10, main = substitute(tm2 * degree * phantom(.) * C, * p2 * mm, list(tm2 = round(mean(tm*10))/10, p2 = round(sum(p) plot(1:10, main = substitute(tm2 * degree * phantom(m) * C, * p2 * mm, list(tm2 = round(mean(tm*10))/10, p2 = round(sum(p) Best wishes, Uwe Ligges Also I made more transparency in the colours with: sfcol= rgb(0, 0, 0,alpha =0.2) Is there a possibility to safe the diagram as *png (because of the transparancy) ? Or an other format. I want to put it in an LaTeX file. With the pdf output I have to burst it in two pages and to experiment with the trim function of the includegraphicx package (\includegraphics[% trim= 270 280 200 200, scale=0.167, ]{../FotosBilder/Bilder/Klimadig/angermuendeklidig}) Is there a possibility to get only one pdf page only with the graphick, bet is that textwidth the same as picturwidth is. There are two independent sets of measurements when you are including R graphics in LaTeX. There is the set that R knows about: it determines how big the fonts are relative to the plot region, how big points are, etc. Then there is the size within LaTeX. There doesn't need to be any connection between them. What I normally do is plot slightly larger than I intend to display the graphic, then use \includegraphics[width=\textwidth]{graphic} to include it. I find that this makes the fonts slightly smaller, and they seem to be more consistent with the style of a paper. Duncan Murdoch __ 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] recompute values repeatedly, or new file for glm()?
Hello all, I need to tap into the collective wisdom of the group re an issue of efficiency. A sketch of the situation: Let's say 4000 observations in variables Y, X1, X2 , X3 and X4. I would like to feed various combinations of this expression Y ~ X1+X2+X3+X4 + I(X1^2)+I(X2^2)+I(X3^2)+I(X4^2) + X1*X2 + X1*X3 + X1*X4 + X2*X3 + X2*X4 + X3*X4 repeatedly to glm(). (I really have little knowledge about how R or glm() works internally) Let's say I call glm() 200 times with various combinations does it make sense to compute these various factors based on X1 .. X4 and store them in a file along with the original data, and then use that file for the glm() calls or will the overhead of computing these factors be so small that it's not worth computing these values ahead of time and storing them in a file? This is simplified example, I actually have 20 original variables rather than the 4 I show above. I hope this made some sense. Thanks, Esmail ps: If it makes sense to preprocess X1,X2,X3 and X4 to generate a new file that contains the values for X1, X2, X3, X4, I(X1^2), I(X2^2), I(X3^2), I(X4^2), X1*X2, X1*X3, X1*X4 ,X2*X3, X2*X4, X3*X4 is there an easy way to take the expression at the top of the message and convert the values in the original dataframe and compute them so that I can write them out to a new file? __ 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] need some help in plotting xy graph
Hi Dataframefdf contains bin rate overlay 1 1 90 Assign First/cc _from_SN_53 RNC_20_to_SN_50 RNC_21_Success Rate 2 2 93 Assign First/cc _from_SN_53 RNC_20_to_SN_50 RNC_21_Success Rate 3 1 90 Assign First/cc _from_SN_50 RNC_21_to_SN_53 RNC_20_Success Rate 4 2 94 Assign First/cc _from_SN_50 RNC_21_to_SN_53 RNC_20_Success Rate time 1 (04/01/08 16:02:30) 2 (04/01/08 16:07:30) 3 (04/01/08 16:02:30) 4 (04/01/08 16:07:30) And then I write the following lines of code to plot a xygraph on a pdf file n - length(unique(fdf$time)) x -sort(unique(fdf$time)) y-UTCsecs2chron(x) xscales - computeTimeScales(y) yscales-NULL scales-c(xscales,yscales) ylab-session transfer rate xlab-time lgnd.txt-levels(fdf$overlay) celnet.trellis.device(device=pdf, file=ravi_st.pdf, width=10,height = 10) main-this is the first report formd=rate ~ as.numeric(time) print( xyplot(formula(formd), data = fdf, groups = overlay, type = b, as.table = TRUE, cex=0.20, #subset = ok, commented to show breaks in graph main = main, xlab = Time, ylab = ylab, scales = scales, key = simpleKey(text = lgnd.txt, cex = 3/4, points = FALSE, lines = TRUE), page = function(n) annotate(opts$ann), sub = , layout = c(1,1) ) ) computeTimeScales - function(z, rot=0) ## z is a chron object {browser() ## how many days do the data span? n.days - ceiling(diff(range(z, na.rm = TRUE))) ## compute x ticks, pretty labels x - as.numeric(z) r - range(x, na.rm = TRUE) at.x - seq(from = r[1], to = r[2], length = 7) two_digits - function(x){ x - paste(0, x, sep=) substring(x,nchar(x)-1) } ## heuristics: use hh:mm when range of data falls within one day, ## otherwise use MM-DD hh:mm. at.z - chron(at.x) hh - paste(two_digits(hours(at.z)), two_digits(minutes(at.z)), sep=:) if(0){## hh:ss # this is commented as for more than one day from/to time no date was printed at.lbls - hh } else { ## MM-DD\nhh:ss m - month.day.year(at.z) dd - paste(two_digits(m$month), two_digits(m$day), sep=-) at.lbls - paste(dd, hh, sep=\n) } list(x=list(at = at.x, rot=rot, labels = at.lbls)) } celnet.theme - function() { celnet.theme - canonical.theme(pdf, color = TRUE) if(tolower(.Device) ==png) celnet.theme$background$col - white else canonical.theme(pdf, color = TRUE) celnet.theme$background$col - transparent celnet.theme } celnet.trellis.device - function(device, file, width = NULL, height = NULL,...) { ## analogous to trellis.device() -- this is just tailored to Celnet if(is.null(width)) width - 8 if(is.null(height)) height - 6 if(tolower(device)==png){ if(missing(width)) width - 72 * width if(missing(height)) height - 72 * height } if(tolower(device)==x11) trellis.device(device, width=width, height=height, theme=celnet.theme()) if(tolower(device)==ps || tolower(device)==postscript) trellis.device(postscript, file=file, color = TRUE, width=width, height=height, theme=celnet.theme()) else trellis.device(device, file=file, width=width, height=height, theme=celnet.theme()) } annotate - function(str, ...) ## print a metadata message at the top-bottom of current trellis display { else if(n==1){ x - 0.95 hjust - right } else if(n==2){ x - c(0.05, 0.95) hjust - c(left, right) } else if(n==3){ x - c(0.05, 0.50, 0.95) hjust - c(left, center, right) } x - unit(x, npc) y - unit(1.5, lines)## at 0.5, 1.5, ... lines for(i in seq(along = x)){ grid.text(label = str[i], x = x[i], y = y, just = c(hjust[i], bottom), ...) } invisible(str) } n - length(str) ## one line per string if(n==0) return(invisible(str)) } But I did nt get any desired o/p on a file ravi_st.pdf Can any one tell how can I get the desired o/p [[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.
Re: [R] how to save many trees within a loop?
Angel Marley angel_nauti at yahoo.com writes: I would like to save many trees created in a loop as different ones. I can plot them, but I can not get the whole tree properties saved. I paste the script below for (i in 1:7){#loop para hacer arb arb=arb[i]#contador arb=tree(GF[,i]~Temp+Area+ISS+Zmix+Kd+Alk+DIN+SRP+RSi+CLA+Chloa, data=GF)# plot.tree(arb); tit=colnames(GF[i]);title(tit); text(arb,digits =2);#dig significativos Save the for.. results in a list, and save/load the list. Please, provide a self-running examples next time. Dieter library(tree) trees = list() # Simple for - replacement trees[[Length]]= tree(Species ~Sepal.Length+Petal.Length, iris) trees[[Width]]= tree(Species ~Sepal.Width+Petal.Width, iris) save(trees, file=trees.Rdata) rm(trees) # Reload load(trees.Rdata) ## Well... add the decoration plot.tree(trees[[Length]]) __ 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] New mailing list R-SIG-Fedora
Thanks to Martin Maechler, there is a new special interest group (SIG) mailing list for users of R on Fedora: http://www.fedoraproject.org Fedora users will have noticed that RPMs for R 2.7.0 have not yet arrived through the Fedora Yum channel. This is because Fedora 9 went into feature freeze, blocking all updates, before R 2.7.0 was released. However, this is not the only reason for the delay. The Fedora project has introduced a peer review system. Package updates must now be tested before they are pushed through to the yum repository. The RPMs for R 2.7.0 on Fedora 7, 8, and 9 are currently available on the admin site: Fedora 9: https://admin.fedoraproject.org/updates/F9/FEDORA-2008-4012 Fedora 8: https://admin.fedoraproject.org/updates/F8/FEDORA-2008-4059 Fedora 7: https://admin.fedoraproject.org/updates/F7/FEDORA-2008-4021 Your help is needed to push these through to the yum repository. If you are a Fedora user, please download, test and score these RPMs. You can do this as an anonymous tester if you wish. Once the karma score reaches 2, the package will be pushed into stable repository and will become available through yum. R packages that are distributed as RPMs must also be peer reviewed. There is a version of R-Matrix that has been sitting in the testing queue for Fedora 8 since February... If you want to do this on a regular basis, please join the R-SIG-Fedora mailing list, where future announcements on this topic will be posted. The list is also open to all discussions of interest to Fedora users. The home page is: https://stat.ethz.ch/mailman/listinfo/r-sig-fedora Thanks Martyn -- Martyn Plummer [EMAIL PROTECTED] --- This message and its attachments are strictly confidenti...{{dropped:8}} __ 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] Lattice box percentile plot
Hello Thanks for your attempted help. I have just worked out how to do it. You take the code for panel.bpplot and near the top of the code replace lline with lpolygon. Then it take the $fill paramiter from the trellis settings. Seems to work, though I need to check it isn't doing something wierd. function (x, y, box.ratio = 1, means = TRUE, qref = c(0.5, 0.25, 0.75), probs = c(0.05, 0.125, 0.25, 0.375), nout = 0, datadensity = FALSE, scat1d.opts = NULL, font = box.dot$font, pch = box.dot$pch, cex = box.dot$cex, col = box.dot$col, ...) { if (.R.) { require(lattice) } grid - .R. if (grid) { lines - lpolygon ###replace lline with lpolygon points - lpoints segments - lsegments Yasir Kaheil wrote: it's a good question.. my guess is using panel.bpplot prevents filling in the shape the coffins- since the box is now two mirrored graphs. i hope i'm wrong. trellis.par.get() br = trellis.par.get(box.rectangle) br$col = black br$fill = lightblue #this is the parameter that fills in the box, but it doesn't work with panel.bpplot trellis.par.set(box.rectangle, br) bwplot(B~A,probs=seq(.01,.49,by=.01)) thanks y Mr Derik wrote: Dear Nabble. I am trying to draw a box percentile plot with trellis using the panel in Hmisc. I really want to colour the plots in. I can alter several of features of the plot by changing the trellis par settings but I just can’t fill the shape in. Here is some example code which alters line colour and dot symbol: require(lattice) require(Hmisc) A-c(rnorm(100,50,2),rnorm(100,60,5),rnorm(100,55,7)) B-rep(c(1,2,3),each=100) trellis.par.set(list(box.rectangle=list(col=black))) trellis.par.set(list(box.umbrella=list(col=black))) trellis.par.set(list(box.dot=list(pch=3,col=red))) bwplot(B~A,panel=panel.bpplot, probs=seq(.01,.49,by=.01)) I’d really appreciate it if someone could tell me how to change the fill colour as well as it is driving me mad. Chears. -- View this message in context: http://www.nabble.com/Lattice-box-percentile-plot-tp17274559p17341075.html Sent from the R help mailing list archive at Nabble.com. __ 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] Show Basic Properties of Functions
I would like to know some basic properties, such as its domain, its range, if it is increasing, of the function defined. I was wondering if R provides functionalities to show this information. If not, any ideas on writing such functions. Thanks. -james __ 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] Error in `[.matrix.coo`(x, rw, cl) : Subscripts out of bound
Hi All, I am facing a strange problem. I am making a R Package that internally run various packages and summarizes the results from them. I am getting this error from the piece of code written below. The text in red color is throwing Error in `[.matrix.coo`(x, rw, cl) : Subscripts out of bound Value of m is 99 This code works fine when I tested it. But money I make library it gives me error. I have attached the file names messages.txt which contains the warnings/messages generated while making R package. I am out of ideas Kindly suggest something regards vidhu `sm.quantreg` - function(y, lambda = 1.0, tau = 0.5, interpolate = FALSE) { nona - !is.na(y) ## Sparse matrices: E, D, and B if(!interpolate) { y.nona - y[nona] m - length(y.nona) *1.0 E - as.matrix.csr(0,m,m) diag(E) - 1 *D - diff(E)* B - rbind(E, lambda * D) ystar - c(y.nona, rep(0,m-1)) }else { ## interpolate missing values via weighting y[!nona] - 0 m - length(y) *1.0 E - as.matrix.csr(0,m,m) diag(E) - 1 D - diff(E) tmp - as.matrix.csr(0,m,m) diag(tmp) - as.numeric(nona) B - rbind(tmp, lambda * D) ystar - c(y, rep(0,m-1)) } ## use sparse matrices and accompanying mathematical operations cat (before try\n) try(myrq - rq.fit.sfn(as.matrix.csr(B), ystar, tau)) cat (after try\n) if(exists(myrq)) { if(!interpolate) { ys - rep(NA, length(y)) ys[nona] - myrq$coef }else { ys - myrq$coef } }else { cat(Error triggered within Quantreg algorithm!\n) ys - NULL } return(ys) } ## C:\Documents and Settings\Administrator\My DocumentsR CMD INSTALL t1 installing to 'c:/R/R-2.6.2/library' -- Making package t1 adding build stamp to DESCRIPTION installing NAMESPACE file and metadata making DLL ... gcc-sjlj -std=gnu99 -IC:/R/R-2.6.2/include -O3 -Wall -c CGHseg_rewrite.c -o CGHseg_rewrite.o gcc-sjlj -std=gnu99 -IC:/R/R-2.6.2/include -O3 -Wall -c rowMedians.c -o r owMedians.o gcc-sjlj -std=gnu99 -IC:/R/R-2.6.2/include -O3 -Wall -c runavg.c -o runav g.o windres --preprocessor=gcc-sjlj -E -xc -DRC_INVOKED -I C:/R/R-2.6.2/include - i t1_res.rc -o t1_res.o gcc-sjlj -std=gnu99 -shared -s -o t1.dll t1.def CGHseg_rewrite.o rowMedians.o runavg.o t1_res.o -LC:/R/R-2.6.2/bin-lR ... DLL made installing DLL installing R files installing data files installing man source files installing indices not zipping data installing help Building/Updating help pages for package 't1' Formats: text html latex example chm checkUploadFileFormat texthtmllatex example runAnalysis texthtmllatex example runCGHAnalysistexthtmllatex example preparing package t1 for lazy loading Loading required package: waveslim Loading required package: quantreg Loading required package: SparseM Loading required package: snapCGH Loading required package: limma Loading required package: tilingArray Loading required package: Biobase Loading required package: tools Welcome to Bioconductor Vignettes contain introductory material. To view, type 'openVignette()'. To cite Bioconductor, see 'citation(Biobase)' and for packages 'citation(pkgname)'. Loading required package: affy Loading required package: affyio Loading required package: preprocessCore Attaching package: 'affy' The following object(s) are masked from package:waveslim : pm Loading required package: RColorBrewer Loading required package: grid Loading required package: strucchange Loading required package: zoo Loading required package: sandwich Loading required package: vsn Loading required package: genefilter Loading required package: survival Loading required package: splines Attaching package: 'survival' The following object(s) are masked from package:quantreg : untangle.specials Loading required package: geneplotter Loading required package: annotate Loading required package: AnnotationDbi Loading required package: DBI Loading required package: RSQLite Loading required package: xtable Loading required package: lattice KernSmooth 2.22 installed Copyright M. P. Wand 1997 Loading required package: pixmap Loading required package: DNAcopy Attaching package: 'DNAcopy' The following object(s) are masked from package:tilingArray : segment Loading required package: GLAD Loading required package: aws Loading required package: tcltk Loading Tcl/Tk interface ... done Loading required package: cluster Loading required package: aCGH Loading required package: multtest Loading required package: sma Attaching package: 'aCGH' The following object(s) are masked from package:stats : heatmap Attaching package: 'snapCGH' The following object(s) are masked from
[R] Alignment of axes intersection
All, Very basic question I can't seem to find the answer to: plot(0:10, 0:10) The axes intersection is not aligned at (0,0) in the lower left. How does one force this? I searched for graphical parameters under par(graphics) but can't seem to find it. Thanks! David __ 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] Printing output in STDOUT
Edward Wijaya wrote: Hi, Currently the R script I have is executed with this command: $ R CMD BATCH mycode.R And the output is stored in mycode.Rout. Is there a way I can issue command from shell (like above) so that the output is printed to STDOUT? It's troublesome to open the Rout file every time to debug. Under a Unix system you could try to pipe the command into tail -f i.e., $ R CMD BATCH mycode.R | tail -f That should display the file as it gets written. I don't have access to a Unix system right now to give this a try but it should be a work around until someone who knows more about R can come up with an answer. HTH Esmail __ 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 static is dynamically linked!!
On Tue 20 May 2008 at 07:01:58 AM +0100, Prof Brian Ripley wrote: You asked for R to be built as a static lib, not for the front-end to be statically linked. It is not the R lib it is dynamically linking to (that is statically linked by default whether or not you ask for a separate lib), but the OS components. R depends on dlopen-ing extensions, so there is no way to make it entirely static. I see the bigger picture now. The goal was to get a single binary (PREFIX) working on multiple (very similar) systems. The docs/comments are not clear or out of date with regard to what is meant by static; I wanted the OS libs etc included so the package could operate more easily across machines at the site (nfs). But this makes me realize, since our OS is generally backwards compatible, I may be able to build on the old systems and use on the newer ones as well. Will give that a shot. // George -- George Georgalis, information system scientist IXOYE __ 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] Alignment of axes intersection
Pars xaxs, yaxs which take value i: see also 'An Introduction to R. On Tue, 20 May 2008, David Afshartous wrote: All, Very basic question I can't seem to find the answer to: plot(0:10, 0:10) The axes intersection is not aligned at (0,0) in the lower left. How does one force this? I searched for graphical parameters under par(graphics) but can't seem to find it. Thanks! David __ 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. -- 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@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] Alignment of axes intersection
You need to read the docs more carefully! xaxs and yaxs are the par values you want: set them to i . Cheers, Bert Gunter Genentech Nonclinical Statistics -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of David Afshartous Sent: Tuesday, May 20, 2008 8:50 AM To: r-help@r-project.org Subject: [R] Alignment of axes intersection All, Very basic question I can't seem to find the answer to: plot(0:10, 0:10) The axes intersection is not aligned at (0,0) in the lower left. How does one force this? I searched for graphical parameters under par(graphics) but can't seem to find it. Thanks! David __ 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] Printing output in STDOUT
On Tue, 20 May 2008, Esmail Bonakdarian wrote: Edward Wijaya wrote: Hi, Currently the R script I have is executed with this command: $ R CMD BATCH mycode.R And the output is stored in mycode.Rout. Is there a way I can issue command from shell (like above) so that the output is printed to STDOUT? It's troublesome to open the Rout file every time to debug. Under a Unix system you could try to pipe the command into tail -f i.e., $ R CMD BATCH mycode.R | tail -f That should display the file as it gets written. Buffering may get in the way -- so 'gets written' may be much later than when it is output by R. I don't have access to a Unix system right now to give this a try but it should be a work around until someone who knows more about R can come up with an answer. What is wrong with R --vanilla mycode.R or variants like R --no-save mycode.R R --no-save -f mycode.R or even Rscript mycode.R ? R CMD BATCH is intended (unsurprisingly) for batch use of R. HTH Esmail -- 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@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] Alignment of axes intersection
Mathematicians like to have axes cross at 0, the general rule for statistics is to have the axes positioned so that they help you understand the data, but don't interfere with the actual points (or force too much whitespace by being put to far away from the data), so the default positioning follows that idea. If you really want the axes to cross at 0 you can do: plot(0:10, 0:10, axes=FALSE) axis(1, pos=0) axis(2, pos=0) -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare [EMAIL PROTECTED] (801) 408-8111 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of David Afshartous Sent: Tuesday, May 20, 2008 9:50 AM To: r-help@r-project.org Subject: [R] Alignment of axes intersection All, Very basic question I can't seem to find the answer to: plot(0:10, 0:10) The axes intersection is not aligned at (0,0) in the lower left. How does one force this? I searched for graphical parameters under par(graphics) but can't seem to find it. Thanks! David __ 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] Alignment of axes intersection
Agreed. The main reason I wanted the change in alignment was that I had three curves that were converging to a asymptote, and when I drew the horizontal asymptote via abline(), it distorted the picture somewhat since the line from abline() goes all the way to the y-axis. On 5/20/08 12:21 PM, Greg Snow [EMAIL PROTECTED] wrote: Mathematicians like to have axes cross at 0, the general rule for statistics is to have the axes positioned so that they help you understand the data, but don't interfere with the actual points (or force too much whitespace by being put to far away from the data), so the default positioning follows that idea. If you really want the axes to cross at 0 you can do: plot(0:10, 0:10, axes=FALSE) axis(1, pos=0) axis(2, pos=0) -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare [EMAIL PROTECTED] (801) 408-8111 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of David Afshartous Sent: Tuesday, May 20, 2008 9:50 AM To: r-help@r-project.org Subject: [R] Alignment of axes intersection All, Very basic question I can't seem to find the answer to: plot(0:10, 0:10) The axes intersection is not aligned at (0,0) in the lower left. How does one force this? I searched for graphical parameters under par(graphics) but can't seem to find it. Thanks! David __ 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] Question about banking to 45 degrees.
Hello, I am very interested in banking to 45 degrees as defined by William S. Cleveland in Visualizing Data. I like to do it in R as well as Excel, etc. With R I have come across the following method: xyplot(x, y, aspect=xy) (part of lattice package) which will bank my graph to 45 degrees. My question is how do I obtain the aspect ratio that banks this graph to 45 degrees? I understand that R does it for me, but I would like to explicitly know the aspect ratio so that I can configure other graphs in Excel or other software. aspect ratio = v / h(v is vertical distance of plot, h is horizontal distance of plot. NOT in the data units, but true, actual distance). I've also come across banking (), but I don't understand it, nor the significance of the value it returns. Regardless, it doesn't seem to be the aspect ratio that I am looking for. I'd appreciate any help. Thanks in advance! ~Josh _ Refresh_family_safety_052008 __ 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] Printing output in STDOUT
Prof Brian Ripley wrote: On Tue, 20 May 2008, Esmail Bonakdarian wrote: Edward Wijaya wrote: Hi, Currently the R script I have is executed with this command: $ R CMD BATCH mycode.R And the output is stored in mycode.Rout. Is there a way I can issue command from shell (like above) so that the output is printed to STDOUT? It's troublesome to open the Rout file every time to debug. Under a Unix system you could try to pipe the command into tail -f i.e., $ R CMD BATCH mycode.R | tail -f That should display the file as it gets written. Buffering may get in the way -- so 'gets written' may be much later than when it is output by R. Yes, that's quite likely to be the case .. I like your suggestions below much better - saved away for future reference too. Esmail __ 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] how can i superpose 2 graphs
Hi there, Perhaps: set.seed(122) x=1:50 y1=2*x+x^2 y2=x^2 plot(x,y1,ylim=range(y1,y2),type='l',ylab=expression(f(x)),xlab='x', main='Two superimposed graphs') points(x,y2,type='l',col=2) legend(topleft,c(expression(f(x)==2*x+x^2),expression(f(x)==x^2)),lty=1,col=1:2) Also you could check ?curve and ?lines. HTH, Jorge On Sun, May 18, 2008 at 1:18 PM, hanen [EMAIL PROTECTED] wrote: Hio i tried to do this by: par(new=TRUE) but the result is one picture but y-axis has 2 différent graduations.how can i correct this?( i want one graduation on y axis). -- View this message in context: http://www.nabble.com/how-can-i-superpose-2--graphs-tp17305355p17305355.html Sent from the R help mailing list archive at Nabble.com. __ 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. [[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] R for loop question
Hello, I am trying to assign a variable name (x1,x2,x3...) in a loop statement that is based on a counter (counter is based on the number of hours within the datafile). The x1,x2 data will later be called for plotting the data. Below is a clip of the for loop I am using, any suggestions? k = 1 for (i in 1:length(stats$hour)) { x(i) = dataset[k,(3:15)] k = k+1 } Thanks, Doug -- - Douglas M. Hultstrand, MS Senior Hydrometeorologist Metstat, Inc. Windsor, Colorado voice: 970.686.1253 email: [EMAIL PROTECTED] web: http://www.metstat.com __ 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 for loop question
Douglas - To answer your question directly, use perhaps combination of ?assign and ?paste. In general, you usually do not have to do this sort of thing, but can use one of the apply family of functions (apply, sapply, lapply, mapply) to do whatever you want with shorter, cleaner code and fewer objects polluting your workspace. Since I do not know the structure of your data, I cannot really help any further at this point. Best, Erik Iverson Douglas M. Hultstrand wrote: Hello, I am trying to assign a variable name (x1,x2,x3...) in a loop statement that is based on a counter (counter is based on the number of hours within the datafile). The x1,x2 data will later be called for plotting the data. Below is a clip of the for loop I am using, any suggestions? k = 1 for (i in 1:length(stats$hour)) { x(i) = dataset[k,(3:15)] k = k+1 } Thanks, Doug __ 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] String buffer
On 5/20/2008 12:58 PM, Applejus wrote: Hello, I have an expression a in R that has about 2300 characters and I want to convert it to a string using toString or as.character. The problem is I am only getting the first 500 or so characters when I convert it to string. I tried to use substring in order to convert one bunch at a time, but when I type substring(a, 498, 1000) I get only 2 characters, meaning it seems there is a limit of 500 characters at most, even for the substring function. When you deparse a long expression, it comes back as a multi-element character vector. as.character() only returns the first element. You can get all of them by calling deparse() directly, and then perhaps you'll want to paste them together. I'm not sure if this is a bug in as.character, or just an undocumented limitation. The weird part is that the conversion with as.character works fine with Splus, but not in R. I wouldn't call it weird; there are lots of differences between the two programs. They have been developed independently. Duncan Murdoch Could anyone help me out? Is there a string buffer function like that of java? Should I change something in the console configuration? (I tried to increase the buffer but it still doesn't work) Thanks! __ 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] Draw Polygon with a Circular Side
Thank you very much Jim for you help!!Your help was my need!! I have create this function to draw a polygon with a circular side DrawPortion-function(init,finish,length_){ plot(0,xlim=c(-10,10),ylim=c(-10,10),xlab=,ylab=,type=n,axes=TRUE) polygon(c(0,length_*cos(seq(ToRadians(finish),ToRadians(init),length.out=50))), c(0,length_*sin(seq(ToRadians(finish),ToRadians(init),length.out=50))), border=#ff,col=#66ee33) } ToRadians-function(grades){ radians=(grades/180*pi); return(radians); } Thank you very much Jim A Greetings Luismi Jim Lemon-2 wrote: ermimi wrote: Hello Friends!!! I would want draw a circular histogram, and I would like draw a polygon with a circular side. This is easy if I use the functions polygon and arc, but I want that the polygon with a circular side have background colour. The polygon created with function polygon can have background colour, but the surface created with function arc can´t have background colour. How I could create a polygon with a circular side that have background colour?? Thank you very much, A greetings Luismi Hi Luismi, The phrase circular histogram brings to mind something like a wind rose. There are a few you could try: windrose in the oce and circular packages rosavent in the climatol package oz.windrose in the plotrix package and perhaps rose in the IDPmisc package Now about this polygon with a circular side. I think you mean the standard issue polygon like a rectangle except that one side is a circular arc instead of a straight line. If this bold conjecture is correct, here is an example for you: plot(0,xlim=c(-1,1),ylim=c(-1,1),xlab=,ylab=, type=n,axes=FALSE) polygon(c(0,-1,-1,0,cos(seq(pi/2,0,length.out=50)), cos(seq(2*pi,3*pi/2,length.out=50))),c(-1,-1,1,1, sin(seq(pi/2,0,length.out=50)),sin(seq(2*pi,3*pi/2,length.out=50))), border=#ff,col=#66ee33) Jim __ 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. -- View this message in context: http://www.nabble.com/Draw-Polygon-with-a-Circular-Side-tp17328921p17346192.html Sent from the R help mailing list archive at Nabble.com. __ 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] Programatic Method for Holiday Dummy Variables
I am working on a weekly analysis and would like to look into the effects of a holiday. As I only get weekly data how can I populate, automagically, a series of dummy variables that are aligned with my data. Snip - channel1 - odbcConnectExcel(D:/RSTATS/metrics.xls) sqlTables(channel1) sh1 - sqlFetch(channel1, Actuals$) channel2 - odbcConnectExcel(D:/RSTATS/events.xls) sqlTables(channel2) sh2 - sqlFetch(channel2, data$) tsU000=ts(sh1$U000,start=c(2004,1),freq=52) summary(tsU000) #Variable forecastDistance - 52 #Grab Existing Regressors cReg - sh2[1:length(tsU000),-1] #Grab X Future Regressors equal to the forecastDistance fReg - sh2[length(tsU000):(length(tsU000)+forecastDistance),-1] ---snip Somewhere in there I need to append to cReg a series of holiday dummy variables but here is the catch, it's weekly data. First How can I get an array of holidays in the first place aligned on weeks? e.g. week,xmas,newyears,holloween,cinco,...,qwanza, 1,0,0,0,0,0,...,0 2,0,0,0,0,0,...,0 3,0,0,0,0,0,...,0 4,0,0,0,0,0,...,0 5,0,0,0,0,0,...,0 .. 52,1,0,0,0,0,...,0 then how do I append the holiday array to the cReg array? Help I am confused and bewildered __ 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] for loop step
How do I define the incremental step in a for loop? for (j in 1:10){ cat(j, \n) } In the above example, if I want to increment j by 2 where do I specify that? Thanks [[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.
Re: [R] Question about banking to 45 degrees.
On 5/20/08, Joshua Hertlein [EMAIL PROTECTED] wrote: Hello, I am very interested in banking to 45 degrees as defined by William S. Cleveland in Visualizing Data. I like to do it in R as well as Excel, etc. With R I have come across the following method: xyplot(x, y, aspect=xy) (part of lattice package) which will bank my graph to 45 degrees. My question is how do I obtain the aspect ratio that banks this graph to 45 degrees? I understand that R does it for me, but I would like to explicitly know the aspect ratio so that I can configure other graphs in Excel or other software. foo - xyplot(sunspot.year ~ 1700:1988, type = l, aspect = xy) foo$aspect.ratio [1] 0.04554598 aspect ratio = v / h(v is vertical distance of plot, h is horizontal distance of plot. NOT in the data units, but true, actual distance). I've also come across banking (), but I don't understand it, nor the significance of the value it returns. Regardless, it doesn't seem to be the aspect ratio that I am looking for. banking(dx, dy) basically gives you the median of abs(dy/dx). The idea is that dx and dy define the slopes of the segments you want to bank (so typically, dx = diff(x) and dy = diff(y) if x and y are the data you want to plot). banking() gives you a single (summary) slope; you then choose the aspect ratio of your plot so that this slope (in the data coordinates) has a physical slope of 1. To do this, you solve an equation involving the data range in the x- and y-axes of your plot. -Deepayan __ 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] String buffer
On Tue, 20 May 2008, Duncan Murdoch wrote: On 5/20/2008 12:58 PM, Applejus wrote: Hello, I have an expression a in R that has about 2300 characters and I want to convert it to a string using toString or as.character. The problem is I am only getting the first 500 or so characters when I convert it to string. I tried to use substring in order to convert one bunch at a time, but when I type substring(a, 498, 1000) I get only 2 characters, meaning it seems there is a limit of 500 characters at most, even for the substring function. When you deparse a long expression, it comes back as a multi-element character vector. as.character() only returns the first element. You can get all of them by calling deparse() directly, and then perhaps you'll want to paste them together. I'm not sure if this is a bug in as.character, or just an undocumented limitation. It is documented, on the help page! 'as.character' truncates components of language objects to 500 characters (was about 70 before 1.3.1). The weird part is that the conversion with as.character works fine with Splus, but not in R. I wouldn't call it weird; there are lots of differences between the two programs. They have been developed independently. Duncan Murdoch Could anyone help me out? Is there a string buffer function like that of java? Should I change something in the console configuration? (I tried to increase the buffer but it still doesn't work) Thanks! __ 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. -- 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@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] for loop step
You are doing it in your bit about 1:10, which is shorthand for generating a sequence 1, 2, 3, ..., 9, 10. Use ?seq to do what you want. for(i in seq(1, 10, by = 2)) cat(i, \n) Best, Erik Nair, Murlidharan T wrote: How do I define the incremental step in a for loop? for (j in 1:10){ cat(j, \n) } In the above example, if I want to increment j by 2 where do I specify that? Thanks [[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] hist clarification
Can someone help me with a misunderstanding I'm having with hist? I expected, from the example below, that the number of bins would always be 10 and the length of the counts array the same. According to the help section 'breaks' can be a integer indicating the number of bins. From the example below, the number of bins (length of the counts array) varies. Am I wrong in expecting the same number of bins every time from my hist() call (am I doing something wrong)? hist(rnorm(1000),breaks=10)$counts; [1] 2 10 18 41 85 151 188 195 149 92 48 14 5 2 hist(rnorm(1000),breaks=10)$counts; [1] 1 5 19 39 89 155 207 179 162 89 32 19 3 1 hist(rnorm(1000),breaks=10)$counts; [1] 2 3 19 46 101 149 196 204 137 79 43 16 4 1 hist(rnorm(1000),breaks=10,plot=FALSE)$counts; [1] 2 6 19 41 89 166 188 193 151 87 37 14 6 1 hist(rnorm(1000),breaks=10,plot=FALSE)$counts; [1] 2 6 26 48 90 145 188 177 143 95 52 19 9 hist(rnorm(1000),breaks=10,plot=FALSE)$counts; [1] 8 14 35 101 148 195 197 158 82 34 20 8 hist(rnorm(1000),breaks=10,plot=FALSE)$counts; [1] 2 12 17 57 82 157 196 215 135 80 25 19 3 hist(rnorm(1000),breaks=10,plot=FALSE)$counts; [1] 1 3 14 51 86 130 212 194 152 89 45 18 5 hist(rnorm(1000),breaks=10,plot=FALSE)$counts; [1] 1 4 18 46 112 146 173 195 155 93 38 11 7 0 1 hist(rnorm(1000),breaks=10,plot=FALSE)$counts; [1] 1 2 13 39 97 148 198 189 145 101 40 26 1 hist(rnorm(1000),breaks=10,plot=FALSE)$counts; [1] 4 11 39 102 128 191 204 148 111 49 11 1 1 hist(rnorm(1000),breaks=10,plot=FALSE)$counts; [1] 1 0 19 136 354 309 160 20 1 hist(rnorm(1000),breaks=10,plot=FALSE)$counts; [1] 3 3 19 52 95 148 198 179 136 100 41 18 7 1 hist(rnorm(1000),breaks=10,plot=FALSE)$counts; [1] 2 4 18 39 88 155 178 188 170 88 46 18 5 1 hist(rnorm(1000),breaks=10,plot=FALSE)$counts; [1] 1 1 17 125 372 335 126 23 hist(rnorm(1000),breaks=10)$counts; [1] 3 21 36 88 153 194 196 158 96 38 13 3 1 hist(rnorm(1000),breaks=10)$counts; [1] 6 18 37 77 155 213 201 130 105 42 11 4 1 hist(rnorm(1000),breaks=10)$counts; [1] 2 2 21 35 80 155 181 199 165 99 37 16 8 hist(rnorm(1000),breaks=10)$counts; [1] 1 4 19 49 93 143 201 216 136 79 38 13 7 1 hist(rnorm(1000),breaks=10)$counts; [1] 1 3 19 38 100 138 208 182 147 93 48 18 5 hist(rnorm(1000),breaks=10)$counts; [1] 1 0 22 122 331 342 156 25 1 hist(rnorm(1000),breaks=10)$counts; [1] 2 8 10 48 98 154 170 194 168 91 40 15 2 hist(rnorm(1000),breaks=10)$counts; [1] 3 17 127 350 355 120 25 3 hist(rnorm(1000),breaks=10)$counts; [1] 3 6 8 43 81 151 188 216 163 85 33 15 7 1 Thanks, John [[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.
Re: [R] hist clarification
On 5/20/08, John Gant [EMAIL PROTECTED] wrote: Can someone help me with a misunderstanding I'm having with hist? I expected, from the example below, that the number of bins would always be 10 and the length of the counts array the same. According to the help section 'breaks' can be a integer indicating the number of bins. The help actually says: breaks: one of: * a vector giving the breakpoints between histogram cells, * a single number giving the number of cells for the histogram, * a character string naming an algorithm to compute the number of cells (see 'Details'), * a function to compute the number of cells. In the last three cases the number is a suggestion only. The last sentence explains your observation. BTW, this was recently discussed: https://stat.ethz.ch/pipermail/r-help/2008-May/162492.html -Deepayan __ 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] hist clarification
On 5/20/2008 2:51 PM, John Gant wrote: Can someone help me with a misunderstanding I'm having with hist? I expected, from the example below, that the number of bins would always be 10 and the length of the counts array the same. According to the help section 'breaks' can be a integer indicating the number of bins. From the example below, the number of bins (length of the counts array) varies. Am I wrong in expecting the same number of bins every time from my hist() call (am I doing something wrong)? Your expectation is wrong. When breaks is a single integer, it's a suggestion, it's not fixed. This is described on the help page: In the last three cases the number is a suggestion only. If you want to fix the locations of the breaks specify them explicitly. Duncan Murdoch hist(rnorm(1000),breaks=10)$counts; [1] 2 10 18 41 85 151 188 195 149 92 48 14 5 2 hist(rnorm(1000),breaks=10)$counts; [1] 1 5 19 39 89 155 207 179 162 89 32 19 3 1 hist(rnorm(1000),breaks=10)$counts; [1] 2 3 19 46 101 149 196 204 137 79 43 16 4 1 hist(rnorm(1000),breaks=10,plot=FALSE)$counts; [1] 2 6 19 41 89 166 188 193 151 87 37 14 6 1 hist(rnorm(1000),breaks=10,plot=FALSE)$counts; [1] 2 6 26 48 90 145 188 177 143 95 52 19 9 hist(rnorm(1000),breaks=10,plot=FALSE)$counts; [1] 8 14 35 101 148 195 197 158 82 34 20 8 hist(rnorm(1000),breaks=10,plot=FALSE)$counts; [1] 2 12 17 57 82 157 196 215 135 80 25 19 3 hist(rnorm(1000),breaks=10,plot=FALSE)$counts; [1] 1 3 14 51 86 130 212 194 152 89 45 18 5 hist(rnorm(1000),breaks=10,plot=FALSE)$counts; [1] 1 4 18 46 112 146 173 195 155 93 38 11 7 0 1 hist(rnorm(1000),breaks=10,plot=FALSE)$counts; [1] 1 2 13 39 97 148 198 189 145 101 40 26 1 hist(rnorm(1000),breaks=10,plot=FALSE)$counts; [1] 4 11 39 102 128 191 204 148 111 49 11 1 1 hist(rnorm(1000),breaks=10,plot=FALSE)$counts; [1] 1 0 19 136 354 309 160 20 1 hist(rnorm(1000),breaks=10,plot=FALSE)$counts; [1] 3 3 19 52 95 148 198 179 136 100 41 18 7 1 hist(rnorm(1000),breaks=10,plot=FALSE)$counts; [1] 2 4 18 39 88 155 178 188 170 88 46 18 5 1 hist(rnorm(1000),breaks=10,plot=FALSE)$counts; [1] 1 1 17 125 372 335 126 23 hist(rnorm(1000),breaks=10)$counts; [1] 3 21 36 88 153 194 196 158 96 38 13 3 1 hist(rnorm(1000),breaks=10)$counts; [1] 6 18 37 77 155 213 201 130 105 42 11 4 1 hist(rnorm(1000),breaks=10)$counts; [1] 2 2 21 35 80 155 181 199 165 99 37 16 8 hist(rnorm(1000),breaks=10)$counts; [1] 1 4 19 49 93 143 201 216 136 79 38 13 7 1 hist(rnorm(1000),breaks=10)$counts; [1] 1 3 19 38 100 138 208 182 147 93 48 18 5 hist(rnorm(1000),breaks=10)$counts; [1] 1 0 22 122 331 342 156 25 1 hist(rnorm(1000),breaks=10)$counts; [1] 2 8 10 48 98 154 170 194 168 91 40 15 2 hist(rnorm(1000),breaks=10)$counts; [1] 3 17 127 350 355 120 25 3 hist(rnorm(1000),breaks=10)$counts; [1] 3 6 8 43 81 151 188 216 163 85 33 15 7 1 Thanks, John [[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] Alignment of axes intersection
If the issue is with abline going all the way to the axis rather than stopping at 0 (or other value), then you may want to look at the clip function (allow the default axes, but clip abline to a smaller region), for example: plot(0:10,0:10) points(0:10,0:10) clip(2,8,0,10) points(0:10,0:10) abline(h=5) The clipping region is a little tricky (that's the reson for the 2 calls to points after the plot), but it can limit the region of plotting. Another approach is: library(TeachingDemos) # assuming this is installed plot(0:10,0:10) clipplot( abline(h=5), xlim=c(2,8) ) See the help on clip and/or clipplot for more examples. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare [EMAIL PROTECTED] (801) 408-8111 -Original Message- From: David Afshartous [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 20, 2008 10:37 AM To: Greg Snow; r-help@r-project.org Subject: Re: Alignment of axes intersection Agreed. The main reason I wanted the change in alignment was that I had three curves that were converging to a asymptote, and when I drew the horizontal asymptote via abline(), it distorted the picture somewhat since the line from abline() goes all the way to the y-axis. On 5/20/08 12:21 PM, Greg Snow [EMAIL PROTECTED] wrote: Mathematicians like to have axes cross at 0, the general rule for statistics is to have the axes positioned so that they help you understand the data, but don't interfere with the actual points (or force too much whitespace by being put to far away from the data), so the default positioning follows that idea. If you really want the axes to cross at 0 you can do: plot(0:10, 0:10, axes=FALSE) axis(1, pos=0) axis(2, pos=0) -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare [EMAIL PROTECTED] (801) 408-8111 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of David Afshartous Sent: Tuesday, May 20, 2008 9:50 AM To: r-help@r-project.org Subject: [R] Alignment of axes intersection All, Very basic question I can't seem to find the answer to: plot(0:10, 0:10) The axes intersection is not aligned at (0,0) in the lower left. How does one force this? I searched for graphical parameters under par(graphics) but can't seem to find it. Thanks! David __ 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] R for loop question
I had to do the same thing many times, i usually use a combination of the functions eval, parse and sprinf, as below: k - 1 for (i in 1:length(stats$hour)) { eval(parse(text=sprintf(x%s - dataset[%s,(3:15)], i, k))) k - k+1 } what it does is: eval(parse(text=STRING)) is a way to execute what is written on STRING and sprintf(TEXT%sTEXT, VARIABLE) substitutes the %s part of the text in the first argument for whatever is on the second argument (you can extend this to many %s parts) Note: i've changed the = for the - because someone told me that it was more correct (don't ask me why though!). JM El Martes, 20 de Mayo de 2008 13:58, Douglas M. Hultstrand escribió: Hello, I am trying to assign a variable name (x1,x2,x3...) in a loop statement that is based on a counter (counter is based on the number of hours within the datafile). The x1,x2 data will later be called for plotting the data. Below is a clip of the for loop I am using, any suggestions? k = 1 for (i in 1:length(stats$hour)) { x(i) = dataset[k,(3:15)] k = k+1 } Thanks, Doug __ 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 for loop question
Take a look at ?assign Juan Manuel Barreneche wrote: I had to do the same thing many times, i usually use a combination of the functions eval, parse and sprinf, as below: k - 1 for (i in 1:length(stats$hour)) { eval(parse(text=sprintf(x%s - dataset[%s,(3:15)], i, k))) k - k+1 } what it does is: eval(parse(text=STRING)) is a way to execute what is written on STRING and sprintf(TEXT%sTEXT, VARIABLE) substitutes the %s part of the text in the first argument for whatever is on the second argument (you can extend this to many %s parts) Note: i've changed the = for the - because someone told me that it was more correct (don't ask me why though!). JM El Martes, 20 de Mayo de 2008 13:58, Douglas M. Hultstrand escribió: Hello, I am trying to assign a variable name (x1,x2,x3...) in a loop statement that is based on a counter (counter is based on the number of hours within the datafile). The x1,x2 data will later be called for plotting the data. Below is a clip of the for loop I am using, any suggestions? k = 1 for (i in 1:length(stats$hour)) { x(i) = dataset[k,(3:15)] k = k+1 } Thanks, Doug __ 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] Question about banking to 45 degrees.
On May 20, 2008, at 2:34 PM, Deepayan Sarkar wrote: On 5/20/08, Joshua Hertlein [EMAIL PROTECTED] wrote: Hello, I am very interested in banking to 45 degrees as defined by William S. Cleveland in Visualizing Data. I like to do it in R as well as Excel, etc. With R I have come across the following method: xyplot(x, y, aspect=xy) (part of lattice package) which will bank my graph to 45 degrees. My question is how do I obtain the aspect ratio that banks this graph to 45 degrees? I understand that R does it for me, but I would like to explicitly know the aspect ratio so that I can configure other graphs in Excel or other software. foo - xyplot(sunspot.year ~ 1700:1988, type = l, aspect = xy) foo$aspect.ratio [1] 0.04554598 aspect ratio = v / h(v is vertical distance of plot, h is horizontal distance of plot. NOT in the data units, but true, actual distance). I've also come across banking (), but I don't understand it, nor the significance of the value it returns. Regardless, it doesn't seem to be the aspect ratio that I am looking for. banking(dx, dy) basically gives you the median of abs(dy/dx). The idea is that dx and dy define the slopes of the segments you want to bank (so typically, dx = diff(x) and dy = diff(y) if x and y are the data you want to plot). banking() gives you a single (summary) slope; you then choose the aspect ratio of your plot so that this slope (in the data coordinates) has a physical slope of 1. To do this, you solve an equation involving the data range in the x- and y-axes of your plot. Here is how I see it. Let me define a visual y-unit as the height of a unit of data in the y-direction, and similarly for a visual x-unit. Then the aspect ratio is the quotient of the visual y-unit over the visual x-unit. So the aspect ratio is the number of visual x-units that have the same length as one visual y-unit. If a line has real (data) slope r, and the aspect ratio is b, then the line appears with slope rb. Now, there are two things one can compute (for simplicity I assume all slopes are positive, insert absolute values as necessary): 1. The value of the aspect ratio, that makes the median of the visual slopes be 1. This would be obtained by requiring the median of all the rb to be 1, which means that the aspect ratio would be 1/median (slopes). 2. The median of the aspect ratios, that make each individual line have slope 1. So for each line with slope r, we consider the aspect ratio 1/r, and then take the median of that. So this would be median (1/slopes). Now, unless I am missing something, the banking function computes the second one of these, while I think the documentation (and my intuition) say that we want the first of these. In the case where there is an odd number of data, they would agree, but otherwise one is related to the arithmetic mean of the two middle observations, while the other is referring to the harmonic mean of the two observations. Those will likely be close to each other in most cases, so perhaps this is a moot point in practice, but am I wrong in thinking that 1/median(abs(dy[id]/dx[id])) would be the right thing to have in the code to the banking function? -Deepayan Haris Skiadas Department of Mathematics and Computer Science Hanover College __ 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] Finding functions
Hi All: Can anyone give me a hint about how to find functions built in in R. based on the articule below it should be something called DIYhelp but I can't find it. Thanks Part of the Kickstarting R package is a little text searching facility called DIYHelp. The program is based upon a simple, brute-force search of the directory tree from the point that you specify. The concept is that you often know approximately where the information you want to know is, but not exactly which file. By unpacking the diyhelp.tar.gz file in a suitable place (often /usr/local) and following the instructions in the INSTALL file, you can see if the program helps you to find functions in R. Felipe D. Carrillo Fishery Biologist Department of the Interior US Fish Wildlife Service California, USA __ 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] drawing lines in 3D (rotating them)
Hi the list, I write a short function to draw lines in 3D, showing then turning. At some point, I add delais to slow down the rotation. So two questions: 1) I try to find a library to draw animate lines in 3D but I did not find. That surprise me since it is very simple to do. Did I forget to look somewhere ? If it does not exists and I have to use my own function : 2) Is it possible to use the time wasted in delais for some calculous ? In other word, can I run some calculous during a certain amount of time, then drawing a plot, then calculous then plot... 3) Is there a way to end the rotation less violant than Esc ? Thanks for your help. Here is my code : - 8 --- data - array(c(13,14,13,15, 14,15,16,15, 16,17,16,18 , 45,46,85,59, 43,58,70,56, 45,75,65,65), dim=c(4,3,2),dimnames=c(id,temps,var)) plot3Dlines - function(x,y,mean=TRUE,angle=20,delais=10,color,...){ time - 1:dim(x)[[2]] var1 - seq(min(x[,,1],na.rm=TRUE),max(x[,,1],na.rm=TRUE),length.out=11) var2 - matrix(NA,length(time),length(var1))#outer(x, y, NA) var2[1,1] - min(x[,,2],na.rm=TRUE) var2[length(time),length(var1)] - max(x[,,2],na.rm=TRUE) nbLines-min(100,dim(x)[1]) if(missing(color)){color-2:(nbLines+1)}else{} repeat{ res - persp(x=time, y=var1, z=var2, theta = angle, phi = 10, expand = 0.5, col = lightblue, ltheta = 120, shade = 0.75, ticktype = detailed, xlab = time, ylab = var1, zlab = var2) angle - angle+1 for(i in 1:nbLines){ yy=x[i,,1] zz=x[i,,2] lines (trans3d(time, yy, zz, pmat = res),col=color[i]) } for(k in 1:delais){} } } plot3Dlines(data) Thanks Christophe __ 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 for loop question
Consider using a 'list' instead of creating a lot of objects that you then have to manage: x - lapply(1:length(stats$hour), function(.indx) dataset[.indx, 3:15]) You can then access the data as x[[1]], ... On Tue, May 20, 2008 at 12:58 PM, Douglas M. Hultstrand [EMAIL PROTECTED] wrote: Hello, I am trying to assign a variable name (x1,x2,x3...) in a loop statement that is based on a counter (counter is based on the number of hours within the datafile). The x1,x2 data will later be called for plotting the data. Below is a clip of the for loop I am using, any suggestions? k = 1 for (i in 1:length(stats$hour)) { x(i) = dataset[k,(3:15)] k = k+1 } Thanks, Doug -- - Douglas M. Hultstrand, MS Senior Hydrometeorologist Metstat, Inc. Windsor, Colorado voice: 970.686.1253 email: [EMAIL PROTECTED] web: http://www.metstat.com __ 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.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem you are trying to solve? [[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.
Re: [R] Finding functions
On 21/05/2008, at 8:21 AM, Felipe Carrillo wrote: Hi All: Can anyone give me a hint about how to find functions built in in R. based on the articule below it should be something called DIYhelp but I can't find it. Thanks Part of the Kickstarting R package is a little text searching facility called DIYHelp. The program is based upon a simple, brute-force search of the directory tree from the point that you specify. The concept is that you often know approximately where the information you want to know is, but not exactly which file. By unpacking the diyhelp.tar.gz file in a suitable place (often /usr/local) and following the instructions in the INSTALL file, you can see if the program helps you to find functions in R. See http://finzi.psych.upenn.edu/R/Rhelp01/archive/13146.html cheers, Rolf Turner ## Attention:\ This e-mail message is privileged and confid...{{dropped:9}} __ 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] drawing lines in 3D (rotating them)
Try the 'rgl' package On Tue, May 20, 2008 at 4:19 PM, [EMAIL PROTECTED] wrote: Hi the list, I write a short function to draw lines in 3D, showing then turning. At some point, I add delais to slow down the rotation. So two questions: 1) I try to find a library to draw animate lines in 3D but I did not find. That surprise me since it is very simple to do. Did I forget to look somewhere ? If it does not exists and I have to use my own function : 2) Is it possible to use the time wasted in delais for some calculous ? In other word, can I run some calculous during a certain amount of time, then drawing a plot, then calculous then plot... 3) Is there a way to end the rotation less violant than Esc ? Thanks for your help. Here is my code : - 8 --- data - array(c(13,14,13,15, 14,15,16,15, 16,17,16,18 , 45,46,85,59, 43,58,70,56, 45,75,65,65), dim=c(4,3,2),dimnames=c(id,temps,var)) plot3Dlines - function(x,y,mean=TRUE,angle=20,delais=10,color,...){ time - 1:dim(x)[[2]] var1 - seq(min(x[,,1],na.rm=TRUE),max(x[,,1],na.rm=TRUE),length.out=11) var2 - matrix(NA,length(time),length(var1))#outer(x, y, NA) var2[1,1] - min(x[,,2],na.rm=TRUE) var2[length(time),length(var1)] - max(x[,,2],na.rm=TRUE) nbLines-min(100,dim(x)[1]) if(missing(color)){color-2:(nbLines+1)}else{} repeat{ res - persp(x=time, y=var1, z=var2, theta = angle, phi = 10, expand = 0.5, col = lightblue, ltheta = 120, shade = 0.75, ticktype = detailed, xlab = time, ylab = var1, zlab = var2) angle - angle+1 for(i in 1:nbLines){ yy=x[i,,1] zz=x[i,,2] lines (trans3d(time, yy, zz, pmat = res),col=color[i]) } for(k in 1:delais){} } } plot3Dlines(data) Thanks Christophe __ 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.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem you are trying to solve? [[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.
Re: [R] R 2.70 + ps2pdf14
thanks. I am now using R-patched 2008-05-18 r45723 . This is probably intended, but if not, I wanted to note it briefly: on the pdf output device, symbol 1 is always black, no matter what color is selected. symbols 10 and 13 contain black. symbol 19 is the replacement for symbol 1 that takes on the color. forgive the semicolons: pdf.start(test); # just encapsulates what you would expect. NM=25; plot( 0, type=n, ylim=c(0,6), xlim=c(0,NM), xlab=0-8, ylab=0-5 ); points( 1:NM, rep(1,NM), pch=1:NM, col=black); points( 1:NM, rep(2,NM), pch=1:NM, col=green); text( 1:NM, rep(3,NM), 1:NM, col=1:NM, cex=0.75); pdf.end(); /iaw On Sun, May 18, 2008 at 12:51 PM, hadley wickham [EMAIL PROTECTED] wrote: if developers from the R graphics group are reading this, given that this strange output is not just my imagination, maybe it would be worthwhile to see if the R output pdf could be made more robust to avoid this feature. I stumbled onto it deep in a program, and spend an afternoon distilling it down to the R script that I posted. It was quite puzzling. Have you tried R-patched? I think Brian Ripley fixed this some days ago. Hadley -- http://had.co.nz/ __ 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] 6 Courses: Upcoming June-July 2008 R/S+ Course Schedule by XLSolutions Corp
Our June-July 2008 R/S+ course schedule is now available. Please check out this link for additional information and direct enquiries to Sue Turner [EMAIL PROTECTED] Phone: 206 686 1578 Can't see your city? Please email us! www.xlsolutions-corp.com/courselist.htm (1) R/S System: Advanced Programming *** San Francisco / July 28-29, 2008 *** *** Seattle / July 28-29, 2008 *** *** Salt Lake City / June 26-27, 2008 *** (2) R/S Fundamentals and Programming Techniques *** San Francisco / June 23-24, 2008 *** *** New York City / July 28-29, 2008 *** (3) Data Mining: Practical Tools and Techniques in R/Splus *** San Franciso June 23-24, 2008 *** (4) R/S System: Complementing and Extending Statistical Computing for SAS Users *** Raleigh / July 28-29, 2008 *** (5) Introduction to R/S+ programming: Microarrays Analysis and Bioconductor. *** Los Angeles / June 26-27, 2008*** (6) Microarrays Data Analysis with R/S+ and GGobi *** New York City / July 28-29, 2008*** www.xlsolutions-corp.com/courselist.htm Payment due AFTER the class Email us for group discounts. Email Sue Turner: [EMAIL PROTECTED] Phone: 206-686-1578 Visit us: www.xlsolutions-corp.com/courselist.htm Please let us know if you and your colleagues are interested in this class to take advantage of group discount. Register now to secure your seat! Cheers, Elvis Miller, PhD Manager Training. XLSolutions Corporation 206 686 1578 www.xlsolutions-corp.com __ 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] rose diagram
hi all - I am student researcher in Bioengineeing and I am very new member of this group as well as a very new user of R. To my knowledge, rose.diag is a available function in circstat that i can use to plot circular data. Ideally I want to plot half-circle since I only have 0-180 deg angles. I have seen papers doing that, but was curious if R can do that. I would appreciate any comments regarding this. Thank you. Sagar Joshi [[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] Finding Functions
Thank you all for your help, it looks like www.rseek.org its a good place to look for help. Hi Felipe, It's a private message, so I hope you don't mind. Regarding your question, personally I think that apropos(what you want here), i.e, apropos(lm) is very useful. I use www.rseek.org from myy browser and both RSiteSearch(what you want here) and Help+Html help (in the tools bar) from the console. Felipe D. Carrillo Fishery Biologist Department of the Interior US Fish Wildlife Service California, USA __ 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 about banking to 45 degrees.
On 5/20/08, Charilaos Skiadas [EMAIL PROTECTED] wrote: Here is how I see it. Let me define a visual y-unit as the height of a unit of data in the y-direction, and similarly for a visual x-unit. Then the aspect ratio is the quotient of the visual y-unit over the visual x-unit. So the aspect ratio is the number of visual x-units that have the same length as one visual y-unit. [Not that it matters, but it is not clear what you mean here. Let's say we have a 100cm x 100cm plot, with data ranges xlim=c(0, 100) and ylim=c(0, 200). Then, the aspect ratio is 1, your visual y-unit is 0.5cm, and visual x-unit is 1cm (so their ratio is 0.5).] If a line has real (data) slope r, and the aspect ratio is b, then the line appears with slope rb. Agreed. Now, there are two things one can compute (for simplicity I assume all slopes are positive, insert absolute values as necessary): 1. The value of the aspect ratio, that makes the median of the visual slopes be 1. This would be obtained by requiring the median of all the rb to be 1, which means that the aspect ratio would be 1/median(slopes). 2. The median of the aspect ratios, that make each individual line have slope 1. So for each line with slope r, we consider the aspect ratio 1/r, and then take the median of that. So this would be median(1/slopes). Now, unless I am missing something, the banking function computes the second one of these, while I think the documentation (and my intuition) say that we want the first of these. In the case where there is an odd number of data, they would agree, but otherwise one is related to the arithmetic mean of the two middle observations, while the other is referring to the harmonic mean of the two observations. Those will likely be close to each other in most cases, so perhaps this is a moot point in practice, but am I wrong in thinking that 1/median(abs(dy[id]/dx[id])) would be the right thing to have in the code to the banking function? I agree with your analysis, but would claim that both calculations are right, since the median of 2 numbers is formally any number in between. I think it is unlikely that the difference in calculations leads to any difference in the perceptual benefits. Of course, the current calculation has the advantage of doing one less division! :-) -Deepayan __ 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 about banking to 45 degrees.
On May 20, 2008, at 5:59 PM, Deepayan Sarkar wrote: On 5/20/08, Charilaos Skiadas [EMAIL PROTECTED] wrote: Here is how I see it. Let me define a visual y-unit as the height of a unit of data in the y-direction, and similarly for a visual x-unit. Then the aspect ratio is the quotient of the visual y-unit over the visual x-unit. So the aspect ratio is the number of visual x-units that have the same length as one visual y-unit. [Not that it matters, but it is not clear what you mean here. Let's say we have a 100cm x 100cm plot, with data ranges xlim=c(0, 100) and ylim=c(0, 200). Then, the aspect ratio is 1, your visual y-unit is 0.5cm, and visual x-unit is 1cm (so their ratio is 0.5).] So in this case, the slope of the line y=x, which is 1, appears as 0.5. I effectively wanted to combine the two effects, of the sizes of the two scales and of the sizes of the window. They both have an effect on how a line of slope 1 is seen. But perhaps I am missing something here? If a line has real (data) slope r, and the aspect ratio is b, then the line appears with slope rb. Agreed. Now, there are two things one can compute (for simplicity I assume all slopes are positive, insert absolute values as necessary): 1. The value of the aspect ratio, that makes the median of the visual slopes be 1. This would be obtained by requiring the median of all the rb to be 1, which means that the aspect ratio would be 1/median(slopes). 2. The median of the aspect ratios, that make each individual line have slope 1. So for each line with slope r, we consider the aspect ratio 1/r, and then take the median of that. So this would be median(1/slopes). I agree with your analysis, but would claim that both calculations are right, since the median of 2 numbers is formally any number in between. That's a very good point, I never thought of it that way (though I have to say, I haven't seen anything but the arithmetic average used in getting THE median before). I think it is unlikely that the difference in calculations leads to any difference in the perceptual benefits. Agreed. Of course, the current calculation has the advantage of doing one less division! :-) For me, that's reason enough to keep it as is ;) -Deepayan Haris Skiadas Department of Mathematics and Computer Science Hanover College __ 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 about banking to 45 degrees.
I've also come across banking (), but I don't understand it, nor the significance of the value it returns. Regardless, it doesn't seem to be the aspect ratio that I am looking for. You might also want to have a look at: @article{heer:2006, Title = {Multi-scale banking to 45 degrees}, Author = {Heer, Jeffrey and Agrawala, Maneesh}, Journal = {IEEE Transactions on Visualization and Computer Graphics}, Number = {5}, Url = {http://vis.berkeley.edu/papers/banking/}, Volume = {12}, Year = {2006} } It's a rather nice extension. Hadley -- http://had.co.nz/ __ 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 creating a correlation matrix
Hello all. I have 14 variables, named D2_1, D2_2,...,D2_14 (inherited from a data set). I would like to create a matrix of correlations, although I would be content in just learning how to create a proper do loop. I tried something like this: (for i in 1:14){cor(D2_[i],D2_[i], use = complete.obs)} This is wrong, of course, but I don't know how to tell R to run through D2_1, D2_2,...,D2_14 giving me the correlations for each pair. Any help or hints would be appreciated. Sincerely, Robert O'Brien __ 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] Help creating a correlation matrix
Hi Robert, There are so many way to do what you want to do. A good staring point would be http://www.nabble.com/Re%3A-applying-cor.test-to-a-%28m%2C-n%29-matrix---SUMMARY-to17150239.html#a17150239 HTH, Jorge On Tue, May 20, 2008 at 6:41 PM, Robert O'Brien [EMAIL PROTECTED] wrote: Hello all. I have 14 variables, named D2_1, D2_2,...,D2_14 (inherited from a data set). I would like to create a matrix of correlations, although I would be content in just learning how to create a proper do loop. I tried something like this: (for i in 1:14){cor(D2_[i],D2_[i], use = complete.obs)} This is wrong, of course, but I don't know how to tell R to run through D2_1, D2_2,...,D2_14 giving me the correlations for each pair. Any help or hints would be appreciated. Sincerely, Robert O'Brien __ 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. [[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] Nonlinear regression
Could someone help me on the following: SAS has DUD (Does not Use Derivatives) for nonlinear regression. Does R has a similar capability? I am not good at derivatives and may get my derivative wrong before feeding it to a nonlinear regression procedure. Any help would be much appreciated. Liu Hancock Forest Management NZ Tokoroa, New Zealand DDI: 07-8850387 Mobile: 021-1576178 A/H: 06 868 4288 [EMAIL PROTECTED] The information contained in this email and any attachments is strictly confidential and is for the use of the intended recipient. Any use, dissemination, distribution, or reproduction of any part of this email or any attachment is prohibited. If you are not the intended recipient, please notify the sender by return email and delete all copies including attachments. [[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.
Re: [R] Nonlinear regression
?nls (I always knew SAS *is* a DUD, but never that it has a DUD too...) Bill Venables CSIRO Laboratories PO Box 120, Cleveland, 4163 AUSTRALIA Office Phone (email preferred): +61 7 3826 7251 Fax (if absolutely necessary): +61 7 3826 7304 Mobile: +61 4 8819 4402 Home Phone: +61 7 3286 7700 mailto:[EMAIL PROTECTED] http://www.cmis.csiro.au/bill.venables/ -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Wednesday, 21 May 2008 9:23 AM To: r-help@r-project.org Subject: [R] Nonlinear regression Could someone help me on the following: SAS has DUD (Does not Use Derivatives) for nonlinear regression. Does R has a similar capability? I am not good at derivatives and may get my derivative wrong before feeding it to a nonlinear regression procedure. Any help would be much appreciated. Liu Hancock Forest Management NZ Tokoroa, New Zealand DDI: 07-8850387 Mobile: 021-1576178 A/H: 06 868 4288 [EMAIL PROTECTED] The information contained in this email and any attachments is strictly confidential and is for the use of the intended recipient. Any use, dissemination, distribution, or reproduction of any part of this email or any attachment is prohibited. If you are not the intended recipient, please notify the sender by return email and delete all copies including attachments. [[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] Nonlinear regression
Let's not be so hard on SAS. I thought it was marvelous when I first used it over 30 years ago. Spencer Graves [EMAIL PROTECTED] wrote: ?nls (I always knew SAS *is* a DUD, but never that it has a DUD too...) Bill Venables CSIRO Laboratories PO Box 120, Cleveland, 4163 AUSTRALIA Office Phone (email preferred): +61 7 3826 7251 Fax (if absolutely necessary): +61 7 3826 7304 Mobile: +61 4 8819 4402 Home Phone: +61 7 3286 7700 mailto:[EMAIL PROTECTED] http://www.cmis.csiro.au/bill.venables/ -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Wednesday, 21 May 2008 9:23 AM To: r-help@r-project.org Subject: [R] Nonlinear regression Could someone help me on the following: SAS has DUD (Does not Use Derivatives) for nonlinear regression. Does R has a similar capability? I am not good at derivatives and may get my derivative wrong before feeding it to a nonlinear regression procedure. Any help would be much appreciated. Liu Hancock Forest Management NZ Tokoroa, New Zealand DDI: 07-8850387 Mobile: 021-1576178 A/H: 06 868 4288 [EMAIL PROTECTED] The information contained in this email and any attachments is strictly confidential and is for the use of the intended recipient. Any use, dissemination, distribution, or reproduction of any part of this email or any attachment is prohibited. If you are not the intended recipient, please notify the sender by return email and delete all copies including attachments. [[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.
[R] Displaying horizontal abline levels and controlling object opacity
Hi, I am plotting time series data, then using abline to draw a horizontal line through the graph (for mean, etc). I would like to be able to display the level at which the abline is drawn on either the left (main) Y axis or a supplemental right Y axis. Additionally, I would like to display 1 and 2 standard deviations of a certain measure (rolling regression betas, in this case). But since I already have 2 horizontal lines going through my graph (and yes I am using colors and have them all in the legend), I am wondering if there is another way of displaying the sd-s? Maybe through rectangles with low opacity ... Thanks in advance for any ideas/suggestions. Arshavir __ 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] Log likelihood of Gamma distributions
Dear all, How can I compute the log likelihood of a gamma distributions of a vector. I tried the following. But it doesn't seem to work: samples-c(6.1, 2.2, 14.9, 9.9, 24.6, 13.2) llgm - dgamma(samples, scale=1, shape=2, log = TRUE) It gives [1] -4.291711 -1.411543 -12.198639 -7.607465 -21.397254 -10.619783 I expect it only returns one value instead of vector. What's wrong with my command above? - Edward __ 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] Log likelihood of Gamma distributions
The scale of log-likelihood depends on the number of your data samples, you should sum over the log-densities from individual points: sum(llgm) Xiaohui Edward Wijaya 写道: Dear all, How can I compute the log likelihood of a gamma distributions of a vector. I tried the following. But it doesn't seem to work: samples-c(6.1, 2.2, 14.9, 9.9, 24.6, 13.2) llgm - dgamma(samples, scale=1, shape=2, log = TRUE) It gives [1] -4.291711 -1.411543 -12.198639 -7.607465 -21.397254 -10.619783 I expect it only returns one value instead of vector. What's wrong with my command above? - Edward __ 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] Log likelihood of Gamma distributions
Dear Xiaohui, Thanks. The scale of log-likelihood depends on the number of your data samples Can you explain what do you mean by this? For example if I have 10 data points. Should I use scale=10 ? And how about shape parameters. What's the rule to choose its value? Hope to hear from you again. Regards, Edward Edward Wijaya 写道: Dear all, How can I compute the log likelihood of a gamma distributions of a vector. I tried the following. But it doesn't seem to work: samples-c(6.1, 2.2, 14.9, 9.9, 24.6, 13.2) llgm - dgamma(samples, scale=1, shape=2, log = TRUE) It gives [1] -4.291711 -1.411543 -12.198639 -7.607465 -21.397254 -10.619783 I expect it only returns one value instead of vector. What's wrong with my command above? - Edward __ 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] Log likelihood of Gamma distributions
By the scale of log-likelihood, I did not mean the scale parameter of the gamma density... Generally, as you get more and more data, the log-likelihood will get more and more negative. Hence, what I mean by scale is how negative of the values of loglik. So the 10 values returned from your dgamma are the log-densities evaluated for your data points, respectively. The loglik for your samples is just the sum of those from all data points, under the independency assumption. X Edward Wijaya 写道: Dear Xiaohui, Thanks. The scale of log-likelihood depends on the number of your data samples Can you explain what do you mean by this? For example if I have 10 data points. Should I use scale=10 ? And how about shape parameters. What's the rule to choose its value? Hope to hear from you again. Regards, Edward Edward Wijaya 写道: Dear all, How can I compute the log likelihood of a gamma distributions of a vector. I tried the following. But it doesn't seem to work: samples-c(6.1, 2.2, 14.9, 9.9, 24.6, 13.2) llgm - dgamma(samples, scale=1, shape=2, log = TRUE) It gives [1] -4.291711 -1.411543 -12.198639 -7.607465 -21.397254 -10.619783 I expect it only returns one value instead of vector. What's wrong with my command above? - Edward __ 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] Converting Data Types
Hi, How can I convert the matrices to list. For example I have this snippet: samples-mymatrix[1,] print(samples) which prints: V1 V2V3V4V5V6 1 103.9 88.5 242.9 206.6 175.7 164.4 How can I convert the object samples such that it prints: [1] 103.9 88.5 242.9 206.6 175.7 164.4 The reason I ask this because I can't use the former samples object with this function: llgm - dgamma(samples, scale=1, shape=2, log = TRUE) which gives this error: e 1374Error in dgamma(x, shape, scale, log) : Non-numeric argument to mathematical function Regards, Edward __ 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] Converting Data Types
Hi Mark, Doesn't seem to work. x - unclass(samples) print (x) It prints this instead $V1 [1] 103.9 $V2 [1] 88.5 $V3 [1] 242.9 $V4 [1] 206.6 $V5 [1] 175.7 $V6 [1] 164.4 attr(,row.names) [1] 1 And it gives the same error for dgamma function. - Edward On Wed, May 21, 2008 at 11:22 AM, [EMAIL PROTECTED] wrote: unclass or should work , I think. so nonames-unclass(samples) On Tue, May 20, 2008 at 10:16 PM, Edward Wijaya wrote: Hi, How can I convert the matrices to list. For example I have this snippet: samples-mymatrix[1,] print(samples) which prints: V1 V2V3V4V5V6 1 103.9 88.5 242.9 206.6 175.7 164.4 How can I convert the object samples such that it prints: [1] 103.9 88.5 242.9 206.6 175.7 164.4 The reason I ask this because I can't use the former samples object with this function: llgm - dgamma(samples, scale=1, shape=2, log = TRUE) which gives this error: e 1374Error in dgamma(x, shape, scale, log) : Non-numeric argument to mathematical function Regards, Edward __ 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] Converting Data Types
Edward Are you sure mymatrix is, in fact, a matrix and note a dataframe (which is a list)? I get: is.matrix(mymatrix) [1] FALSE is.data.frame(mymatrix) [1] TRUE samples - mymatrix[1,] llgm - dgamma(samples, scale=1, shape=2, log = TRUE) Error in dgamma(x, shape, scale, log) : Non-numeric argument to mathematical function That is, the same error as you when mymatrix is a dataframe. But convert it to a matrix and: mymatrix - as.matrix(mymatrix) is.matrix(mymatrix) [1] TRUE is.data.frame(mymatrix) [1] FALSE samples - mymatrix[1,] llgm - dgamma(samples, scale=1, shape=2, log = TRUE) llgm V1 V2 V3 V4 V5 V6 -99.25657 -84.01700 -237.40735 -201.26922 -170.53122 -159.29770 HTH Peter Alspach -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Edward Wijaya Sent: Wednesday, 21 May 2008 2:17 p.m. To: r-help@r-project.org Subject: [R] Converting Data Types Hi, How can I convert the matrices to list. For example I have this snippet: samples-mymatrix[1,] print(samples) which prints: V1 V2V3V4V5V6 1 103.9 88.5 242.9 206.6 175.7 164.4 How can I convert the object samples such that it prints: [1] 103.9 88.5 242.9 206.6 175.7 164.4 The reason I ask this because I can't use the former samples object with this function: llgm - dgamma(samples, scale=1, shape=2, log = TRUE) which gives this error: e 1374Error in dgamma(x, shape, scale, log) : Non-numeric argument to mathematical function Regards, Edward __ 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. The contents of this e-mail are privileged and/or confidential to the named recipient and are not to be used by any other person and/or organisation. If you have received this e-mail in error, please notify the sender and delete all material pertaining to this e-mail. __ 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] Converting Data Types
Hi Peter, Thanks. as.matrix() does the trick. - Edward On Wed, May 21, 2008 at 11:31 AM, Peter Alspach [EMAIL PROTECTED] wrote: Edward Are you sure mymatrix is, in fact, a matrix and note a dataframe (which is a list)? I get: is.matrix(mymatrix) [1] FALSE is.data.frame(mymatrix) [1] TRUE samples - mymatrix[1,] llgm - dgamma(samples, scale=1, shape=2, log = TRUE) Error in dgamma(x, shape, scale, log) : Non-numeric argument to mathematical function That is, the same error as you when mymatrix is a dataframe. But convert it to a matrix and: mymatrix - as.matrix(mymatrix) is.matrix(mymatrix) [1] TRUE is.data.frame(mymatrix) [1] FALSE samples - mymatrix[1,] llgm - dgamma(samples, scale=1, shape=2, log = TRUE) llgm V1 V2 V3 V4 V5 V6 -99.25657 -84.01700 -237.40735 -201.26922 -170.53122 -159.29770 HTH Peter Alspach -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Edward Wijaya Sent: Wednesday, 21 May 2008 2:17 p.m. To: r-help@r-project.org Subject: [R] Converting Data Types Hi, How can I convert the matrices to list. For example I have this snippet: samples-mymatrix[1,] print(samples) which prints: V1 V2V3V4V5V6 1 103.9 88.5 242.9 206.6 175.7 164.4 How can I convert the object samples such that it prints: [1] 103.9 88.5 242.9 206.6 175.7 164.4 The reason I ask this because I can't use the former samples object with this function: llgm - dgamma(samples, scale=1, shape=2, log = TRUE) which gives this error: e 1374Error in dgamma(x, shape, scale, log) : Non-numeric argument to mathematical function Regards, Edward __ 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. The contents of this e-mail are privileged and/or confidential to the named recipient and are not to be used by any other person and/or organisation. If you have received this e-mail in error, please notify the sender and delete all material pertaining to this e-mail. __ 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] How to use classwt parameter option in RandomForest
Hi, I am trying to model a dataset with the response variable Y, which has 6 levels { Great, Greater, Greatest, Weak, Weaker, Weakest}, and predictor variables X, with continuous and factor variables using random forests in R. The variable Y acts like an ordinal variable, but I recoded it as factor variable. I ran a simulation and got OOB estimate of error rate 60%. I validated against some external datasets and got about 59% misclassification error. I would like to tinker with classwt option in the function randomForest to see if I can get a better performance the model. My confusion arises from how to define these weights. If I say, classwt = c(3,6,9,1,2,3), how exactly the levels get weighted. If this is a 6X6 matrix, I can put a number in each cell to adjust the weights. How does classwt option work? Thank you in advance for any ideas. Nagu __ 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.