Re: [R] run r script in r-fiddle
Hi Frank, You could upload your R source file to a public URL, for example to github and read via RCurl, as source do not support https as far as I know. Here is a working example. library('RCurl') tmatrix <- getURL("https://raw.githubusercontent.com/msuzen/isingLenzMC/master/R/isingUtils.R";) eval(parse(text=tmatrix)) Not that you need to use raw URL for github file. Best, -m On 30 October 2017 at 01:56, Frank Mei wrote: > Hi All, > > I want to know how to run an R file on my computer in R-Fiddle? > > I tried source("filename.r"), but not working. > > thanks, > Frank > > [[alternative HTML version deleted]] > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/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 -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/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] run r script in r-fiddle
We were talking about r-fiddle. It gives error there [*], that's why I suggested using RCurl. > source("https://raw.githubusercontent.com/msuzen/isingLenzMC/master/R/isingUtils.R";) ... unsupported URL scheme Error : cannot open the connection > On 30 October 2017 at 15:51, Martin Maechler wrote: >>>>>> Suzen, Mehmet >>>>>> on Mon, 30 Oct 2017 11:16:30 +0100 writes: > > > Hi Frank, You could upload your R source file to a public > > URL, for example to github and read via RCurl, as source > > do not support https as far as I know. > > well... but your knowledge is severely (:-) outdated. > Why did you not try first? > > source("https://raw.githubusercontent.com/msuzen/isingLenzMC/master/R/isingUtils.R";) > > works for me even in R 3.3.0 which is really outdated itself! > __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/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] run r script in r-fiddle
Note that, looks like r-fiddle runs R 3.1.2. __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/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] run r script in r-fiddle
On 31 October 2017 at 12:42, Martin Maechler wrote: > Notably as I think it's been provided by a company that no > longer exists under that name, and even if that'd be wrong, R-Fiddle > does not seem free software (apart from the R parts, I hope !). For the record, r-fiddle is maintained by datacamp: https://www.datacamp.com/community/blog/r-fiddle-an-online-playground-for-r-code-2 __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/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] run r script in r-fiddle
Dear List, According to datacamp support team, r-fiddle.org is not supported. We asked them to put it down as Professor Maechler suggested it is a waste of time for the R-help to respond to questions on something not maintained and severely outdated. If you would like to use R from your browser, you can embed the following into a web page: https://cdn.datacamp.com/datacamp-light-latest.min.js"</a>;> Currently, it supports R 3.4.0. See the code base, which is open source, here https://github.com/datacamp/datacamp-light Hope it helps. Best, Mehmet On 31 October 2017 at 15:09, Suzen, Mehmet wrote: > On 31 October 2017 at 12:42, Martin Maechler > wrote: >> Notably as I think it's been provided by a company that no >> longer exists under that name, and even if that'd be wrong, R-Fiddle >> does not seem free software (apart from the R parts, I hope !). > > For the record, r-fiddle is maintained by datacamp: > https://www.datacamp.com/community/blog/r-fiddle-an-online-playground-for-r-code-2 __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/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] Comparing figures?
I suggest perceptual diff. You could write a wrapper around it. http://pdiff.sourceforge.net On Mon, 7 May 2018 16:49 Ramiro Barrantes, wrote: > Hello, > > I am working on tests to compare figures. I have been using ImageMagick, > which creates a figure signature, and I can compare a "test" figure > signature against a saved "reference" figure signature. It seems to work > pretty well. However, it is slow as it requires reading from the file > system. > > Are there any options to compare figures on memory? For example, if I > generate a ggplot or lattice graph, I could have all my saved "reference" > figures on memory (which I would have loaded all at once) and compare them. > I just haven't found anything. > > I just found out about the vdiffr package and was going to explore it, not > sure about the speed. > > Any suggestions appreciated. > > Thank you, > < > https://west.exch023.serverdata.net/owa/?ae=Item&a=New&t=IPM.Note&cc=MTQuMy4zMTkuMixlbi1VUyw2LEhUTUwsMCww&pspid=_1525698150389_875737489# > > > Ramiro > > Ramiro Barrantes Ph.D. > Precision Bioassay, Inc. > 431 Pine St., Suite 110 > Burlington, VT 05401 > 802 865 0155 > 802 861 2365 FAX > www.precisionbioassay.com< > https://west.exch023.serverdata.net/owa/redir.aspx?SURL=wN3KzpoKXAcetH7sTOTnSyfg-iAXFIinpPUtRcduCFCtkgZrUSDTCGgAdAB0AHAAOgAvAC8AdwB3AHcALgBwAHIAZQBjAGkAcwBpAG8AbgBiAGkAbwBhAHMAcwBhAHkALgBjAG8AbQA.&URL=http%3a%2f%2fwww.precisionbioassay.com > > > ram...@precisionbioassay.com > > CONFIDENTIALITY NOTICE: This email, including any attach...{{dropped:9}} > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/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 -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/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] Time complexity of functions in R
Hello Neha, You can try to measure those instructions time-complexiy by yourself. First, generate a benchmark dataset with increasing object size, i.e., set A. Have a look at how to use 'system.time' https://stat.ethz.ch/R-manual/R-devel/library/base/html/system.time.html Best, Mehmet On 24 May 2018 at 04:40, Neha Aggarwal wrote: > Hi, > > I have implemented an algorithm in R, where i have used while loop and some > set operations inside it, for example, > > while(condition){ > union(set A,set B) > set C - set D > intersection(set D, set E) > } > I want to calculate the complexity of my algo. Can you tell me the > complexity of union, intersection and set minus operations/functions in R? > Is it O(n) or O(log n) ? > > Also can anyone point a good resource for me to read about it? > > Thanks, > Neha > > [[alternative HTML version deleted]] > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/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 -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/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] (Somewhat?) Off topic: Containerization software
This is a nice summary addressing the same with R: https://arxiv.org/pdf/1410.0846.pdf On 30 May 2017 at 17:43, Bert Gunter wrote: > Folks: > > This is **off topic**, but I thought it might be informative to this > community. Consequently: please **no on list public comments or > discussion**. Feel free to respond to me privately, if you like; but I > have neither knowledge nor opinions, so why bother? This is just FYI. > My apology if it is deemed inappropriate. > > http://www.nature.com/news/software-simplified-1.22059 > > Cheers, > Bert > > > Bert Gunter > > "The trouble with having an open mind is that people keep coming along > and sticking things into it." > -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/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 -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/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] Latin Hypercube Sampling when parameters are defined according to specific probability distributions
No it is an R programming questions. Nelly specifically asked you: "how can I use your code to apply my model to each of the 50 rows of the data frame “tabLHS”?" __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/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] Nash equilibrium and other game theory tools implemented in networks using igraph or similar
Why don't you implement and uplad the package to CRAN? On 27 Jun 2017 17:45, "Chris Buddenhagen" wrote: Does anyone know of some code, and examples that implement game theory/Nash equilibrium hypothesis testing using existing packages like igraph/statnet or similar? Perhaps along the lines of this article: Zhang, Y., Aziz-Alaoui, M. A., Bertelle, C., & Guan, J. (2014). Local Nash Equilibrium in Social Networks, *4*, 6224. Best, Chris Buddenhagen cbuddenha...@gmail.com [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/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 -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/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] Nash equilibrium and other game theory tools implemented in networks using igraph or similar
Hello Chris, I was implying you are capable enough to implement it, while you have already identify a research paper. If there is no package out there, uploading to CRAN would help future user too. I am more than happy to help if you want to implement from scratch. Best, Mehmet On 27 June 2017 at 17:45, Chris Buddenhagen wrote: > Does anyone know of some code, and examples that implement game theory/Nash > equilibrium hypothesis testing using existing packages like igraph/statnet > or similar? > > Perhaps along the lines of this article: > > Zhang, Y., Aziz-Alaoui, M. A., Bertelle, C., & Guan, J. (2014). Local Nash > Equilibrium in Social Networks, *4*, 6224. > > Best, > Chris Buddenhagen > cbuddenha...@gmail.com > > [[alternative HTML version deleted]] > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/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 -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/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 package for scorecard development
I suggest you to have a look at this R document: https://cran.r-project.org/doc/contrib/Sharma-CreditScoring.pdf On 28 June 2017 at 13:26, Nikhil Abhyankar wrote: > Hello all, > > Is there any R package that can develop a scorecard model for a binary > target variable? > > More details: > I want to create a scorecard based on the raw data I have. > > I have a binary target variable and a few numeric and character input > variables. > > I want to bin the variables and assign a score to each of the bins. > > Each subject will be scored based on the bin it falls in for each variable. > > All such scores from each of the variables will be added up to get the > final score. > > There will be a cutoff score to decide which of the two classes of response > the subject falls into. > > I fount and tested the smbinning package. However, it only gives the bins > for a single variable at a time. > > How can I get a full scorecard model? > > Thanks > Nikhil > > [[alternative HTML version deleted]] > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/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 -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/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 export data set (available in the package) from R?
I also suggest you Hadley's optimized package for interoperating xls files with R: https://github.com/tidyverse/readxl https://cran.r-project.org/web/packages/readxl/index.html __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/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] Nested cross validation with lapply
Hi Jesús, Do you have a code you tried without lapply? Why don't you post that here too? There are a couple of packages supporting nested CV; TANDEM, blkbox you may want to check their code. Also, `cvTools` package may help you to write one. On 7 August 2017 at 15:21, Jesús Para Fernández wrote: > Hi all!! > > How can i do nested cross validation with lapply?? > > I know caret package, but I want to do it manuallly using lapply instead for > bucle. > > Thanks!! > Jesús > > [[alternative HTML version deleted]] > > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/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 -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/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] Directional Forecast
I suggest, you read: Forecasting: principles and practice from Hyndman-Athanasopoulos https://www.otexts.org/fpp __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/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] Block comment?
AFAIK block comment is not possible it needs to be implemented in R interpreter and defined in the parser.'If' solution is not elegant. On 2 September 2017 at 14:09, Uwe Ligges wrote: > > > On 02.09.2017 11:40, Christian wrote: >> >> I consider it quite worth while to introduce into R syntax a nestable >> block comment like >> >> #{ >> >> }# > > > if(FALSE){ > > } > > Best, > Uwe Ligges > > >> It would make documentation more easily manageable and lucid. >> Is there considerable need for this. >> >> Please, comment on this. >> How about R core? >> >> Christian > > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/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 -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/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] comparition of occurrence of multiple variables between two dataframes
Do you have a simplified example with a code? It is not clear to me what do you mean by tree but if you refer to tree data structure, maybe you could change the data structure to tree (https://cran.r-project.org/web/packages/data.tree/vignettes/data.tree.html) and try to write comparison of two tree objects. It might be easier that data.frame alone. On 12 September 2017 at 12:27, Céline Lüscher wrote: > Hi everyone, I need your help to solve a problem with occurrence and two > dataframes. > I have an excel table of 15200 lines. Each line correspond to a tree analyzed > for its structures. I have all the structures in columns (48 structures). The > occurrence of these structures has been counted on every tree. For example, > the tree 12607 has 3 structures CV11, 1 structure IN12 and none (0) of the > rest of all the other structures. The very last column is the value given to > the tree, according to the structures found on it (each structure giving a > number of point to the tree by its presence on it). > The question is: Are there some structures, or combination of structures, > which give a high value to the tree ? Of course, according to the value of > each structure, we can see which one has a higher value than the others (ex: > structure CV11 has a value of 15, structure IN12 has a value of 4). But what > I want to know is, if we take all the trees having a final value higher than > 100 (we create a new dataframe "data100"), and we compare with the trees > having a final value under 100 (we create another dataframe "data0"), can we > find a significant difference in the number and occurrence of structures > found on these trees? And which structure is related to trees with a higher > value than 100 ? > For now, I have only a visual answer to the question. I did two boxplot of > the data100 and data0, and I have seen some différences : 2 structures are > only found in the data100, which can be caracteristic of a final value higher > than 100. The problem is that I’m looking for a test to prove this. > If you have any idea or proposition for solving this problem.. it will be > great! > Best wishes, > C. > > > Gesendet von Mail für Windows 10 > > > [[alternative HTML version deleted]] > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/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 -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/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] comparition of occurrence of multiple variables between two dataframes
t; > NE21 > > OT11 > > OT12 > > OT21 > > OT22 > > ecoval > > 1291 > > 0 > > 8 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 1192 > > 1083 > > 0 > > 8 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 424 > > 3919 > > 1 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 380 > > 14685 > > 0 > > 1 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 370 > > 4021 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 1 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 358 > > 5452 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 1 > > 0 > > 0 > > 11 > > 0 > > 0 > > 0 > > 0 > > 1 > > 0 > > 0 > > 356 > > > > The columns are the possible structures found on a tree (cavity, scar…) > > > > And the same for the data0 : > > CV11 > > CV12 > > CV13 > > CV14 > > CV15 > > CV21 > > CV22 > > CV23 > > CV24 > > CV25 > > CV26 > > CV31 > > CV32 > > CV33 > > CV41 > > CV42 > > CV43 > > CV44 > > CV51 > > CV52 > > IN11 > > IN12 > > IN13 > > 4728 > > 0 > > 0 > > 0 > > 1 > > 0 > > 0 > > 0 > > 3 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 1 > > 1 > > 0 > > 0 > > 5339 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 1 > > 0 > > 0 > > 11766 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 1 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 796 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 3561 > > 0 > > 0 > > 0 > > 1 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 1 > > 0 > > 0 > > 0 > > 0 > > 10581 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 1 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > IN14 > > IN21 > > IN22 > > IN23 > > IN31 > > IN32 > > IN33 > > IN34 > > BA11 > > BA12 > > BA21 > > DE11 > > DE12 > > DE13 > > DE14 > > DE15 > > GR11 > > GR12 > > GR13 > > GR21 > > GR22 > > GR31 > > GR32 > > 4728 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 1 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 5339 > > 1 > > 0 > > 1 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 1 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 11766 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 1 > > 1 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 0 > > 796 > > 1 > > 1 > > 0 > > 0
Re: [R] (no subject)
Hello David, As error message says you have a version dependency not satisfied. "error: Need GSL version >= 1.12". If you are using Ubuntu for example you could do; sudo apt-get install libgsl2 Or you can compile by yourself, I am sure there are people in LRZ can help you on this:) Best, Mehmet On 13 September 2017 at 11:23, Brayford, David wrote: > When I try to install gsl in R I get the error Need GSL version >= 1.12 . > However, I have version 2.3 of gsl installed on the system, which is picked > up earlier in the configure process (see below). Is it possible for someone > to fix this error in the configure script? > > checking for gsl-config... /lrz/sys/libraries/gsl/2.3/bin/gsl-config > checking if GSL version >= 1.12... checking for gcc... gcc > checking for C compiler default output file name... a.out > checking whether the C compiler works... yes > checking whether we are cross compiling... no > checking for suffix of executables... > checking for suffix of object files... o > checking whether we are using the GNU C compiler... yes > checking whether gcc accepts -g... yes > checking for gcc option to accept ISO C89... none needed > configure: error: Need GSL version >= 1.12 > ERROR: configuration failed for package ‘gsl’ > > > David > > > [[alternative HTML version deleted]] > > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/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 -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/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] Regarding Principal Component Analysis result Interpretation
Usually, PCA is used for a large number of features. FactoMineR [1] package provides a couple of examples, check for temperature example. But you may want to consult to basic PCA material as well, I suggest a book from Chris Bishop [2]. [1] https://cran.r-project.org/web/packages/FactoMineR/vignettes/clustering.pdf [2] http://www.springer.com/de/book/9780387310732?referer=www.springer.de __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/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] Multinomial Fitting Distrbution
mixtools package has mixture of Gaussian fitting, maybe that might help? __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/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] Random Forest in Caret
Can you post your memory profile and codes? __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/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] lm() funtion
try lm.ridge from MASS package. __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/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] glmnet: converting coefficients back to original scale
This is interesting, can you post your lm.ridge solution as well? I suspect in glmnet, you need to use model.matrix with intercept, that could be the reason. -m __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/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] any way to write sas7bdat with R
I didn't try this but there is an experimental package from Dr. Shotwell. http://cran.r-project.org/web/packages/sas7bdat/index.html if it can read, maybe you can modify to write as well? __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/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] Cost-effectiveness Analysis in R
Do you have specific example that you have tried to implement in R? Can you post your codes too? There are high quality package BCEA and BayesTree, that could be helpful; http://cran.r-project.org/web/packages/BCEA/index.html http://cran.r-project.org/web/packages/BayesTree/index.html __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/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] Cost-effectiveness Analysis using R
Yes. __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/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] weighted network centrality measures by network size
Hi Jenny, Have you tried igraph before? See, http://igraph.org/r/doc/ There are couple of centrality measures there. Best, -m On 6 August 2014 02:50, Jenny Jiang wrote: > Dear R-help, > > My name is Jenny Jiang and I am a Finance Honours research > student from the University of New South Wales Australia. Currently my > research project involves the calculating of some network centrality > measures in R, which are degree, closeness, betweenness and eigenvector. > However I am having some issue regarding to the calculation of > the weighted centrality measures by network size. For example, currently > my code allows me to calculate centrality measures for each firm year, > and now I would like to calculate centrality measures weighted by the > firm network size for each firm year. > > My current code is like the following: > > install.packages("statnet") > > library(statnet) > > #read csv > data <- read.csv("D:\\Users\\z3377013\\Desktop\\networknew1.csv",header=TRUE) > #companies <- unique(data$CompanyID_) > #years <- unique(data$Year) > pairs <- unique(data[,c(1,3)]) > #directors <- unique(c(data$DirectorID_,data$DirectorID_Connected)) > #director_map <- 1:length(directors) > #names(director_map) <- c(as.character(directors)) > > #for (i in 1:nrow(data)) { > # data[i,2] = director_map[as.character(data[i,2])] > # data[i,4] = director_map[as.character(data[i,4])] > #} > > sink("D:\\Users\\z3377013\\Desktop\\measure1.csv") > for (i in 1:nrow(pairs)) { > d <- subset(data, CompanyID_==pairs[i,1]&Year==pairs[i,2]) > directors <- unique(c(d$DirectorID_,d$DirectorID_Connected)) > director_map <- 1:length(directors) > names(director_map) <- c(as.character(directors)) > for (j in 1:nrow(d)) { > d[j,2] = director_map[as.character(d[j,2])] > d[j,4] = director_map[as.character(d[j,4])] > } > > net<-network(d[,c(2,4)],directed=F,loops=F,matrix.type="edgelist") > > degree <- degree(net, cmode="freeman", gmode="graph") > closeness <- closeness(net,gmode="graph",cmode="undirected") > betweenness <- betweenness(net,gmode="graph",cmode="undirected") > evcent <- evcent(net,gmode="graph",use.eigen=TRUE) > > write.csv(cbind(pairs[i,], directors, degree, closeness, betweenness, > evcent), row.names=FALSE) > } > sink() > > And an example of my data structure is like the following: > > CompanyID_DirectorID_YearDirectorID_Connected > 900370006802120033699838021 > 900370041803220033699838021 > 900370059803220033699838021 > 900370089803220033699838021 > 900370347806320033699838021 > 900370362806320033699838021 > 900370383806320033699838021 > 900370399806320033699838021 > 900369983802120033700068021 > 900370041803220033700068021 > 900370059803220033700068021 > 900370089803220033700068021 > 900370347806320033700068021 > 900370362806320033700068021 > 900370383806320033700068021 > 900370399806320033700068021 > 900369983802120033700418032 > 900370006802120033700418032 > 900370059803220033700418032 > 900370006802120043699838021 > 900370041803220043699838021 > 900370059803220043699838021 > 900370089803220043699838021 > 900370347806320043699838021 > 129016045381142003427207466 > 129035569064722003427207466 > 129037011080322003427207466 > 129037084581042003427207466 > 129037084781042003427207466 > 129037112481352003427207466 > 1290101671106122003427207466 > 1290102718113832003427207466 > > where for each firm-year I have a list of directors and their corresponding > connected directors within that firm-year. > > If you could > provide me the R code regarding to how to calculate the weighted measures by > network size that that would be really > helpful. > > I cannot be more than appreciated. > > Best regards > > Jenny > > [[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] Social Network Simulation
Dear Professor Haenlein, Have you solved this issue yet? I found this eally interesting problem I was wondering if it is possible to wrapper "objective function" around igraph's 'sample_pa' and 'sample_smallworld'. If you have an example data set, I can have a look at this. Viele Gruesse aus London Mehmet On 16 April 2016 at 14:16, Michael Haenlein wrote: > Dear all, > > I am trying to simulate a series of networks that have characteristics > similar to real life social networks. Specifically I am interested in > networks that have (a) a reasonable degree of clustering (as measured by > the transitivity function in igraph) and (b) a reasonable degree of degree > polarization (as measured by the average degree of the top 10% nodes with > highest degree divided by the overall average degree). > > Right now I am using two functions from irgaph (sample_pa and > sample_smallworld) but these are not ideal since they only allow me to vary > one of the two characteristics. Either the network has good clustering but > not enough polarization or the other way round. > > I looked around and I found some network algorithms that solve the problem > (E.g., Jackson and Rogers, Meeting Strangers and Friends of Friends), but I > did not find their implemented in an R package. I also found the R package > NetSim which seems to be in this spirit, but I cannot get it to work. > > Could anyone point me to an R library that I could check out? I do not care > much about the specific algorithm used as long as it allows me to vary > clustering and degree polarization in certain ranges. > > Thanks, > > Michael > > > Michael Haenlein > Professor of Marketing > ESCP Europe, Paris > > [[alternative HTML version deleted]] > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/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 -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/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] Summation sign
Hello Sebastian, I think you may need to use tensorA package. You can define different indices and use Einstein or Reimann summation convention. Grüße, Mehmet On 23 August 2013 15:14, Sebastian Hersberger wrote: > Hi all > > I have a short question relating to the usage of the summation sign in R. > > Let's define A and B as two kxk matrices (which are constant). > C^(n) = Ó_(j=1)^n [(Ó_(i=1)^(j-1) A^i ) B (Ó_(i=1)^(j-1) A^i)’ ] > > My goal is to calculate the matrix C for the periods from 1 to 200 (n=1-200). > > How has that to be implemented in R? > > Thank you for your help!! > > Kind regards, > Sebastian > > [[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] Validating data type
R is weakly typed language. I have asked similar question previously: http://r.789695.n4.nabble.com/count-appearence-of-zero-in-a-vector-td4654591.html It is advised to me to use S4 classes, if you want to enforce type checking automatically. Excellent reference on this is by the ACM award holder Prof. John Chamber's book, Software for Data Analysis. On 30 August 2013 05:29, wrote: > > > I'm very new to R. I have a data file that I have read in via read.csv. I > expect one of the "columns" to be of type date for example. However at > least one value in that column is not of date type. I know this because > another program I am trying to process the file with is erroring, yet it > doesn't tell me what row/value is erroring. Does R have a way to: treat > column x as date type, and print out all values/row numbers do not conform > to that type for that specified column? > > Many thanks! > Jeff > [[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] R and Matlab
Simplest way is the call a system command, using R CMD. See :http://stackoverflow.com/questions/6695105/call-r-scripts-in-matlab But there are more complicated solutions are proposed: http://www.mathworks.co.uk/matlabcentral/fileexchange/5051 This is uses R-(D)-COM In my opinion most robust integration can be achived via Java code that runs R. So you can easily use that in Matlab. On 24 December 2012 20:42, Amirehsan Ranginkaman wrote: > Hi, > > How can I call R functions or Package in MatLab? > > Is there any way? > > > Thanks > Regards > Ranginkaman > > [[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] R graphs from database
Hi David, I suggest you to have a look at packages that can extract data from sql or nosql databases and graphics. CRAN task views would help: http://cran.r-project.org/web/views/Graphics.html The point is there are lots of alternatives. If you would like to use web-based visualisation d3 is becoming very popular. For that reason I suggest the combination of ggplot2, D3 (http://d3js.org/) and extracting data from databases using RODBC or RMySQL, depending on your data source. A good web server interface is Rook, Hope it helps, Best, -m On 26 December 2012 13:34, David Osborne wrote: > Browsing the web recently, I came across what I think is a new utility for > generating an interactive, web-based R graph of data from a database. The > generated graph can be manipulated by a user to choose different data, > limits, etc. I would like to investigate using this with data from our > research project but unfortunately, I didn't bookmark it and it's no longer > in my browser history, nor can I find it with extensive Google searches. > Can anybody help with the name of the software, its URL, or suggestions of > where else to search, please? > > Thanks! > > David Osborne > MSc student > Department of Archaeology, University of Nottingham > > [[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] Is there a package to output midi files for sonification of data
Hi Greg, you can try tuneR : http://cran.r-project.org/web/packages/tuneR/ Best, -m On 26 December 2012 22:04, Greg Hooper wrote: > Hi, I have been using Matlab to produce midi files for sonfication and > algorithmic composition projects. I would like to transfer that work into R > (in which I am a total newbie) and have been looking for a package that can > read and write midi files. No success so far so does anyone know of one? I > have seen that I can output to csv and then use a utility to convert csv to > midi (and vice-versa). But native R would be better if possible. > thanks for any help, Greg > > [[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] Is there a package to output midi files for sonification of data
On 27 December 2012 08:46, Greg Hooper wrote: > thanks Ben - hmm I think I will use a midi/csv utility > http://www.fourmilab.ch/webtools/midicsv/ and see how that goes. Another Hi Greg, Yes you are right, It is for wav analysis but as Ben suggests. Conversion should not be difficult. Also I think it must be 'trivial' to translate that Perl script's (package) to R, if you are really after pure R solution. (I think having something native to read midi will be beneficial to community) > option is http://playitbyr.org/index.html and output to Csound and from It is interesting. Can you do some meaningful data exploration with playitbyr or is it pure fun? > there to midi. PlayitbyR and into Csound might be something that suits your If you are going to use external program to convert that maybe you can use wav files after all, hence the tuneR. Best, -m __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Is there a package to output midi files for sonification of data
On 27 December 2012 08:46, Greg Hooper wrote: > thanks Ben - hmm I think I will use a midi/csv utility > http://www.fourmilab.ch/webtools/midicsv/ and see how that goes. Another Hi Greg, Yes you are right, It is for wav analysis but as Ben suggests. Conversion should not be difficult. Also I think it must be 'trivial' to translate that Perl script's (package) to R, if you are really after pure R solution. > option is http://playitbyr.org/index.html and output to Csound and from It is interesting. Can you do some meaningful data exploration with playitbyr or is it pure fun? > there to midi. PlayitbyR and into Csound might be something that suits your If you are going to use external program to convert that maybe you can use wav files after all, hence the tuneR. Best, -m __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Is there a package to output midi files for sonification of data
On 27 December 2012 21:23, Ben Bolker wrote: > On 12-12-27 03:04 PM, Greg Hooper wrote: > it more closely into R I would take the C code and figure out how I > could integrate it into an R package as compiled code with a thin R > wrapper around it. Since the code "license" is "public domain", you Brilliant! Ben, while interfacing C code to R is very well established. > could even redistribute the package freely. But if it's just for > personal use, and you don't need it to be incredibly slick, using it > externally (via system()) seems perfectly sensible. > I would not suggest that. Using system is just a "hack" in my opinion. It is preferable to have a proper interface to R via .C in a package framework. Concerning license, It is the responsibility of user/developer to consider that :) Cheers, -m __ 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] vectorization & modifying globals in functions
You can use environments. Have a look at this this discussion. http://stackoverflow.com/questions/7439110/what-is-the-difference-between-parent-frame-and-parent-env-in-r-how-do-they On 27 December 2012 21:38, Sam Steingold wrote: > I have the following code: > > --8<---cut here---start->8--- > d <- rep(10,10) > for (i in 1:100) { > a <- sample.int(length(d), size = 2) > if (d[a[1]] >= 1) { > d[a[1]] <- d[a[1]] - 1 > d[a[2]] <- d[a[2]] + 1 > } > } > --8<---cut here---end--->8--- > > it does what I want, i.e., modified vector d 100 times. > > Now, if I want to repeat this 1e6 times instead of 1e2 times, I want to > vectorize it for speed, so I do this: > > --8<---cut here---start->8--- > update <- function (i) { > a <- sample.int(n.agents, size = 2) > if (d[a[1]] >= delta) { > d[a[1]] <- d[a[1]] - 1 > d[a[2]] <- d[a[2]] + 1 > } > entropy(d, unit="log2") > } > system.time(entropy.history <- sapply(1:1e6,update)) > --8<---cut here---end--->8--- > > however, the global d is not modified, apparently update modifies the > local copy. > > so, > 1. is there a way for a function to modify a global variable? > 2. how would you vectorize this loop? > > thanks! > > -- > Sam Steingold (http://sds.podval.org/) on Ubuntu 12.04 (precise) X > 11.0.11103000 > http://www.childpsy.net/ http://honestreporting.com > http://pmw.org.il http://www.PetitionOnline.com/tap12009/ > A number problem "solved" with floats turns into 1.9998 problems. > > __ > 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] efficiently multiply different matrices in 3-d array with different vectors?
I think what you are doing is a tensor algebra. You may want to try tensorA: http://cran.r-project.org/web/packages/tensorA/index.html On 28 December 2012 06:33, Ranjan Maitra wrote: > Any pointers on an efficient way of doing this? I considered using > apply, but was not successful. please post that code. Why it was not successful? What was the error message? __ 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] efficiently multiply different matrices in 3-d array with different vectors?
What I had in mind was a tensor multiplication. I think, using tensor arithmetic for multidimensional arrays looks more compacts and efficient (~ 2-3 times). I am guessing that performance will be much more pronounced for n-D arrays (n>3). # Component Wise set.seed(14) Z<-array(sample(1:100,80,replace=TRUE),dim=c(5,2,8)) set.seed(21) Y<-matrix(sample(1:40,40,replace=TRUE),nrow=8) system.time(X<-do.call(cbind,lapply(seq_len(dim(Z)[1]),function(i) Z[i,,]%*%Y[,i]))) # user system elapsed # 0.580.000.58 R<-cbind(sum(X[1,]), sum(X[2,])) # Tensor multiply library(tensorA) set.seed(14) Zt <-to.tensor(sample(1:100,80,replace=TRUE), c(a=5, b=2, c=8)) set.seed(21) Yt <-to.tensor(sample(1:40,40,replace=TRUE), c(c=8, a=5)) system.time(Rt<-Zt %e% Yt) # user system elapsed # 0.124 0.000 0.126 # correct results? R #[,1] [,2] #[1,] 4.00595e+16 3.997387e+16 Rt #[1] 4.005950e+16 3.997387e+1 __ 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] efficiently multiply different matrices in 3-d array with different vectors?
On 29 December 2012 20:35, arun wrote: >> Is it possible to obtain the same result as X without converting X to R? What do you mean by the same result? There is a relationship between X and R. If you express this relationship algebraically, you can get X directly using Y and Z tensors, vice versa. Too many terms in the example you have given. So I would demonstrate the possibility with a smaller example. Think of X as intermediate results from Matrix multiplication. You need to use Riemann notation instead of Einstein's [*]. However you may end up computing more terms then you need. It makes sense to use tensorA only if you know algebraic relationships well. If you think in terms of components and positioning intermediate results as most R programmers do i,e. using cbind, moving that column here in there etc,, probably tensorA is not suited for you. Hope it answers your question. [*] library(tensorA) # intermediate results via component wise multiplication set.seed(42) A <-matrix(rnorm(10), 5, 2) set.seed(43) x <-matrix(rnorm(2), 2, 1) b <- A %*% x bInter <- do.call(cbind,lapply(seq_len(dim(A)[1]),function(i) A[i,]*x)) # intermediate results via tensor multiplication set.seed(42) At <-to.tensor(rnorm(10), c(a=5, b=2)) set.seed(43) xt <-to.tensor(rnorm(2), c(c=2)) bt <- At%r%xt # Riemann sum bInterT <- t(cbind(bt[,,1][,1],bt[,,2][,2])) # Multiplication from intermediate results binterM <- t(do.call(cbind, lapply(1:5, function(i) sum(bInter[,i] binterTM <- t(do.call(cbind, lapply(1:5, function(i) sum(bInterT[,i] # Correctness # Correctness bInterT #[,1][,2][,3][,4][,5] #[1,] -0.05142981 0.02118395 -0.01362231 -0.02374106 -0.01516563 #[2,] 0.16710413 -2.38004921 0.14905054 -3.17821889 0.09874990 bInter #[,1][,2][,3][,4][,5] #[1,] -0.05142981 0.02118395 -0.01362231 -0.02374106 -0.01516563 #[2,] 0.16710413 -2.38004921 0.14905054 -3.17821889 0.09874990 b #[,1] #[1,] 0.11567432 #[2,] -2.35886526 #[3,] 0.13542823 #[4,] -3.20195995 #[5,] 0.08358427 binterM #[,1] #[1,] 0.11567432 #[2,] -2.35886526 #[3,] 0.13542823 #[4,] -3.20195995 #[5,] 0.08358427 binterTM #[,1] #[1,] 0.11567432 #[2,] -2.35886526 #[3,] 0.13542823 #[4,] -3.20195995 #[5,] 0.08358427 __ 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] efficiently multiply different matrices in 3-d array with different vectors?
On 30 December 2012 20:21, arun wrote: > HI, > I was not aware of the algebraic relationship. > Tx for the explanation. For the record; the simple example I have shown can be reproduced with Einstein's summation rule as well. While A and x tensors have covariant (lower) indices *only*. So using %r% may make sense only if we have contravariant (upper) indices as well (mixed-variant). Just to clarify my previous post to avoid any confusion. __ 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] suggestions about import SAS results to R.
> On Jan 2, 2013, at 12:37 PM, Yuan, Rebecca wrote: >> I am wondering if there is an efficient way to read SAS data directly in R, >> or what would be a better connection between SAS and R if I need to use R to >> deal with data achieved from SAS? >> You may try foreign and SASxport packages: http://cran.r-project.org/web/packages/foreign/index.html http://cran.r-project.org/web/packages/SASxport/index.html But I heard that there might be some issues with the newest SAS version but give it a try... __ 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] count appearence of zero in a vector
Hi Hermann, You may want to use ?which, to store the index as well (might be handy in debugging or some other purposes if zeros has some special meaning) : test <- c(1, 1, 1 , 1 , 1, 1, 2, 1, 1, 1, 0, 2, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 2, 1, 1, 1, 1, 1, 1) length(which(test==0)) But be careful when using == 0. If you are sure that elements are all integers I prefer this length(which(test <1)). Or a safe tolerance value from .Machine, if you are dealing with double numbers. length(which(test < .Machine$double.xmin)) -m __ 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] MT940 and MT942
Hello List, Are there any R package that can process MT940/942? Thanks mem __ 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] Working with Matrix
Hello Rui/Jorge, This is shorter, and probably needs less memory for large matrices as you create an other copy by defining nas: matrixOp <- function(m1, m2, op=`+`) { rows <- min(nrow(m1), nrow(m2)) cols <- ncol(m1) op(m1[1:rows, 1:cols], m2[1:rows, 1:cols]) } Best, mem On 4 January 2013 14:08, Rui Barradas wrote: > Hello, > > Using part of your code, it's possible to do without Reduce, have foo (fun, > below) do the job. > > fun <- function(x, y, FUN = `+`){ > if(nrow(x) < nrow(y)){ > nas <- matrix(NA, ncol = ncol(x), nrow = nrow(y) - nrow(x)) > x <- rbind(x, nas) > }else{ > nas <- matrix(NA, ncol = ncol(y), nrow = nrow(x) - nrow(y)) > y <- rbind(y, nas) > } > FUN(x, y) > } > > fun(Mat1, Mat2) > fun(Mat1, Mat2, `*`) # Note the back quotes > > > Hope this helps, > > Rui Barradas > Em 04-01-2013 12:06, Jorge I Velez escreveu: > >> Dear Christofer, >> >> You can try the following: >> >> # proccess the matrices >> foo <- function(m1, m2){ >> if(ncol(m1) != ncol(m2)) stop('number of columns should be equal') >> if(nrow(m1) < nrow(m2)){ >> nas <- matrix(NA, ncol = ncol(m1), nrow = nrow(m2) - nrow(m1)) >> m1 <- rbind(m1, nas) >> } >> else{ >> nas <- matrix(NA, ncol = ncol(m1), nrow = nrow(m1) - nrow(m2)) >> m2 <- rbind(m2, nas) >> } >> list(m1, m2) >> } >> >> # process >> r <- foo(Mat1, Mat2) >> >> # basic operations >> Reduce("+", r) >> Reduce("*", r) >> Reduce("/", r) >> Reduce("-", r) >> >> HTH, >> Jorge.- >> >> >> On Fri, Jan 4, 2013 at 10:47 PM, Christofer Bogaso <> wrote: >> >>> Hello again, >>> >>> Let say I have 2 matrices which equal number of columns but different >>> number of rows like: >>> >>> Mat1 <- matrix(1:20, 4, 5) >>> Mat2 <- matrix(1:25, 5, 5) >>> >>> Now for each column 1-to-5 I need to fetch the corresponding columns >>> of these 2 matrices and add the corresponding elements (ignoring NA >>> values if any). Therefore for the 1st column I need to do: >>> >>> (1+1), (2+2),...,(4+4), (NA+5) >>> >>> and so on >>> >>> And the resulting numbers will be stored in some other matrix >>> >>> Also note that, here I gave the example of addition, however, this can >>> be any user defined function. >>> >>> Is there any R way to do that, without using any for-loop? >>> >>> Thanks and regards, >>> >>> __ >>> 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-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] count appearence of zero in a vector
I am always reserved about types and not sure how R auto casting works internally. In a large code using many different packages, I think being reserved about this would not hurt. Also, are there anyway to force R to be "strongly typed" similar to Occaml etc... mem On 4 January 2013 16:35, arun wrote: > > As long as there are no negative numbers, method2 and 3 works: > test[1]<- -1 > length(which(test==0)) > #[1] 6 > length(which(test<1)) > #[1] 7 > length(which(test < .Machine$double.xmin)) > #[1] 7 > > length(which(abs(test)<1)) > #[1] 6 > length(which(abs(test) < .Machine$double.xmin)) > #[1] 6 > A.K. > > > > > - Original Message - > From: "Suzen, Mehmet" > To: Hermann Norpois > Cc: R help > Sent: Friday, January 4, 2013 12:27 AM > Subject: Re: [R] count appearence of zero in a vector > > Hi Hermann, > > You may want to use ?which, to store the index as well (might be handy > in debugging or some other > purposes if zeros has some special meaning) : > > test <- c(1, 1, 1 , 1 , 1, 1, 2, 1, 1, 1, 0, 2, 0, 1, 1, 0, 0, 0, 1, > 1, 1, 0, 1, 2, 1, 1, 1, 1, 1, 1) > length(which(test==0)) > > But be careful when using == 0. If you are sure that elements are all > integers I prefer this > > length(which(test <1)). > > Or a safe tolerance value from .Machine, if you are dealing with double > numbers. > > length(which(test < .Machine$double.xmin)) > > > -m > > __ > 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] non-consing count
My 2 cents: AFAIK both which and length are from C compiled code: http://cran.r-project.org/doc/manuals/r-release/R-ints.html#g_t_002eInternal-vs-_002ePrimitive so they must be quite efficient ie .Primitive and .Internal. Probably combination of this with a pattern in C would be more memory efficient to count patterns, but would that make sense? Because in general if you look for a pattern in a vector, you need to know where it is, hence which operation, at least for debugging/testing purposes... On 4 January 2013 16:30, Sam Steingold wrote: > Hi, > to count vector elements with some property, the standard idiom seems to > be length(which): > --8<---cut here---start->8--- > x <- c(1,1,0,0,0) > count.0 <- length(which(x == 0)) > --8<---cut here---end--->8--- > however, this approach allocates and discards 2 vectors: a logical > vector of length=length(x) and an integer vector in which. > is there a cheaper alternative? > Thanks! > > -- > Sam Steingold (http://sds.podval.org/) on Ubuntu 12.04 (precise) X > 11.0.11103000 > http://www.childpsy.net/ http://iris.org.il http://honestreporting.com > http://jihadwatch.org http://pmw.org.il > http://www.PetitionOnline.com/tap12009/ > War doesn't determine who's right, just who's left. > > __ > 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] Integrating Java, C++ and R
On 4 January 2013 11:36, Royden Fernandes wrote: > Hi, > > I am able to integrate C++ and R through RInside library. However when I Questions regarding RInside should go to the rcpp-devel mailing list. http://lists.r-forge.r-project.org/mailman/listinfo/rcpp-devel __ 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] non-consing count
On 4 January 2013 16:53, jim holtman wrote: > Is performance a concern? How often are you going to do it and what > other parts of your script also take longer? Why are you concerned > about allocating/discarding two vectors? I think Sam's question was about additional memory introduced by which. For example: > x <- c(1, 0, 0, 1, 0, 2, 0) > wx <- which(x==0) > object.size(wx) 56 bytes > object.size(x) 104 bytes If you have very large vector, a time series for example. This would make a lot of difference. I am not sure how 'sum' internally handles, but As I said earlier, a special function in C might be faster then length-which couple or sum, that counts occurrences as it goes, so it could get the result in one go, maybe like x %count% 0. One can implement a recursive function to do this in R interpreter level, but not sure about recursion depth memory requirement. __ 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] count appearence of zero in a vector
On 4 January 2013 17:47, Bert Gunter wrote: > Inline. > > On Fri, Jan 4, 2013 at 7:44 AM, Suzen, Mehmet wrote: >> >> I am always reserved about types and not sure how R auto casting works >> internally. >> In a large code using many different packages, I think being reserved >> about >> this would not hurt. >> >> Also, are there anyway to force R to be "strongly typed" similar to >> Occaml etc... > > > Yes (I think). Use S4. See. e.g. Chambers: Software for Data Analysis" > Programming in R > Thank you Bert for point out S4. Here is one trivial example: > setClass("integerVector", representation(x="integer")) > iv<-new("integerVector") > iv@x <- c(1, 0, 1, 0, 2, 3) Error in checkSlotAssignment(object, name, value) : assignment of an object of class “numeric” is not valid for slot ‘x’ in an object of class “integerVector”; is(value, "integer") is not TRUE > iv@x <- as.integer(c(1, 0, 1, 0, 2, 3)) So this is pretty safe: > sum(iv@x == 0) [1] 2 __ 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] MT940 and MT942
On 5 January 2013 10:04, peter dalgaard wrote: >> So it looks like some assembly is required, but puzzle pieces are available. Concerning MT940 spec, I don't know who is regulating this. There is no RFC or similar. The closest thing I found was from DB: https://deutschebank.nl/nl/docs/MT94042_EN.pdf __ 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] Manhattan Plot
Hello Einat, Have you tried ggbio package's plotGrandLinear from bioconductor? Best, -m On 8 January 2013 20:03, Einat Granot wrote: > Hello, > I am trying to create a simple Manhattan plot for a small list of 200 SNPs > spread out in the genome in different genes. > I have tried different functions (using ggplot2 and a function created by > Stephen Turner, mhtplot etc.)-none of them work smoothly. > Does anyone have a simple way to create the plot (not for all 22 > chromosomes)- with the x axis showing the genes name and not the chromosomal > location. > Thanks a lot, > Einat > > [[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] R encrypt/decrypt
On 9 January 2013 18:59, Ramiro Barrantes wrote: > I am working on a web system (php) that uses R in the backend, and we need > some basic fast encryption/decryption for the underlying mysql database that > can be used by both R AND php. It does not need to be top-of-the-line, but > just provide some basic level of fast encryption/decryption. > >> Any suggestions? Sounds too generic. This is not really an R-help question. Not sure what do you mean by underlying mysql. Are you going to encrypt data into db? If it is about transport between sql and web servers: these servers can be configured to use SSL! What is your aim? BTW: Maybe you should remove php and use R directly via Rook; http://cran.r-project.org/web/packages/Rook/index.html __ 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 encrypt/decrypt
Hello Ramiro, I am still not sure why do you need to encrypt/decrypt data in R. One can encrypt/decrypt data in the SQL server side. https://dev.mysql.com/doc/refman/5.5/en/encryption-functions.html If your concern is on the web traffic, again, sql servers supports SSL http://dev.mysql.com/doc/refman/5.1/en/ssl-connections.html I think RMySQL can connect via SSL. Also you may consider RCurl to talk to your php code. Best, -m On 9 January 2013 21:54, Ramiro Barrantes wrote: > Dear Suzen, > > Thank you for your reply. What I meant was that some fields in the database > will be encrypted (the data for those fields will be entered via php web > interface and then encrypted and stored on the mysql db), and then I will use > R to read such database and do appropriate post-processing, which will then > need to be encrypted and stored into the mysql db (with R hopefully). In > other words, I have a shared mysql database with some encrypted fields, and I > need R and php to both understand the encryption/decryption. > > I thought this would be an appropriate question for the group as perhaps > someone might know of an R encrypt/decrypt mechanism that also has a > counterpart on php or has suggestions about the situation. Sorry for the > confusion in my question. > > Thank you, > Ramiro > > > > > > From: mehmet.su...@gmail.com [mehmet.su...@gmail.com] on behalf of Suzen, > Mehmet [msu...@gmail.com] > Sent: Wednesday, January 09, 2013 3:38 PM > To: Ramiro Barrantes > Cc: r-help@r-project.org > Subject: Re: [R] R encrypt/decrypt > > On 9 January 2013 18:59, Ramiro Barrantes > wrote: >> I am working on a web system (php) that uses R in the backend, and we need >> some basic fast encryption/decryption for the underlying mysql database that >> can be used by both R AND php. It does not need to be top-of-the-line, but >> just provide some basic level of fast encryption/decryption. >> >>> Any suggestions? > > Sounds too generic. This is not really an R-help question. > Not sure what do you mean by underlying mysql. Are you going to > encrypt data into db? If it > is about transport between sql and web servers: these servers can be > configured to use SSL! > What is your aim? > > BTW: Maybe you should remove php and use R directly via Rook; > http://cran.r-project.org/web/packages/Rook/index.html __ 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 count "A", "C", "T", "G" in each row in a big data.frame?
On 10 January 2013 01:04, Yao He wrote: > In fact I want to calculate the gene frequency of each SNP. Why don't you use bioconductor for your analysis instead of trying to develop by your own? For example: http://www.bioconductor.org/help/course-materials/2008/MGED08/BiostringsMGED2008.pdf For example alphabetFrequency function in the ShortRead package. I am sure you can handle I/O somehow to interface with available tools in bioconductor. __ 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] Find the functional relationship between two variables in R?
On 10 January 2013 15:04, wrote: > Hi, > I have two variables x and y and the functional relationship between x and y > is like: y=x^2+log(x). My question is that is it possible to apply some > method to reconstruct the functional form based on the training data that is > generated from it? I understand that there are many methods for regresstion The answer is 42. __ 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] ginv / LAPACK-SVD causes R to segfault on a large matrix.
On 14 January 2013 15:08, Cyrus Shaoul wrote: > La.svd Dear Cyrus, Have you tried running La.svd ; LAPACK only version (without R) via C/C++ or Fortran code? After all it can be a LAPACK issue and R-team has no control on that. Best, -m __ 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] readJPEG function cannot open jpeg files
Similar issue with URLs: > yesWeCan <- > "http://upload.wikimedia.org/wikipedia/commons/9/9d/Barack_Obama.jpg"; > url(yesWeCan) description "http://upload.wikimedia.org/wikipedia/commons/9/9d/Barack_Obama.jpg"; class "url" mode "r" text "text" opened "closed" can read "yes" can write "no" > readJPEG(yesWeCan) Error in readJPEG(yesWeCan) : unable to open http://upload.wikimedia.org/wikipedia/commons/9/9d/Barack_Obama.jpg On 14 January 2013 14:57, Yi Yuan wrote: > I installed jpeg package and tried to use > > kim<-readJPEG("kim.jpeg") to read in a jpeg file, but R gave me an error: > Error in readJPEG("kim.jpeg") : unable to open kim.jpeg > > I already put "kim.jpeg" in Rstudio's default working directory: "E:\home > work\Rstudio". So I don't think it's a problem caused by omitting the file's > path. But I tried with the full path version just in case and still got the > "unable to open" error: > > kim<-readJPEG("E:\\ home work\\Rstudio\\kim.jpeg") > Error in readJPEG("E:\\ home work\\Rstudio\\kim.jpeg") : > unable to open E:\ home work\Rstudio\kim.jpeg > > So now I really don't know what is wrong. > > [[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] readJPEG function cannot open jpeg files
On 14 January 2013 18:56, Prof Brian Ripley wrote: > On 14/01/2013 16:26, Suzen, Mehmet wrote: >> >> Similar issue with URLs: > > > Not a similar issue at all: a URL is not a file. That most functions in R > itself open connections including URLs does not mean that contributed > packages do. The package help is quite specific about its requirements. > > source: Either name of the file to read from or a raw vector > representing the JPEG file content. > > Which suggests to you how you can do this, apart from download.file, of > course. Something like > > readJPEG(readBin(yesWeCan, "raw", 1e6)) > Dear Prof. Ripley, Thank you for the correction. I was thinking in the lines of 'Everything is a file' concept. (http://en.wikipedia.org/wiki/Everything_is_a_file). Best, -m __ 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 change R file in stats?
On 17 January 2013 07:03, Ibrahim Sobh wrote: > > Dear > I have changed some code in R file inside the stats package (dendrogram.R). > Now I wan to test and run the stats package with the new updated code, what > should I do in detail? For testing the simplest thing you can do is to ?source the file in your session. But R-core is very well maintained, why would you need to change the core code? It will only bring you maintenance chaos. If you need additional feature, maybe you can have a look on CRAN if it is implemented. Best, -m __ 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] Recommendation for website to format R code
Probably formatR/knitr is more robust but this one has an option for S http://hilite.me/ -m On 25 January 2013 02:37, C W wrote: > I ran across this page for C, Java, etc. No R. > > http://pastebin.com/ > It looks similar and more than what I was looking for, just saying. > > Mike > > > On Wed, Jan 23, 2013 at 9:34 PM, Mark Lamias wrote: > >> Are you only interested in formatting code from copy and pasting to/from >> email? If you are interested in formatting your code in Latex/PDF/HTML >> take a look at the knitr package: >> >> http://yihui.name/knitr/ >> >> Also, you could check out the formatR package: >> http://cran.r-project.org/web/packages/formatR/formatR.pdf >> >> --Mark Lamias >> >> >> -- >> *From:* C W >> *To:* r-help >> *Sent:* Wednesday, January 23, 2013 9:27 PM >> *Subject:* [R] Recommendation for website to format R code >> >> Hi list, >> >> Could anyone recommend some good website for formatting R code? For >> example, when you copy paste R code to gmail and back to R, it loses its >> format, the dash symbol causes errors. >> >> I've had someone used it to format my code here on the list, but can't find >> it anymore. >> >> Mike >> >> [[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. >> >> >> > > [[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] joint probability distribution
Not sure what is your exact requirement but you can compute marginals and conditional probabilities using 'prob' package of Prof. Kerns. On 25 January 2013 22:15, Rui Barradas wrote: > Hello, > > You need to be much more specific. What do you know about the distributions > of X and Y? And about their joint distribution? > > If you suspect the joint distribution to be a bivariate normal try package > mvtnorm with > > mu <- c(mean(x), mean(y)) > sigma <- cov(cbind(x, y)) > > > You can also try kernel density estimates: > > library(sos) > findFn('kde') > > > Hope this helps, > > Rui Barradas > > Em 25-01-2013 18:13, eliza botto escreveu: > >> >> Dear R family, >> I want to calculate the joint probability (distribution) of two random >> continuous variables X and Y. >> Could to please tell me how to do it?Thanks in advance.. >> elisa >> [[alternative HTML version deleted]] >> >> __ >> R-help@r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide >> http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. >> > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Pass vector as multiple parameters (as in python f(*x))
This an alternating way of doing it using a list if you know the argument names in the function definition i.e. ?formals and ?alist, But would change the default values of the function. Probably not you wanted. > f <- function(x,y,z) x+y+z > args<-alist(x=5,y=6,z=7) > formals(f) <- args > f() [1] 18 On 26 January 2013 01:46, Carlos Pita wrote: > Thanks Bert, do.call is exactly what I was looking for. What in lisp > is apply and in python f(*v). > >> Your whole premise that the arguments of a function should be mappable to >> elements of a vector seems contrary to good R programming practice. > > Jeff I didn't pretend to imply that the mapping should by always > possible. lists for positional arguments and named lists for named > arguments would do the trick most of the times. It's pretty common in > dynamic languages. > > That said, the specific task I have in mind is to index an array of an > arbitrary dimension n by a list of length n vectors, each one > representing coordinates. > > For example, if n=2, the array is the matrix m, and the list of vectors is vs: > > m=matrix(1:16,4) > vs = list(c(2,3),c(2,2),c(1,1)) > > Then do.call would allow me to index m as follows: > > lapply(vs, function(v) { do.call(`[`, append(list(m), v)) }) > > Alternatively: > > f = function (...) { m[...] } > lapply(vs, function(v) { do.call(f, as.list(v)) }) > > Of course, I could just do m[v[1],v[2]] in this case, but the point is > that the dimension n would be a parameter of my function, not a > constant. > > But if you know of a better or more r-esque solution I would be very > glad to hear of it. > > Best regards > -- > Carlos > > > Best regards > -- > Carlos > > Consider changing the called function's handling of arguments instead > to accept the vector of data directly if a vector makes sense, or to a > list if the arguments have a variety of types. >> --- >> Jeff NewmillerThe . . Go Live... >> DCN:Basics: ##.#. ##.#. Live Go... >> Live: OO#.. Dead: OO#.. Playing >> Research Engineer (Solar/BatteriesO.O#. #.O#. with >> /Software/Embedded Controllers) .OO#. .OO#. rocks...1k >> --- >> Sent from my phone. Please excuse my brevity. >> >> Carlos Pita wrote: >> >>>Hi, >>> >>>I want to know if it's possible to pass a vector v=c(x,y,...) to a >>>function f(x,y,...) so that each vector element corresponds to a >>>formal argument of the function. For python programmers: f(*v). >>> >>>Specifically, what I'm trying to achieve is: given a list of >>>coordinates l=list(c(x1,y1,z1), c(x2,y2,z2),...) I would like to >>>obtain the corresponding elements in some array A (3-dim in this >>>case). That is: A[x1,y1,z1], A[x2,y2,z2], >>> >>>One way would be to transform l=list(c(x1,y1,z1), c(x2,y2,z2),...) to >>>l2=list(c(x1,x2,...),c(y1,y2,...),c(z1,z2,...)) and then (if this is >>>possible at all) execute the equivalent to A[*l2]. >>> >>>Another way would be to lapply function(xyz) { A[*xyz] } to each >>>coordinate vector in l. In any case I need the f(*v) equivalent. >>> >>>Please take into account that, despite the 3-dim example, I need to >>>implement the above to accept n-dim vectors for arbitrary n, so >>>something like x<-xyz[1], y<-xyz[2], z<-xyz[3] wouldn't fit the bill. >>> >>>Any other suggested solution would be appreciated. >>> >>>Best regards >>>-- >>>Carlos >>> >>>__ >>>R-help@r-project.org mailing list >>>https://stat.ethz.ch/mailman/listinfo/r-help >>>PLEASE do read the posting guide >>>http://www.R-project.org/posting-guide.html >>>and provide commented, minimal, self-contained, reproducible code. >> > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Can I define a object array in R?
Hello Sarah, You may want to use a package instead of trying to implement those data structures. For example: http://www.bioconductor.org/packages/release/bioc/html/graph.html Best, -m On 29 January 2013 11:22, Sarah Goslee wrote: > In R, lists are used for that. See ?list or any intro to R for details. > > Sarah > > On Tuesday, January 29, 2013, cuiyan wrote: > >> Here is my problem, >> 100 decision trees were built(similar to random forest) and I want to >> replace some of them by new trees. >> How can I define a tree array including 100 trees, i.e. t[100], and every >> t[n] is an "C5.0" object, >> such that >> when a new tree comes, i can do >> n<-10 >> t[n]<-C5.0(...) >> >> >> >> > > -- > Sarah Goslee > http://www.stringpage.com > http://www.sarahgoslee.com > http://www.functionaldiversity.org > > [[alternative HTML version deleted]] > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. __ 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] Modifying Package Data
You can use system.file to fine the package root, then data file path relative to this. For example system.file(package = "stats") # The root of package 'stats' See ?system.file On 6 February 2013 22:02, David Winsemius wrote: > > On Feb 4, 2013, at 11:37 AM, Rich Shepard wrote: > >> The bio.infer package contains a data frame >> /usr/lib/R/library/bio.infer/data/itis.ttable.rda that needs to be modified. >> After loading the bio.infer package and attaching the data frame with the >> data() function, I wrote the data frame to a text file. >> >> After adding another row to the data frame I applied read.table() to >> create a data frame, but it's in my pwd, not the R library data subdirectory >> for the bio.infer package. >> >> What is the R function to copy/save/write either the text file or the >> local copy of itis.ttable to >> /usr/lib/R/library/bio.infer/data/itis.ttable.rda? > > Wouldn't this just be: > > save(itis.table, file="/usr/lib/R/library/bio.infer/data/itis.ttable.rda") > > > > -- > > David Winsemius > Alameda, CA, 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-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] rpy2 (Python <--> R)
Wrong list. You may want to ask here: http://rpy.sourceforge.net/maillist.html But looking at your output it looks like you need to install readline library sources or be sure that it is in the CFLAGS's -I On 10 February 2013 06:06, James Jong wrote: > Hi - I am having trouble installing rpy2. I have already compiled R as a > shared library, but I do not have admin privileges on so I am trying to > install rpy2 with: > > pip install -user rpy2 > > but I am getting the following error: > > > ./rpy/rinterface/_rinterface.c:86:31: fatal error: readline/readline.h: No > such file or directory > > compilation terminated. > > error: command 'gcc' failed with exit status 1 > > > I have downloaded readline, and compiled it to: > > /some/path/readline-6.2 > > How can I make rpy2 (or pip) aware of this location to avoid this header > compilation error? > > James > > [[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] How to use character in C code?
You may want to use C++ instead using Rcpp which string handling would be easier: http://gallery.rcpp.org/articles/strings_with_rcpp/ On 10 May 2013 15:51, cgenolin wrote: > Hi the list, > I include some C code in a R function using .C. The argument is a character. > I find how to acces to the characters one by one: > > --- 8< --- C > void dealWithCharacter(char **chaine, int *size){ > int i=0; > for(i=0;i<*size;i++){ > Rprintf("Le caractere %i est %c\n",i,chaine[0][i]); > }; > } > --- 8< -- R - > ch <- "zerta" > .C("dealWithCharacter",as.character(ch),as.integer(nchar(ch))) > --- 8< -- > > But is it possible to acces to the full word at once? > > Christophe > > > > -- > View this message in context: > http://r.789695.n4.nabble.com/How-to-use-character-in-C-code-tp4666757.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] Optimization of a function using optim
Dear Graham, On 16 June 2013 02:08, Graham McDannel wrote: > I am attempting to optimize a function I have developed using optim. > > I am getting the below error message: > > Error in n < 1: 'n' is missing > I suspect a function requires an argument named n, and you didn't pass one. Either in your objective function or in optim. See blow example that produce a similar error: > f <- function(n) { +if(n <1) { + print("one") +} + } > f() Error in n < 1 : 'n' is missing Best Wishes, -m __ 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] ROC with more than one predictor
On Tue, Oct 23, 2012 at 11:52 PM, Luigi wrote: > > Any tip on how to proceed? You may want to do check rocplus package. Its vignette is pretty good. http://cran.r-project.org/web/packages/rocplus/vignettes/rocplus.pdf In your case, I think pairwise comparison would be one approach Best, Mehmet __ 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] operating website through R
You just need to pass the parameters on Giovanni_cgi.pl with action=ASCII+Output On 11 April 2014 17:19, eliza botto wrote: > Dear Users of R, > I wanted to operate certain slots of this website > (http://disc2.nascom.nasa.gov/Giovanni/tovas/TRMM_V7.3B42_daily.2.shtml) > through R. I wanted to operate Latitude, longitude section, plot type, begin > and end year and ASCII Output Resolution. The filling of these slot will > produce and output file with I want to D/L at a certain location in my PC. > I have a matrix of 2 columns and 3000 rows which contain Latitude and > Longitude information which i want to upload automatically in the slots of > website. I tried to use certain web scarping techniques in R but to no use. > Is there a way of doing it in R. > thank you very much in advance, > Eliza > > > [[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] operating website through R
This looks not so elegant, while normally data provider must have a nice accessing API, anyway, for example you can do this: > myAdd <- > 'http://disc2.nascom.nasa.gov/daac-bin/Giovanni/tovas/Giovanni_cgi.pl?west=60&north=50&east=70&south=-50¶ms=0|3B42_V7&plot_type=Area+Plot&byr=2014&bmo=01&bdy=31&eyr=2014&emo=01&edy=31&begin_date=1998%2F01%2F01&end_date=2014%2F01%2F31&cbar=cdyn&cmin=&cmax=&yaxis=ydyn&ymin=&ymax=&yint=&ascres=0.25x0.25&global_cfg=tovas.global.cfg.pl&instance_id=TRMM_V7&prod_id=3B42_daily&action=ASCII+Output' > myData <- read.table(myAdd, skip=5, header=T) Will give you this: > str(myData) 'data.frame':16441 obs. of 3 variables: $ Latitude : num -50 -50 -50 -50 -50 -50 -50 -50 -50 -50 ... $ Longitude: num 60 60.2 60.5 60.8 61 ... $ AccRain : num 0 0.42 0.39 0.42 0.66 1.23 2.31 2.37 3.72 3.63 ... For choosing different parameters, for example in case of coordinates, you just need to change the values in 'myAdd' parameters after Giovanni_cgi.pl?, west, north, east, south. But you must be sure that there is a data available with those parameters, no magical error control here. On 11 April 2014 17:45, eliza botto wrote: > Dear Suzen, > > I couldn't understand. Could you please elaborate it with a small example? > > :( > > Thanks in advance. > > Eliza > >> Date: Fri, 11 Apr 2014 17:31:18 +0200 >> Subject: Re: [R] operating website through R >> From: msu...@gmail.com >> To: eliza_bo...@hotmail.com >> CC: r-help@r-project.org > >> >> You just need to pass the parameters on Giovanni_cgi.pl with >> action=ASCII+Output >> >> On 11 April 2014 17:19, eliza botto wrote: >> > Dear Users of R, >> > I wanted to operate certain slots of this website >> > (http://disc2.nascom.nasa.gov/Giovanni/tovas/TRMM_V7.3B42_daily.2.shtml) >> > through R. I wanted to operate Latitude, longitude section, plot type, >> > begin >> > and end year and ASCII Output Resolution. The filling of these slot will >> > produce and output file with I want to D/L at a certain location in my PC. >> > I have a matrix of 2 columns and 3000 rows which contain Latitude and >> > Longitude information which i want to upload automatically in the slots of >> > website. I tried to use certain web scarping techniques in R but to no use. >> > Is there a way of doing it in R. >> > thank you very much in advance, >> > Eliza >> > >> > >> > [[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] inverse normal distribution function
You may want to read about generalized linear modelling and link functions for forming appropriate categorical variable/link function. See documentations in R: ?glm, ?family and ?inverse.gaussian. Also look at the original paper of Nelder, John; Wedderburn, Robert , it is available freely with the courtesy of JSTOR: http://www.jstor.org/discover/10.2307/2344614 On 18 April 2014 09:13, thanoon younis wrote: > dear all members > > i want to use inverse normal distribution in R to show the value of > variable Z when Z represent the ordered categorical variables. i hope > anyone gives me an example on this distribution > . > > thanks to all > > [[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] inverse normal distribution function
Not sure how would you do that but there is a package SEM on CRAN for structural equation models. On 20 April 2014 01:10, thanoon younis wrote: > thank you so much Suzen > i want to use bayesian analysis in structural equation models with ordered > categorical data and i want to use inverse normal as a distribution of > thresholds and i dont find any paper or documents in R or another program > about inverse normal. > > best regards > __ 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] uniform number
WTF? Is that a R package from you? On 5 May 2014 09:27, Rolf Turner wrote: > On 05/05/14 17:05, Ragia Ibrahim wrote: >> >> >> Dear group, >> How to generate uniform probability choosing p to be 2% and 5%, in >> separate trials for 100 times. > > > No idea WTF you are talking about. Can you formulate a question that is > comprehensible to the human mind? > > cheers, > > Rolf Turner > > __ > 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] uniform number
That paper you cite is about Social networks. You may want to use igraph or sna packages On 5 May 2014 10:54, Ragia Ibrahim wrote: > thanks for replying > > in the following paper > http://www.cs.cornell.edu/home/kleinber/kdd03-inf.pdf > page 6 third paragraph > > > the author writes: > "assigned a uniform probability of p to each edge of the graph, choosing p > to be 1% and 10% > in separate trials." > > > how to use R function to get such probability ? > Regards > >> Date: Mon, 5 May 2014 10:12:49 +0200 >> Subject: Re: [R] uniform number >> From: msu...@gmail.com >> To: r.tur...@auckland.ac.nz >> CC: ragi...@hotmail.com; r-help@r-project.org >> >> WTF? >> >> Is that a R package from you? >> >> >> >> On 5 May 2014 09:27, Rolf Turner wrote: >> > On 05/05/14 17:05, Ragia Ibrahim wrote: >> >> >> >> >> >> Dear group, >> >> How to generate uniform probability choosing p to be 2% and 5%, in >> >> separate trials for 100 times. >> > >> > >> > No idea WTF you are talking about. Can you formulate a question that is >> > comprehensible to the human mind? >> > >> > cheers, >> > >> > Rolf Turner >> > >> > __ >> > 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] problem in r-code
Wrong list. This is an R list not Bugs. You may want to consult Bugs materials: http://www2.mrc-bsu.cam.ac.uk/bugs/weblinks/webresource.shtml On 8 May 2014 11:36, thanoon younis wrote: > dear all members > > is there anyone explain to me the code below and how can i transfer this > code to winbugs program. > > q[i,1]=qnorm(runif(1,min=.5,max=1),0,1) > > thanks in advance > > thanoon > > [[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] How can I make this nested loop faster?
Your code is not re-producable. Can you provide a working example using a standard dataset from R? But, you could first try to use compiler package, see ?enableJIT. Another option would be to use doMC/foreach packages if you can run your assignment in the nested loop in parallel, see %dopar%. On 8 May 2014 21:59, Ludwig Hilger wrote: > Hello everybody, > I have written a nested for-loop, but as length(uc) > 170,000, this would > take VERY long. I have tried to use sapply or something but I cannot get it > to work, I would be happy if someone could point out to write this more > efficiently. Thank you all, > > Ludwig > > ergsens <- data.frame(budget = numeric(500)) > uc <- unique(rftab$startCell) > > for(i in 1:500){ > uniquerates <- rlnorm(n = length(uc), mean = -1.6, sd = 1.7) > for(j in 1:length(uc)){ > rftab$masskg[rftab$startCell == uc[j]] <- uniquerates[j] > } > ergsens$budget[i] <- sum(rftab$masskg, na.rm = TRUE)/1000 > } > > > > > > - > Dipl. Geogr. Ludwig Hilger > Wiss. MA > Lehrstuhl für Physische Geographie > Katholische Universität Eichstätt-Ingolstadt > Ostenstraße 18 > 85072 Eichstätt > -- > View this message in context: > http://r.789695.n4.nabble.com/How-can-I-make-this-nested-loop-faster-tp4690209.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] Calculating transition probabilties
This looks like this is your homework about Markov chains. not an R question actually. But have a look at the markovchain package from CRAN: http://cran.r-project.org/web/packages/markovchain/vignettes/an_introduction_to_markovchain_package.pdf On 13 May 2014 16:49, Baba Bukar wrote: > Dear all, > > I am new to R and have some problem computing transition probabilities. My > problem goes like this; > > data_set <- > c(2,0,45,6,78,3,0,2,6,0,5,8,0,2,8,9,12,212,22,4,1,0,3,5,88,5,69,12,4,0,0,0,0,4,87,6,99,104,22,7) > > observations greater than, say 3, is considered as useful (denoted as 1) > while less than 3 are not useful (denoted as 1). Am trying to calculate the > transition in these count data such as P_1,1=prob from useful to useful, > P_1,0=prob from useful to not useful, P_0,1=prob from not useful to useful > and P_0,0=prob from not useful to not useful. > > Thank you much as you respond soonest > > Kind regards > Zakir > > [[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] How to Optimize two functions together in R
This deals with the multi-objective optimisation. Try MCO and emoa packages. http://stats.stackexchange.com/questions/77580/optimization-of-multiple-objective-functions-with-constraints On 15 May 2014 17:47, Mingxuan Han wrote: > I am trying to minimize two functions with same set of parameter(x,y). > Currently I can only use optim() to minimize the each function one by one. > Is there any solution I can use to optimize two functions with same set of > (X,Y) together. > > > > -- > View this message in context: > http://r.789695.n4.nabble.com/How-to-Optimize-two-functions-together-in-R-tp4690654.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] How to Optimize two functions together in R
Use defaul values initially, to see if you got reasonable results. See here for the details of nsga2 http://dx.doi.org/10.1109/4235.996017 On 19 May 2014 16:42, Mingxuan Han wrote: > I try to use NSGAII function in the mco but I am kind of confusing about the > numbers of input and output dimension in the argument. Could you explain a > little about this? Thank you. > > > > -- > View this message in context: > http://r.789695.n4.nabble.com/How-to-Optimize-two-functions-together-in-R-tp4690654p4690832.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] copula fitting
yes you can. On 7 June 2014 16:04, mudit gupta wrote: > Hi guys, > > can i fit a copula to two marginal distributions with different sample > size? > like one has 2340 observations and other has 1912. > > thanks > Mudit > > [[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] copula fitting
Have you checked out 'copula' package? On 11 June 2014 00:36, Suzen, Mehmet wrote: > yes you can. > > On 7 June 2014 16:04, mudit gupta wrote: >> Hi guys, >> >> can i fit a copula to two marginal distributions with different sample >> size? >> like one has 2340 observations and other has 1912. >> >> thanks >> Mudit >> >> [[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] Logistic Regression
You might want to read this vignette: http://cran.r-project.org/web/packages/HSAUR/vignettes/Ch_logistic_regression_glm.pdf On 14 June 2014 19:53, javad bayat wrote: > Dear all, I have to use "Zelig" package for doing logistic regression. > How can I use Zelig package for logistic regression? > > I did this code by glm function: > > glm1 = glm(kod~Curv+Elev+Out.c+Slope+Aspect,data=data, >family=binomial) > summary(glm1) > > But the results were not appropriate for my data. > > Many thanks for your helps. > > > > > > > > -- > Best Regards > Javad Bayat > M.Sc. Environment Engineering > Shahid Beheshti (National) University (SBU) > Alternative Mail: bayat...@yahoo.com > > [[alternative HTML version deleted]] > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Defining default method for S3, S4 and R5 classes
There is a nice tutorial on this: http://adv-r.had.co.nz/OO-essentials.html For an in depth guide, have a look at the book from John Chambers, Software for data analysis programming with R. On 13 June 2014 12:20, Luca Cerone wrote: > Dear all, > > I am writing a script implementing a pipeline to analyze some of the > data we receive. > > One of the steps in this pipeline involves clustering the data, and I > am interested > in studying the effects of different clustering algorithms on the final > results. > > I am having issues making my code general enough because the > clustering algorithms we are interested all return different types of > objects (S3, S4 and R5 classes, as well as simple named lists). > > >From the output of these algorithms I need to extract a list with as many > elements as the number of clusters and such that each element contains the ids > of the elements in each cluster. > > I have easily done this for each of the cluster algorithms, > the problem is: how can I make so that rather than having to check for > classes and > types this is done automatically? > > For example, for the algorithms that return S3 classes I have defined > a method "get_cluster_list.default" and then created the methods for > the individual classes, which is used in the main body of the > pipeline. > > I have no idea how I can do this for S4 and R5 classes and, more > importantly, I would > like an approach that works when using all S3, S4 and R5 classes. > > Do you know how I could do this? > > Thanks for the help, > Luca > > __ > 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] Using R to analyze multiple MRI studies
Did you inspect the CRAN view for Medical imaging? http://cran.r-project.org/web/views/MedicalImaging.html On 3 July 2014 17:09, moleps islon wrote: > I need to analyze multiple T1 contrast enhanced MRI studies from different > patients. They are all in DICOM format. I see that there are different > packages for loading individual studies in DICOM format, however I have had > limited luck so far researching how the different studies can be tranformed > into MNI or Talairach space. Is there an R-implementation of this? > > Best, > > M > > [[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] A general question: Is language S a component part of R?
On Tue, Nov 6, 2012 at 2:34 AM, Hadley Wickham wrote: > On Monday, November 5, 2012, Rolf Turner wrote: > >> On 06/11/12 09:40, Iurie Malai wrote: >> >>> So, R (as a language) can be viewed as an extended S language (S + some >>> improvements)? And the R environment includes this (extended) language + >>> extensions? >>> R has lots of similarities but it isn't "just" extended S!!! it has many better features grammatically. R packaging to low level language integration being small set of differences. I recommend you to read the R book by the inventor of S, John Chambers, (ACM award recipient) to understand the fundamental differences: http://www.amazon.co.uk/Software-Data-Analysis-Prt ogramming-Statistics/dp/0387759352 S/S+ is a commercial product. R community and academics provides much larger and high quality/reliable open source alternative to this and yet let anyone use it for free, as in freedom, even if you are nasty person, you are allowed to practice this. >> >> Are others getting as sick of this silly, pedantic and completely >> irrelevant pseudo-scholasticism as I am? >> What did you contribute to world accept making toxic comments on the list of one of the largest open source academic software on the planet? No cookies for you, go home. __ 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 view source code of a function inside a package?
It might be a C code wrapped around. -m On Thu, Nov 15, 2012 at 8:21 PM, C W wrote: > Dear list, > I am trying to look at the function inside a package. I know that > methods() would do the trick, but what if the function is hidden? I have a > problem displaying the hidden function. > > Say, for example the MCMC package. How do you view the code of that > function? > > something like this: > >> which > > function (x, arr.ind = FALSE, useNames = TRUE) > > { > > wh <- .Internal(which(x)) > > if (arr.ind && !is.null(d <- dim(x))) > > arrayInd(wh, d, dimnames(x), useNames = useNames) > > else wh > > } > > > > > > [[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. -- Mehmet Süzen, Ph.D. ( Dr.phil.nat. ) | PRIVILEGED AND CONFIDENTIAL COMMUNICATION This e-mail transmission, and any documents, files or previous e-mail messages attached to it, may contain confidential information that is legally privileged. If you are not the intended recipient or a person responsible for delivering it to the intended recipient, you are hereby notified that any disclosure, copying, distribution or use of any of the information contained in or attached to this transmission is STRICTLY PROHIBITED within the applicable law. If you have received this transmission in error, please: (1) immediately notify me by reply e-mail to su...@acm.org, and (2) destroy the original transmission and its attachments without reading or saving in any manner. | __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Installing R on Ubuntu
Try Prof. Wilkinson's recent blog entry: http://darrenjw.wordpress.com/2012/11/10/keeping-r-up-to-date-on-ubuntu-linux/ On Thu, Nov 15, 2012 at 5:14 PM, Karel van Duijvenboden wrote: > Hello R-help team, > > I seek your help (for what is most likely a very simple problem). I'm new > to Ubuntu and tried to install R using the Ubuntu Software Center. However, > after clicking the install command, I always get prompted with the error " > Failed to download package files --- check your internet connection". > Details: Failed to fetch > http://archive.ubuntu.com/ubuntu/pool/main/a/apparmor/dh-apparmor_2.7.102-0ubuntu3.1_all.deb404 > Not Found [IP: 91.189.92.200 80] > > However, my internet connection is perfectly fine and I've already > installed a bunch of programs using the Software Center without any > problems. I've tried various of the available R packages (also the > Rcommander) and always get this same error. Perhaps it has something to do > with the server/mirror? > > Alternatively, I've downloaded a .zip of the package, but so far I've > failed to install the program. With me, for now, being an unequivocal > Ubuntu dummy I would prefer the straightforward Software Center route and > in any case I wonder why it does not work for me. > > Best regards and thanks in advance! > > Karel van Duijvenboden (Netherlands) > > [[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. -- Mehmet Süzen, Ph.D. ( Dr.phil.nat. ) | PRIVILEGED AND CONFIDENTIAL COMMUNICATION This e-mail transmission, and any documents, files or previous e-mail messages attached to it, may contain confidential information that is legally privileged. If you are not the intended recipient or a person responsible for delivering it to the intended recipient, you are hereby notified that any disclosure, copying, distribution or use of any of the information contained in or attached to this transmission is STRICTLY PROHIBITED within the applicable law. If you have received this transmission in error, please: (1) immediately notify me by reply e-mail to su...@acm.org, and (2) destroy the original transmission and its attachments without reading or saving in any manner. | __ 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] Function for extracting Lambda Sets
Hi Nick, Have you tried this: http://www.bioconductor.org/packages/release/bioc/html/RBGL.html There is a function there called 'lambdaSets' Best, Mehmet On Thu, Nov 15, 2012 at 10:45 AM, Nick Duncan wrote: > Dear All, > > I would like to extract Lambda Sets from a binary matrix that > represents a social network. > The calculation of Lambda Sets is set out in Borgatti 1990 (which can > be downloaded freely). > The package SNA goes part of the way with the function MaxFlow but > does not have the Lambda partitioning - but perhaps it is called > differently in R. > Does anyone know if it exists as a function or if there is a sequence > functions to replicate it? > Many thanks for any guidance on this. > Best, > Nick > > __ > 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] simple question on loop
Use mapply instead On Fri, Nov 16, 2012 at 5:01 PM, billycorg wrote: > Hi R Users. > > I have a simple question on a loop. > > The following loop works fine: > > r_t=list() > for(i in 1:500) > { > r_t[[i]]=h_t_half[[i]]%*%matrix(*z_t_m*[i,]) > } > > But indeed I need also that *z_t_m* varies. Let us suppose that *z_t_m* has > 1000 replicates, > I have written the following loop that (naturally) does not work. > > r_t <- list() > for(r in 1:replicate) > { > for(i in 1:499) > { > r_t[[r]][[i]]=h_t_half[[i]]%*%matrix(*z_t_m*[[r]][i,]) > } > } > > If, for instance, I try to do > > h_t_half[[1]]%*%matrix(*z_t_m*[[1000]][1,]) > > I effectively obtain (only one row of) r_t. But I need to have 1000 > replications of the whole r_t, that has 500 rows. > > Do you have any suggestions? > > Thank you!!! > > > > -- > View this message in context: > http://r.789695.n4.nabble.com/simple-question-on-loop-tp4649761.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. -- Mehmet Süzen, Ph.D. ( Dr.phil.nat. ) | PRIVILEGED AND CONFIDENTIAL COMMUNICATION This e-mail transmission, and any documents, files or previous e-mail messages attached to it, may contain confidential information that is legally privileged. If you are not the intended recipient or a person responsible for delivering it to the intended recipient, you are hereby notified that any disclosure, copying, distribution or use of any of the information contained in or attached to this transmission is STRICTLY PROHIBITED within the applicable law. If you have received this transmission in error, please: (1) immediately notify me by reply e-mail to su...@acm.org, and (2) destroy the original transmission and its attachments without reading or saving in any manner. | __ 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] Download a file from url
you can use RCurl for web connections from Duncan Lang, see its paper: http://www.omegahat.org/RCurl/RCurlJSS.pdf getURL there will solve your problem. On Sun, Nov 18, 2012 at 2:07 AM, veepsirtt wrote: > Hi R, > I installed wget and tried to download the file from this > http://nseindia.com/content/equities/scripvol/datafiles/16-11-2012-TO-16-11-2012ACCEQN.csv > but it fails. > How to get it using wget? > thanks > veepsirtt > > > #Define Working Directory, where files would be saved > setwd('G:/NIFTY') > > #Define start and end dates, and convert them into date format > startDate = as.Date("2011-01-05", order="ymd") > endDate = as.Date("2011-02-01", order="ymd") > > f <- tempfile() > > downloadfilename=paste("ACC", "EQN", sep = "") > temp ="" > > #Generate URL > http://nseindia.com/content/equities/scripvol/datafiles/16-11-2012-TO-16-11-2012ACCEQN.csv > > myURL = > paste("http://nseindia.com/content/equities/scripvol/datafiles/";, > as.character(startDate, "%d-%m-%Y"), "-TO-", as.character(endDate, > "%d-%m-%Y"), downloadfilename, ".csv", sep = "") > > > download.file(myURL, f, method='wget', extra="-U 'Mozilla/5.0 (X11; Linux) > Gecko Firefox/5.0'") > > temp <- read.csv(f, sep = ",") > head(temp) > > > > > > > > > > -- > View this message in context: > http://r.789695.n4.nabble.com/Download-a-file-from-url-tp4642985p4649907.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] about MCMC
Hello Tania, You may want to read MCMCpack's paper; http://www.jstatsoft.org/v42/i09/paper and one of the best book in the field: http://www.amazon.com/Markov-Practice-Chapman-Interdisciplinary-Statistics/dp/0412055511 Also look on CRAN view on Bayesian Inference Best, -m On Tue, Nov 20, 2012 at 10:52 PM, Tania Patiño wrote: > Hello all, could you tell wehere I can find information related to MCMC > (Monte Carlo). > And some examples about this topic. > > Thanks, > > Tania > > [[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] Create BATCH file
Try this: http://stat.ethz.ch/R-manual/R-patched/library/utils/html/BATCH.html On Wed, Nov 21, 2012 at 11:58 AM, R_Antony wrote: > Hi, > > I have a ".R" file written many functions into that. My requirement what is, > i need to create a batch file for this. > No idea, how to create it. Tried it many other ways, but no result !. > Could anyone please help me out ? > > Thanks. > Antony. > > > > > -- > View this message in context: > http://r.789695.n4.nabble.com/Create-BATCH-file-tp4650277.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] function call from another r file
If you want to handle a generic case, best thing is to create an R package. It is much easier to manage that using source(), if you have lots of different functionality and data files. Also look at ?system.file. On Sat, Nov 24, 2012 at 7:49 AM, Jeff Newmiller wrote: > It is straightforward to load function definitions into memory using the > source() function. > --- > Jeff NewmillerThe . . Go Live... > DCN:Basics: ##.#. ##.#. Live Go... > Live: OO#.. Dead: OO#.. Playing > Research Engineer (Solar/BatteriesO.O#. #.O#. with > /Software/Embedded Controllers) .OO#. .OO#. rocks...1k > --- > Sent from my phone. Please excuse my brevity. > > sheenmaria wrote: > >>How to call a function from another r file ? >>Anyone can help me . >> >>Having a function named like fun1 which is saved in r file file1.r >>and i have another r file like file2.r, and i need to call the fun1 >>(which >>is in file1) within file2. >> >>Thank you >> >> >> >> >>-- >>View this message in context: >>http://r.789695.n4.nabble.com/function-call-from-another-r-file-tp4650627.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. __ 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] Concordant und Discordant Paars of Logistic Regression
Hello Marcus, Concerning measures of association, have a look at here http://stackoverflow.com/questions/2557863/measures-of-association-in-r-kendalls-tau-b-and-tau-c But why do you need logistic regression? Best, -m PS: I think official language is Englisch in diese list. On Tue, Nov 27, 2012 at 5:49 PM, Marcus Tullius wrote: > Hallo there, > > can anymore show me how to get results about konkordant und diskordant paars > (Sommer-D, Gudman-Krustal-Gama, Kendall-Tau-a) within a logistic regression) > in R? > > Thanks a lot. > MT > > [[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] code optimisation problem
or write the compute intense part in C and interface it to R. On Wed, Nov 28, 2012 at 5:45 AM, William Dunlap wrote: > Or try the filter() function (with convolutional filter rep(1/3,3)). > > Bill Dunlap > Spotfire, TIBCO Software > wdunlap tibco.com > > >> -Original Message- >> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On >> Behalf >> Of cbe...@tajo.ucsd.edu >> Sent: Tuesday, November 27, 2012 4:53 PM >> To: r-h...@stat.math.ethz.ch >> Subject: Re: [R] code optimisation problem >> >> Rui Barradas writes: >> >> > Hello, >> > >> > Package 'compiler' is good at optimizing for loops. Try the following. >> > >> >> Or vectorize the function >> >> > system.time(f1(x,10)) >>user system elapsed >>5.010.005.00 >> > system.time(f1.c(x,10)) >>user system elapsed >>1.920.001.91 >> > f2 <- function(v,k) diff(cumsum(c(0,v)),lag=k)/k >> > system.time(f2(x,10)) >>user system elapsed >>0.110.000.11 >> > >> Chuck >> >> > >> > #install.packages('compiler') >> > library(compiler) >> > f1.c <- cmpfun(f1) >> > >> > N <- 1e6 >> > x <- rnorm(N) >> > system.time(f1(x, 10)) >> >user system elapsed >> >6.770.066.83 >> > system.time(f1.c(x, 10)) >> >user system elapsed >> >2.570.002.57 >> > >> > >> > Hope this helps, >> > >> > Rui Barradas >> > >> > Em 27-11-2012 21:43, 47 escreveu: >> >> I'd like to write a function that has a vector and a (pos.) number as >> >> inputs >> >> and returns what is on the picture below (arithmetic means of (k) >> >> consecutive elements of a given vector). The problem is it works too slow >> >> for long vectors and i know it can be done without "for" loop. However, >> >> i've >> >> got no idea how. Can anyone help me with that? >> >> >> >> f1 <- function(v,k) { >> >>n <- length(v) >> >>z <- (n-k+1) >> >>for (i in k:n) { >> >> v[i-k+1] <- sum(v[(i-k+1):i]) >> >>} >> >>v <- v[1:(n-k+1)] >> >>v <- v/k >> >>return (v) >> >> } >> [...] >> >> __ >> R-help@r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] best HDF5 package: h5r or rhdf5?
In my experience, I think h5r is more robust while it is directly wrapped around the C library and contains more functionality. On Tue, Nov 27, 2012 at 4:51 PM, Johann Hibschman wrote: > What is the current best package for manipulating HDF5 data files? > > I tried "hdf5" a long time ago, but I ran into memory problems. "h5r" is on > CRAN now, and "rhdf5" is part of bioconductor. > > Ideally, I'd like to read simple vectors or tables, either the entire thing > or a subset of rows. I don't need much writing support, but it would be > nice. Compression is a must, though. > > Thanks, > Johann > > [[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] Solving a multinomial gompertz partial differential equation in r
Hi Brandon, You can try ReacTran package: cran.r-project.org/web/packages/ReacTran/vignettes/PDE.pdf Best, -m On 3 December 2012 06:49, Brandon Breitling wrote: > I haven't used r in quite a while but would like to get back into it. I > have a problem that I would like to solve with r. I have some multinomial > data that looks to follow an asymmetric sigmoidal growth pattern. Solving > a multinomial gompertz partial differential equation in r is what I’m after. > Would anyone be able to provide me the code and packages to do something > like this? > > Regards, > > [[alternative HTML version deleted]] > > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > __ 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] Resampling Help Needed
You can use, 'sample' function for sampling and may consider using partition clustering for selecting your regions, see Cluster task view: http://cran.r-project.org/web/views/Cluster.html On 4 December 2012 00:53, KoopaTrooper wrote: > I am using package ks() to build 3D representations of bird territories and > calculate territory volume from spatial data (simply x, y, and z > coordinates). What I want to do is determine at what sample size (# > locations collected) does the territory volume stop increasing. This should > give me an idea of the number of points needed for future seasons. > > So I have a couple of birds each with 200 spatial locations (x,y,z). I want > to run the following code (see below), but have R calculate territory size > 100 times with 10 random points (no replacement), 100 times with 20 random > points, 100 times with 30 random points, etc. I can figure out how to do > this manually (i.e. create 100 individual files with 10 random points, 20 > random points, etc.) but I figure there must be a way to make my life > easier. Any help would be appreciated. Even pointing me in the correct > direction would be a big help. Thanks! > > Nathan > > #read data files (.csv's with 200 rows of x,y,z coordinates) > a<-read.csv("A_PW_ASY_M_LII_2011.csv") > > #calls the plug-in bandwidth estimator > Ha <- Hpi(a) > > #sets min/max grid size for each dimension > minX<-min(a$X)-25 > minY<-min(a$Y)-25 > minZ<-0 > > maxX<-max(a$X)+25 > maxY<-max(a$Y)+25 > maxZ<-max(a$Z)+5 > > #creates kernel utilization distribution > fhata <- kde(x=a, H=Ha, binned=FALSE, xmin=c(minX,minY,minZ), > xmax=c(maxX,maxY,maxZ)) > > #calculates territory volume at 95% isopleth > Vol95<-contourSizes(fhata, cont=95) > > > > -- > View this message in context: > http://r.789695.n4.nabble.com/Resampling-Help-Needed-tp4651973.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.