Re: [R] Adding a column into the file
On Fri, 1 Jun 2012 09:27:58 -0700 (PDT) pigpigmeow gloryk...@hotmail.com wrote: Dear all, I have a lot of problems on R-programming. for example my csv. file is .. Date wrfRH wrfsolar wrfwindspeed wrfrain wrftd wrfta 21/10/2010 92.97 22.11 53.27 0 1546.337861 61.00852664 22/10/2010 87.35 21.99 40.89 0 1300.408288 62.85352227 23/10/2010 88.38 21.71 28.04 0.01 1381.768284 54.80594493 24/10/2010 92.32 15.45 22.38 0.51 1113.90981 39.46573663 25/10/2010 93.42 21.59 35.5 0.52 868.4895334 28.42952321 26/10/2010 93.38 20.15 42.58 0.07 1404.722837 40.29300856 i calculate the ratio of wrfRH/wrfsolar for each day. that is Date wrfRH wrfwindspeed wrfrain wrftd wrfta ratio 21/10/2010 92.97 22.11 53.27 0 1546.337861 61.00852664 22/10/2010 87.35 21.99 40.89 0 1300.408288 62.85352227 23/10/2010 88.38 21.71 28.04 0.01 1381.768284 54.80594493 24/10/2010 92.32 15.45 22.38 0.51 1113.90981 39.46573663 25/10/2010 93.42 21.59 35.5 0.52 868.4895334 28.42952321 26/10/2010 93.38 20.15 42.58 0.07 1404.722837 40.29300856 how to add new column in the original file ? Anyone can help me?! First, that is not a csv file. Your delimiter is a space. Second, it appears that the first and second records contain two spaces between the wrtfa column and the ratio column. Since you don't provide an example how how you actually read the data table into R, there's no way to say what else might be wrong. If you specify an escaped space as the delimiter, the read should fail at about the third line. Now, if you use R to calculate the ratio the story is different. I would guess you simply want to join the calulated field to your data frame: To move the new data to a data frame, calculate the new variable and then assemble the new data frame: ratio - dat$wrfRH/dat$wrfsolar then newdataframe - data.frame(dat, ratio) which should yield what I believe you want. That of course assumes that what you really want to do is simply add the new column of calculated values to the original data. There also any number of very helpful books about R that can probably help. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Add a dim to an array
Dear list, I'm trying to add a new dim to a multidimensional array. My array looks like this a1 - array(1:8, c(2, 2, 2)) dimnames(a1) - list(A = c(A1, A2), B = c(B1, B2), D = c(D1, D2)) I would like to add a new dim 'group' with the value low. Right now I'm using this, but I think are better ways... a2 - as.data.frame(as.table(a1)) a2$group - low a2 - xtabs(Freq ~ A + B + D + group, data = a2) a2 Thanks for any help! Patrick __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Average curve in R
Arun and Rui Barradas: thankyou very much for sorting out my issue. I got what I wanted. Rainer Schuermann and Jeff Newmiller: thankyou very much for your suggestion. I will take care of it in future. regards - On Fri, 1 Jun 2012 19:47:05 -0700 (PDT) arun smartpink...@yahoo.com wrote: Hi Qamar, I guess you are looking for row means vs. days plot. If that is the case, try this: datQ-cbind(c(6,5,6,7,4,3,5),c(2,4,35,32,4,6,6),c(2,4,2,3,423,4,5),c(2,3,13,5,3,5,3)) datQmean- apply(datQ,1,mean) [1] 3.00 4.00 14.00 11.75 108.50 4.50 4.75 datQmean-data.frame(datQmean) days-c(1:7) datQplot-data.frame(datQmean,days) plot(datQmean~days,data=datQplot,type=l) A.K. - Original Message - From: QAMAR MUHAMMAD UZAIR d029...@polito.it To: r-help@r-project.org Cc: Sent: Friday, June 1, 2012 5:31 PM Subject: [R] Average curve in R Dear R users, l I have weekly data in the following manner [,1] [,2] [,3] [,4] 6 2 2 2 5 4 4 3 6 35 2 13 7 32 3 5 4 4 423 3 3 6 4 5 5 6 5 3 I drew curve of each column against days (1,2,3,4,5,6,7). Now I want to draw an average curve (a representative curve) of the whole data. Is there a way in R to perform such operation? please reply ASAP as i have an assignment to submit on monday. Thanks in Advance.. 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. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Log-normal probability plot
Dear R users, You can literally safe my life my telling me the solution of my problem. I have created matrix of a data frame with 3 columns, with each column representing data of different year. 2 1 5 3 4 4 4 3 32 3 4 4 4 32 5 3 4 2 1 3 4 I now want to plot Lognormal probability plot of each column data against its respective normal reduced variante(z). How to do that? If you dont know the answer, consider me dead. [[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] Memory-random forest
Hi all, I am working with random forest on the large data set( 39). I have a warning message : In matrix(integer(nrnodes * nt), ncol = nt) : Reached total allocation of 3766Mb: see help(memory.size). Can you have any suggestions? Thanks, Myriam [[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] Compare data between two groups/countries on 5-point Likert scale questionnare?
Hi everyone, I'm stuck on my dissertation which is due next week. I'm a business major student and my project is a comparative research on corporate social responsibility (CSR) between Chinese and German firms. According to my literature review, it's quite obvious that German firms have much better CSR initiatives and strategies than the Chinese ones and I wanted to test whether it was true by sending out Likert-scale questionnaires to Chinese and German firms through bankers in my family. I have already got 24 responses from the Chinese and 27 from the Germans and it looked quite evident that the hypothesis is correct. Now that I am writing my analysis chapter, I am lost as I don't know which is the best way to analyse my data after trying to find a solution for days. Basically, my questionnaire is structured in this way: Q1 - Q5: statements on environment-oriented CSR Q6 - Q10: statements on workplace-oriented CSR Q11 - Q15: statements on community-oriented CSR Q16-Q20: statements on market-oriented CSR All of the statements are 5-pt Likert questions. I initially planed to compare the grouped mean values for each of the above section but I know that it's not scientific. So can someone give me any advice on which kind of tests is most suitable for my research? As you can see, my sample size is quite small. I really appreciate your time! -- View this message in context: http://r.789695.n4.nabble.com/Compare-data-between-two-groups-countries-on-5-point-Likert-scale-questionnare-tp4632163.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] points() function will not plot
Looks like you've swapped x and y. Sarah On Friday, June 1, 2012, David Winsemius wrote: On Jun 1, 2012, at 4:09 PM, jcrosbie wrote: I can not get the point function to work with in my code. The code: AggOfTempMatrix$**CumSumPercentSize-c( 0.05265450, 0.05738490, 0.05865403, 0.05911553, 0.05957703, 0.06003854, 0.06058368, 0.06098750, 0.06147208, 0.06187589, 0.06291427, 0.06331808, 0.06354884, 0.06408533, 0.06489296, 0.07382014, 0.07397590, 0.08124456, 0.08228294, 0.0827, 0.08283097, 0.08306172, 0.08349438, 0.08372513, 0.08412894, 0.08435969, 0.08453276, 0.08491350, 0.08570382, 0.08599226, 0.08749791, 0.08831131, 0.08848437, 0.08954582, 0.09058420, 0.09069958, 0.09112358, 0.09123896, 0.11087010, 0.11410062, 0.15309754, 0.20017364, 1.) AggOfTempMatrix$Price-c( 0.00, 71.35, 72.00, 74.00, 75.00, 76.00, 84.24, 87.00, 88.00, 90.24, 91.00, 94.22, 96.00, 98.00, 100.25, 121.00, 246.12, 272.44, 273.00, 295.00, 435.00, 455.14, 460.00, 475.00, 586.00, 591.00, 609.00, 622.00, 656.00, 750.00, 789.16, 798.00, 813.00, 834.00, 850.00, 895.00, 904.00, 915.00, 916.00, 924.00, 950.00, 996.66, 999.24) plot(AggOfTempMatrix$Price, AggOfTempMatrix$**CumSumPercentSize, type=l, main = mainTitle, xlab=xAxislable, ylab=yAxislable, lwd=5) points(x=0.5, y =300, col=darkred,pch=12) #this wont plot Your y range is from 0 to 1. Why would you expect to see that point? -- View this message in context: http://r.789695.n4.nabble.com/** points-function-will-not-plot-**tp4632135.htmlhttp://r.789695.n4.nabble.com/points-function-will-not-plot-tp4632135.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-helphttps://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/** posting-guide.html http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. David Winsemius, MD Heritage Laboratories West Hartford, CT __** R-help@r-project.org mailing list https://stat.ethz.ch/mailman/**listinfo/r-helphttps://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/** posting-guide.html http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- 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] igraph and igraph0
Could someone tell me the difference between igraph and igraph0? I searched the CRAN web site, but cannot find an explantion of the differences. Thanks, Alan [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] R and igraph problems
Why is igraph 0.5.5 not on the igraph sourceforgwe home page? [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Help with this web scrape function
Would like to see this at the top again, as I think it did not get pick up when I posted it initially. Apologies, last try. -- View this message in context: http://r.789695.n4.nabble.com/Help-with-this-web-scrape-function-tp4632137p4632169.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] About Plot.new
@mr.parashar4 - If this not resolved yet, here is what can help plot.new is trying to create a new object out of the standard point plot. I believe you have not created a standard point plot, i.e. in your case, plot(xm,ym). This will show the graphical plot window. Keep that window open and then run your given command. If you have already defined plot(), then just keep that window open. That is when R will find the object and go ahead with the further commands over the plot you specify. Hope this helps. -- View this message in context: http://r.789695.n4.nabble.com/About-Plot-new-tp866862p4632196.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Add a dim to an array
Hello, Try a3 - array(dim=c(2, 2, 2, 2)) dn - dimnames(a1) dn$group - c(low, high) dimnames(a3) - dn a3[] - a1 # to use [] keeps the dimensions a3 # it fills a3 recycling a1 (two copies) dim(a2) dim(a3) As you can see, 'a2' is not of the right dimensions, and 'a3' has now two copies of 'a1' but it's dimensions are right. There are ways of giving dimnames to 'a3' other than creating a new object, 'dn', but this one is a simple one. Hope this helps, Rui Barradas Em 02-06-2012 16:17, Patrick Hausmann escreveu: Dear list, I'm trying to add a new dim to a multidimensional array. My array looks like this a1 - array(1:8, c(2, 2, 2)) dimnames(a1) - list(A = c(A1, A2), B = c(B1, B2), D = c(D1, D2)) I would like to add a new dim 'group' with the value low. Right now I'm using this, but I think are better ways... a2 - as.data.frame(as.table(a1)) a2$group - low a2 - xtabs(Freq ~ A + B + D + group, data = a2) a2 Thanks for any help! Patrick __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] R 15.0 Warning message.
Dear list, I have install R15.0 on Ubuntu system using the source code. It is install to my home directory. I have no root privilege. When I start R, I got this warning message: During startup - Warning message: Setting LC_CTYPE failed, using C How can I fix this? Thanks. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Add a dim to an array
On Sat, Jun 02, 2012 at 05:17:36PM +0200, Patrick Hausmann wrote: Dear list, I'm trying to add a new dim to a multidimensional array. My array looks like this a1 - array(1:8, c(2, 2, 2)) dimnames(a1) - list(A = c(A1, A2), B = c(B1, B2), D = c(D1, D2)) I would like to add a new dim 'group' with the value low. Right now I'm using this, but I think are better ways... a2 - as.data.frame(as.table(a1)) a2$group - low a2 - xtabs(Freq ~ A + B + D + group, data = a2) a2 Hi. Try the following. a1 - array(1:8, c(2, 2, 2)) dimnames(a1) - list(A = c(A1, A2), B = c(B1, B2), D = c(D1, D2)) a2 - array(a1, c(2, 2, 2, 1)) dimnames(a2) - c(dimnames(a1), list(group = low)) a2 , , D = D1, group = low B AB1 B2 A1 1 3 A2 2 4 , , D = D2, group = low B AB1 B2 A1 5 7 A2 6 8 Hope this helps. Petr Savicky. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Modify pdf file with Illustrator.
Dear list, Some times I want to modify the pdf file which produced by R with illustrator. But when I use Illustrator open the pdf file, it often makes the pdf some little changed. Anyone have some suggestions? Is it better to use other file type, not pdf? Or when I produced the pdf, I should set some other parameters? Thank you __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] R 2.15.0 and 2.14.2 crash on the same code that runs on 2.14.1
On Jun 3, 2012, at 07:40 , Ebrahim Jahanshiri wrote: Dear list, My code runs on 2.14.1 smoothly (with no error) but makes R crash on 2.14.2 and 2.15.0 with the usual windows message about R for windows GUI front-end has stopped working... and as such I dont have any access to R to get any error or warning message (if any). It crashes on random parts of the code any time that I run it. The code consists of EDA and spatial regression and various loops and optimizations. The goal of the code is to perform a complete analysis on various datasets. Please take a look at the code here : https://sites.google.com/site/geosciej/Home/STAR_ter1.R?attredirects=0d=1 You are not likely to find people willing to debug 15553 lines of code for you, and they are certainly not going to do it by eye, without the datasets! One thing that jumps out is that you start off by loading five external packages, either of which might be the true owner of the problem. Even if the actual crash hits in the stats.dll, the underlying issue could well be memory corruption occurring some time earlier. Things to try: Run under Rterm in a command window instead of Rgui. That should at least tell you how far you got before the crash, maybe even a proper traceback. Carefully try disabling parts of the code until the issue goes away. The last item removed might hold the clue. If you can cut it down to something small(-ish) and reproducible, people might be in a better position to help you. Is it really a random crash, or does the crash point move every time you change the code slightly? If the former, you might have physical computer problems or you might be running close to your memory limit. -Peter D. It seems that the results that comes out of 2.15.0 is more valid for my work. I cant think of anything that makes the code crash on the latest versions. Here is the error message from windows: Problem Event Name: APPCRASH Application Name: Rgui.exe Application Version: 2.150.58871.0 Application Timestamp: 4f75a0ca Fault Module Name: stats.dll Fault Module Version: 2.150.58871.0 Fault Module Timestamp: 4f75a1c9 Exception Code: c005 Exception Offset: 000237c5 OS Version: 6.1.7601.2.1.0.256.48 Locale ID: 1033 Additional Information 1: 0a9e Additional Information 2: 0a9e372d3b4ad19135b953a78882e789 Additional Information 3: 0a9e Additional Information 4: 0a9e372d3b4ad19135b953a78882e789 I appreciate your help, Thank you Ebrahim Jahanshiri [[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. -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Email: pd@cbs.dk Priv: pda...@gmail.com __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] R and igraph problems
On Jun 2, 2012, at 15:43 , jalantho...@verizon.net wrote: Why is igraph 0.5.5 not on the igraph sourceforgwe home page? You'll have to ask the igraph developers... Possibly, they just ran out of round tuits. -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Email: pd@cbs.dk Priv: pda...@gmail.com __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] R 2.15.0 and 2.14.2 crash on the same code that runs on 2.14.1
Thank you very much. Memory problem or heat (of CPU?) is the main suspect here for me. But how is it that 2.14.1 can run it but others can not I dont know (maybe some mechanisms that prevent memory problem in 2.14.1 are not working in the latest versions. One thing for sure is that the speed of loops are really higher in 2.15 and the results as I said are more valid for me). I did use divide and conquer and it think the optimization part with nlminb() is the main suspect here (the code does 28 nlminb() in each loop) but again how is it that it does not work sometimes is really a mystery to me. I did try running the code on different machines (32 and 64 bit windows 7 with 4GB of RAM mainly CORE2DUO and CORE i5) but all of them had crashes at random parts. I will continue to post my observations to the group along with a smaller reproducible code and the dataset. Thank you EJ On Sun, Jun 3, 2012 at 3:17 PM, peter dalgaard pda...@gmail.com wrote: On Jun 3, 2012, at 07:40 , Ebrahim Jahanshiri wrote: Dear list, My code runs on 2.14.1 smoothly (with no error) but makes R crash on 2.14.2 and 2.15.0 with the usual windows message about R for windows GUI front-end has stopped working... and as such I dont have any access to R to get any error or warning message (if any). It crashes on random parts of the code any time that I run it. The code consists of EDA and spatial regression and various loops and optimizations. The goal of the code is to perform a complete analysis on various datasets. Please take a look at the code here : https://sites.google.com/site/geosciej/Home/STAR_ter1.R?attredirects=0d=1 You are not likely to find people willing to debug 15553 lines of code for you, and they are certainly not going to do it by eye, without the datasets! One thing that jumps out is that you start off by loading five external packages, either of which might be the true owner of the problem. Even if the actual crash hits in the stats.dll, the underlying issue could well be memory corruption occurring some time earlier. Things to try: Run under Rterm in a command window instead of Rgui. That should at least tell you how far you got before the crash, maybe even a proper traceback. Carefully try disabling parts of the code until the issue goes away. The last item removed might hold the clue. If you can cut it down to something small(-ish) and reproducible, people might be in a better position to help you. Is it really a random crash, or does the crash point move every time you change the code slightly? If the former, you might have physical computer problems or you might be running close to your memory limit. -Peter D. It seems that the results that comes out of 2.15.0 is more valid for my work. I cant think of anything that makes the code crash on the latest versions. Here is the error message from windows: Problem Event Name: APPCRASH Application Name: Rgui.exe Application Version: 2.150.58871.0 Application Timestamp: 4f75a0ca Fault Module Name: stats.dll Fault Module Version: 2.150.58871.0 Fault Module Timestamp: 4f75a1c9 Exception Code: c005 Exception Offset: 000237c5 OS Version: 6.1.7601.2.1.0.256.48 Locale ID: 1033 Additional Information 1: 0a9e Additional Information 2: 0a9e372d3b4ad19135b953a78882e789 Additional Information 3: 0a9e Additional Information 4: 0a9e372d3b4ad19135b953a78882e789 I appreciate your help, Thank you Ebrahim Jahanshiri [[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. -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Email: pd@cbs.dk Priv: pda...@gmail.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.
Re: [R] R 15.0 Warning message.
On 03/06/2012 07:34, Jinyan Huang wrote: Dear list, I have install R15.0 on Ubuntu system using the source code. It is install to my home directory. I have no root privilege. When I start R, I got this warning message: During startup - Warning message: Setting LC_CTYPE failed, using C How can I fix this? You will need to ask once R 15.0 is released (sometime next century?). But in a released version of R, the problem would be your locale settings, so study the manual at e.g. http://cran.r-project.org/doc/manuals/R-admin.html#Internationalization Since you managed to install it, something is different in your environment now from when you installed R. Check your environment variables such as LC_ALL or LANG. A guess is that you have .utf8 where .UTF-8 is required, or v.v. Thanks. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. PLEASE do, and note what it says about R versions. -- Brian D. Ripley, rip...@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] fine control of plots after use of layout(matrix ...
Sir, I would like to create a combined line-bar plot, with the line up top and bar plot below, but with the x-axes suppressed on the topmost plot, the line and bar plot areas joined by a common line, and the x-axes (of dates) joined to the bottom part of the bar plot. i have been able to format the area using the layout(matrix( ... commands, but cannot figure out the final step. here's the code so far: layout(matrix(c(1,2), 2, 1, byrow=TRUE), widths=c(3,3), heights=c(2,1)) plot(saDwlPx[,1]) barplot(saDwlMoM[,1]) thanks + best regards matt johnson [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Add a dim to an array
Hello again, Sorry, I've misread your post and thought that you wanted the new dim to have 'low' and 'high' values. It's just 'low'. So dim=c(2, 2, 2, 1) and set dn$group to the first value only. And forget the final comments. Rui Barradas Em 03-06-2012 07:31, Rui Barradas escreveu: Hello, Try a3 - array(dim=c(2, 2, 2, 2)) dn - dimnames(a1) dn$group - c(low, high) dimnames(a3) - dn a3[] - a1 # to use [] keeps the dimensions a3 # it fills a3 recycling a1 (two copies) dim(a2) dim(a3) As you can see, 'a2' is not of the right dimensions, and 'a3' has now two copies of 'a1' but it's dimensions are right. There are ways of giving dimnames to 'a3' other than creating a new object, 'dn', but this one is a simple one. Hope this helps, Rui Barradas Em 02-06-2012 16:17, Patrick Hausmann escreveu: Dear list, I'm trying to add a new dim to a multidimensional array. My array looks like this a1 - array(1:8, c(2, 2, 2)) dimnames(a1) - list(A = c(A1, A2), B = c(B1, B2), D = c(D1, D2)) I would like to add a new dim 'group' with the value low. Right now I'm using this, but I think are better ways... a2 - as.data.frame(as.table(a1)) a2$group - low a2 - xtabs(Freq ~ A + B + D + group, data = a2) a2 Thanks for any help! Patrick __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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 15.0 Warning message.
Yes. I think it is my environment variables problem. But I donot know how to fix. echo $LC_ALL echo $LANG en_US.UTF-8 On Sun, Jun 3, 2012 at 4:07 PM, Prof Brian Ripley rip...@stats.ox.ac.uk wrote: LANG __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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 15.0 Warning message.
On 03/06/2012 09:27, Jinyan Huang wrote: Yes. I think it is my environment variables problem. But I donot know how to fix. That is described in the same manual. echo $LC_ALL echo $LANG en_US.UTF-8 On Sun, Jun 3, 2012 at 4:07 PM, Prof Brian Ripleyrip...@stats.ox.ac.uk wrote: LANG No, that's not what I wrote. The posting guide required you to quote the context, and excising it is a breach of the conditions under which you are allowed to copy the work of others. -- Brian D. Ripley, rip...@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] mtext bug
On 12-06-02 8:42 PM, Matthew Johnson wrote: Sir, I am now having a similar problem with the barplot: i cannot get the margin text to 'stick'. png(paste(drive, MoMUnit.png, sep=)) par(mar=c(10, 3, 2, 2), opar=(1,0,0,0)) I think opar is a typo. Duncan Murdoch mainnameUnit = expression(paste(MoM %, Delta, Apptmnt Prices, sep=)) ymin - min(percentDiff[,c(6, 9, 33, 36, seq(15,30,3), 3)]) -1 ymax - max(percentDiff[,c(6, 9, 33, 36, seq(15,30,3), 3)]) +1 barplot(percentDiff[,c(6, 9, 33, 36, seq(15,30,3), 3)], las=2, beside=T, ylim=c(ymin, ymax), legend.text=c(prior2m, prior1m, ee), main=mainnameUnit) mtext(stamp, cex=0.75, line=0, side=1, adj=1, outer=T) mtext(Source: ASX, cex=0.75, side=1, adj=0, outer=T) dev.off() i also have a few assorted issues that i cannot figure out -- i would like to remove the box around the bar plot, and add some intro text above the key, as i have done in the line plot case. thanks and best regards matt johnson On 3 June 2012 08:38, Matthew Johnson mcoog...@gmail.com mailto:mcoog...@gmail.com wrote: thanks very much - fixed. On 3 June 2012 08:26, Duncan Murdoch murdoch.dun...@gmail.com mailto:murdoch.dun...@gmail.com wrote: On 12-06-02 6:21 PM, Matthew Johnson wrote: Sir, I have hit a the limits of my understanding of text / par / opar etc... I have a few related xts data frames which have multiple columns, and have written a for-loop to make a set of charts - however i do not get any margin text when i run the loop. when i test the code outside of the loop the margin text appears - however when i run the loop the margin text does not appear ... what gives? You're calling par() before png(). Your par() settings will apply to the device that was active before you open the png() device, not to it. Duncan Murdoch here is the code for (col in 1:ncol(xdf)){ par(mar=c(3.5, 4.5, 2, 1), oma=c(2,0,0,0)) ymin = min(xdf[,col]) - 20 ymax = max(xdf[,col]) + 20 png(paste(drive, names(xdf)[col], '.png', sep=)) plot(coredata(yr09_10[,col]), type='l', ylim=c(ymin, ymax), col=1, lwd=2, las=1, xlab=, ylab=, xaxt='n', main=names(xdf)[col]) lines(coredata(yr10_11[,col]), col=2, lwd=2) lines(coredata(yr11_12[,col]), col=3, lwd=2) axis(1, at=c(1:365), labels=format(index(yr09_10), %d-%b), tck=0.01, las=1) legend(bottom, inset=0.02, title=Financial Years, c(09/10, 10/11, 11/12), col=c(1,2,3), lwd=3, horiz=TRUE, bty='n') mtext(stamp, cex=0.75, line=0, side=1, adj=1, outer=T) mtext(Source: ABS, cex=0.75, side=1, adj=0, outer=T) dev.off() } the charts are certainly re-made each time (i've checked this!) and they appear as desired, excepting the absence of the margin text. could anyone please help? tips on any other aspects of the above code are also very welcome. thanks and best regards matt johnson [[alternative HTML version deleted]] __ R-help@r-project.org mailto:R-help@r-project.org mailing list https://stat.ethz.ch/mailman/ listinfo/r-help https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/ posting-guide.html http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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 15.0 Warning message.
On Jun 3, 2012, at 10:27 , Jinyan Huang wrote: Yes. I think it is my environment variables problem. But I donot know how to fix. echo $LC_ALL echo $LANG en_US.UTF-8 On Sun, Jun 3, 2012 at 4:07 PM, Prof Brian Ripley rip...@stats.ox.ac.uk wrote: LANG First, use locale to check that the above is the full story. For finding the right locale, try starting R with, e.g. LANG=en_US.utf8 R or, for a more scientific approach, find your system locale database, usually /usr/share/locale, and look for a suitable name: pd$ ls -ld /usr/share/locale/en_US* drwxr-xr-x 8 root wheel 272 Sep 25 2010 /usr/share/locale/en_US drwxr-xr-x 8 root wheel 272 Sep 25 2010 /usr/share/locale/en_US.ISO8859-1 drwxr-xr-x 8 root wheel 272 Sep 25 2010 /usr/share/locale/en_US.ISO8859-15 drwxr-xr-x 8 root wheel 272 Sep 25 2010 /usr/share/locale/en_US.US-ASCII drwxr-xr-x 8 root wheel 272 Sep 25 2010 /usr/share/locale/en_US.UTF-8 so on a Mac like mine, en_US.UTF-8 should do just fine, but if you see .utf8, .UTF8, .utf-8, you'll have to adjust LANG accordingly. For a permanent fix, edit the appropriate startup file for your shell, probably .profile, cor maybe .bash_profile or .bashrc. -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Email: pd@cbs.dk Priv: pda...@gmail.com __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] R 15.0 Warning message.
locale locale: Cannot set LC_CTYPE to default locale: No such file or directory locale: Cannot set LC_ALL to default locale: No such file or directory LANG=en_US.UTF-8 LANGUAGE= LC_CTYPE=UTF-8 LC_NUMERIC=en_US.UTF-8 LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 LC_PAPER=en_US.UTF-8 LC_NAME=en_US.UTF-8 LC_ADDRESS=en_US.UTF-8 LC_TELEPHONE=en_US.UTF-8 LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=en_US.UTF-8 LC_ALL= ls -ld /usr/share/locale/en_US* drwxr-xr-x 2 root root 4096 Dec 15 15:19 /usr/share/locale/en_US __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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 15.0 Warning message.
On 03/06/2012 10:31, Jinyan Huang wrote: locale locale: Cannot set LC_CTYPE to default locale: No such file or directory locale: Cannot set LC_ALL to default locale: No such file or directory LANG=en_US.UTF-8 LANGUAGE= LC_CTYPE=UTF-8 That's wrong: see the manual I pointed you to! LC_NUMERIC=en_US.UTF-8 LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 LC_PAPER=en_US.UTF-8 LC_NAME=en_US.UTF-8 LC_ADDRESS=en_US.UTF-8 LC_TELEPHONE=en_US.UTF-8 LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=en_US.UTF-8 LC_ALL= ls -ld /usr/share/locale/en_US* drwxr-xr-x 2 root root 4096 Dec 15 15:19 /usr/share/locale/en_US This is clearly not an R issue: so ask your IT support for help. -- Brian D. Ripley, rip...@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] R 15.0 Warning message.
On Jun 3, 2012, at 11:36 , Prof Brian Ripley wrote: ls -ld /usr/share/locale/en_US* drwxr-xr-x 2 root root 4096 Dec 15 15:19 /usr/share/locale/en_US This is clearly not an R issue: so ask your IT support for help. Or check out the Ubuntu docs/forums for information on which package of configuration trick you might be missing to get UTF-8 locales properly installed. (Googling utf-8 ubuntu seem to come up with relevant stuff.) -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Email: pd@cbs.dk Priv: pda...@gmail.com __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] R 2.15.0 and 2.14.2 crash on the same code that runs on 2.14.1
On 03.06.2012 09:17 (UTC+2), peter dalgaard wrote: On Jun 3, 2012, at 07:40 , Ebrahim Jahanshiri wrote: Dear list, My code runs on 2.14.1 smoothly (with no error) but makes R crash on 2.14.2 and 2.15.0 with the usual windows message about R for windows GUI front-end has stopped working... and as such I dont have any access to R to get any error or warning message (if any). It crashes on random parts of the code any time that I run it. The code consists of EDA and spatial regression and various loops and optimizations. The goal of the code is to perform a complete analysis on various datasets. Please take a look at the code here : https://sites.google.com/site/geosciej/Home/STAR_ter1.R?attredirects=0d=1 You are not likely to find people willing to debug 15553 lines of code for you, and they are certainly not going to do it by eye, without the datasets! One thing that jumps out is that you start off by loading five external packages, either of which might be the true owner of the problem. Even if the actual crash hits in the stats.dll, the underlying issue could well be memory corruption occurring some time earlier. Things to try: Run under Rterm in a command window instead of Rgui. That should at least tell you how far you got before the crash, maybe even a proper traceback. Carefully try disabling parts of the code until the issue goes away. The last item removed might hold the clue. If you can cut it down to something small(-ish) and reproducible, people might be in a better position to help you. Is it really a random crash, or does the crash point move every time you change the code slightly? If the former, you might have physical computer problems or you might be running close to your memory limit. Just a guess: One more thing you could try is to rebuild your packages under 2.15.0. One often forgets to update them after a version change of R: update.packages(checkBuilt=TRUE, dependencies=TRUE, ask='graphics') Rainer Hurling -Peter D. It seems that the results that comes out of 2.15.0 is more valid for my work. I cant think of anything that makes the code crash on the latest versions. Here is the error message from windows: Problem Event Name: APPCRASH Application Name: Rgui.exe Application Version: 2.150.58871.0 Application Timestamp: 4f75a0ca Fault Module Name: stats.dll Fault Module Version: 2.150.58871.0 Fault Module Timestamp: 4f75a1c9 Exception Code: c005 Exception Offset: 000237c5 OS Version: 6.1.7601.2.1.0.256.48 Locale ID: 1033 Additional Information 1: 0a9e Additional Information 2: 0a9e372d3b4ad19135b953a78882e789 Additional Information 3: 0a9e Additional Information 4: 0a9e372d3b4ad19135b953a78882e789 I appreciate your help, Thank you Ebrahim Jahanshiri __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] community finding in a graph and heatplot
The problem is that your graph is unconnected, it has two components and the as.dendrogram() function in igraph cannot handle that. fastgreedy.community() returns a matrix of merges that is not a complete dendrogram, the final top level merge of the components is missing. A workaround is to modify the result of fastgreedy.community and add the missing row to the merges matrix, before calling as.dendrogram(). G. On Thu, May 31, 2012 at 7:42 PM, Aziz, Muhammad Fayez az...@illinois.edu wrote: Thank you so much Gabor for taking this on. Please find attached a sample scenario with the problem of malfunctioning dendogram by fgc. I hope this helps you narrow down to the solution. Best, Fayez From: csardi.ga...@gmail.com [csardi.ga...@gmail.com] on behalf of Gábor Csárdi [csa...@rmki.kfki.hu] Sent: Thursday, May 31, 2012 4:23 PM To: Aziz, Muhammad Fayez Cc: r-help@r-project.org Subject: Re: [R] community finding in a graph and heatplot On Thu, May 31, 2012 at 12:08 PM, Aziz, Muhammad Fayez az...@illinois.edu wrote: Thank you so much Gabor for your reply. I had spotted your post earlier and it worked like a charm. Interestingly I have just ran into a trouble with the stament dend - igraph:::as.dendrogram.igraph.walktrap(fc). Apparently the members are empty as when I print(dend) it says 'dendrogram' with 2 branches and members total, at height 93 while the error with using dend with dendrapply remians to be Error in `[[.dendrogram`(X, 2L) : attempt to set an attribute on NULL Any ideas? I would need to see fgc for this. Can you send it to me in private? Or send some self-contained example that generates the same error? Gabor My code looks like this File2Open = paste(FilePath, NetworkFiles\\net\\, NetPrefix, , TPPostfix, .net, sep = ) g - read.graph(File2Open, format=pajek) g - delete.isolates(g) g - simplify(g) fgc - fastgreedy.community(g, modularity=TRUE, weights = E(g)$weight) ModularityIndexfgc - max(fgc$modularity) # fgc modularity ModularityIndexng - modularity(g, membership, weights = E(g)$weight) # newman-girvan modularity dend - igraph:::as.dendrogram.igraph.walktrap(fgc) png(filename = paste(FilePath, Analysis\\Graphs\\EColiStressModuleHeatMap, NetPrefixAbbr, TPPostfix, .png, sep = ), width = 800, height = 800) # heat map is square adjMatrix = get.adjacency(g, attr=weight) DendNodeCounter - 0 # counter for ColorGroupsOrdered ColorGroupsOrdered - rep(red, vcount(g)) dendrapply(dend, colLab) # modifies ColorGroupsOrdered From: csardi.ga...@gmail.com [csardi.ga...@gmail.com] on behalf of Gábor Csárdi [csa...@rmki.kfki.hu] Sent: Thursday, May 31, 2012 10:45 AM To: Aziz, Muhammad Fayez Cc: r-help@r-project.org Subject: Re: [R] community finding in a graph and heatplot On Tue, May 29, 2012 at 1:16 AM, Aziz, Muhammad Fayez az...@illinois.edu wrote: Hi everyone, I am using the fastgreedy.community function to get the $merges matrix and the $modularity vector. This serves my purpose of testing modularity of my graph. But I am greedy to plot the heat map and dendrrogram based on the $merges dendogram matrix. I know that heatplot does the graphics part but I am not sure if the dendogram generated by the heatplot will match the one given by fastgreedy.community in all cases and that the heat map will represent the same clustering. No, they are different. To plot fast-greedy results as a dendrogram, see this and the follow-ups: http://lists.gnu.org/archive/html/igraph-help/2010-11/msg00059.html Gabor Tell me if my apprehension is incorrect. Otherwise please let me know of any alternatives. Here is the code I am testing so far: # http://igraph.sourceforge.net/doc/R/modularity.html # http://igraph.sourceforge.net/doc/R/fastgreedy.community.html # http://igraph.sourceforge.net/doc/R/graph.constructors.html library(igraph) library(made4) g - graph(c(1,2, 2,3, 3,1, 4,5)-1, , FALSE) print(g) ModuleInfo - fastgreedy.community(g) print(ModuleInfo) heatplot(c(1,2, 2,3, 3,1, 4,5)) Thanks Fayez Grad student UIUC IL, USA [[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. -- Gabor Csardi csa...@rmki.kfki.hu MTA KFKI RMKI -- Gabor Csardi csa...@rmki.kfki.hu MTA KFKI RMKI -- Gabor Csardi csa...@rmki.kfki.hu MTA KFKI RMKI __ R-help@r-project.org mailing list
Re: [R] R 2.15.0 and 2.14.2 crash on the same code that runs on 2.14.1
Since this appears to be Windows (not explicitly said), the likely change is the compilers used for R = 2.14.2 differ from those used for 2.14.1. The posting guide does ask for 'at a minimum' information with good reason. How big the change was depends on whether this was 32- or 64-bit Windows. Unfortunately there are a lot of badly written packages out there which write in memory they should not. As time goes on compilers get better at optimizing, and that means they are better at keeping things in places in memory close to hand that are more liable to get clobbered. The only really effective way to find such things is to use valgrind, and that means to use Linux (or perhaps Mac OS X, but that's flaky and with a lot more overhead than on Linux). See R CMD check --use-valgrind. And of course a new compiler may have a new set of bugs: but so far we've uncovered about 50 errors in packages and none in the compiler. On 03/06/2012 14:46, Rainer Hurling wrote: On 03.06.2012 09:17 (UTC+2), peter dalgaard wrote: On Jun 3, 2012, at 07:40 , Ebrahim Jahanshiri wrote: Dear list, My code runs on 2.14.1 smoothly (with no error) but makes R crash on 2.14.2 and 2.15.0 with the usual windows message about R for windows GUI front-end has stopped working... and as such I dont have any access to R to get any error or warning message (if any). It crashes on random parts of the code any time that I run it. The code consists of EDA and spatial regression and various loops and optimizations. The goal of the code is to perform a complete analysis on various datasets. Please take a look at the code here : https://sites.google.com/site/geosciej/Home/STAR_ter1.R?attredirects=0d=1 You are not likely to find people willing to debug 15553 lines of code for you, and they are certainly not going to do it by eye, without the datasets! One thing that jumps out is that you start off by loading five external packages, either of which might be the true owner of the problem. Even if the actual crash hits in the stats.dll, the underlying issue could well be memory corruption occurring some time earlier. Things to try: Run under Rterm in a command window instead of Rgui. That should at least tell you how far you got before the crash, maybe even a proper traceback. Carefully try disabling parts of the code until the issue goes away. The last item removed might hold the clue. If you can cut it down to something small(-ish) and reproducible, people might be in a better position to help you. Is it really a random crash, or does the crash point move every time you change the code slightly? If the former, you might have physical computer problems or you might be running close to your memory limit. Just a guess: One more thing you could try is to rebuild your packages under 2.15.0. One often forgets to update them after a version change of R: update.packages(checkBuilt=TRUE, dependencies=TRUE, ask='graphics') Rainer Hurling -Peter D. It seems that the results that comes out of 2.15.0 is more valid for my work. I cant think of anything that makes the code crash on the latest versions. Here is the error message from windows: Problem Event Name: APPCRASH Application Name: Rgui.exe Application Version: 2.150.58871.0 Application Timestamp: 4f75a0ca Fault Module Name: stats.dll Fault Module Version: 2.150.58871.0 Fault Module Timestamp: 4f75a1c9 Exception Code: c005 Exception Offset: 000237c5 OS Version: 6.1.7601.2.1.0.256.48 Locale ID: 1033 Additional Information 1: 0a9e Additional Information 2: 0a9e372d3b4ad19135b953a78882e789 Additional Information 3: 0a9e Additional Information 4: 0a9e372d3b4ad19135b953a78882e789 I appreciate your help, Thank you Ebrahim Jahanshiri __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Brian D. Ripley, rip...@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] About Plot.new
Perhaps not at all, since you are posting to the R-help list rather than to the original poster of the question. You also forgot to quote the original question as the posting guide asks you to do. Uwe Ligges On 03.06.2012 08:12, czar wrote: @mr.parashar4 - If this not resolved yet, here is what can help plot.new is trying to create a new object out of the standard point plot. I believe you have not created a standard point plot, i.e. in your case, plot(xm,ym). This will show the graphical plot window. Keep that window open and then run your given command. If you have already defined plot(), then just keep that window open. That is when R will find the object and go ahead with the further commands over the plot you specify. Hope this helps. -- View this message in context: http://r.789695.n4.nabble.com/About-Plot-new-tp866862p4632196.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] Modify pdf file with Illustrator.
On 03.06.2012 08:42, Jinyan Huang wrote: Dear list, Some times I want to modify the pdf file which produced by R with illustrator. But when I use Illustrator open the pdf file, it often makes the pdf some little changed. Anyone have some suggestions? Is it better to use other file type, not pdf? Or when I produced the pdf, I should set some other parameters? Questions are: 1. Why do you need to modify it, perhaps you don't. 2. What dio you want to do with the file in later steps? Perhaps a format with a representation in a more human readable form helps... Best, Uwe Ligges Thank you __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Partial R-square in multiple linear regression
On 01.06.2012 21:05, Jin Choi wrote: Hello, I am trying to obtain the partial r-square values (r^2 or R2) for individual predictors of an outcome variable in multiple linear regression. I am using the 'lm' function to calculate the beta coefficients, however, I would like to know the individual % contributions of several indepenent variables. I tried searching for this function in many R packages, but it has proven elusive to me. I am an R beginner, and I am hoping that I will find a solution! summary(lm(...)) calculates the R^2. See ?summary.lm Uwe Ligges Thank you very much. Sincerely, Jin Choi MSc Epidemiology student McGill University, Montreal, Quebec, CANADA __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Modify pdf file with Illustrator.
Thank you. 1, I want to put some text and title. Then put several figures into one. On Sun, Jun 3, 2012 at 10:59 PM, Uwe Ligges lig...@statistik.tu-dortmund.de wrote: On 03.06.2012 08:42, Jinyan Huang wrote: Dear list, Some times I want to modify the pdf file which produced by R with illustrator. But when I use Illustrator open the pdf file, it often makes the pdf some little changed. Anyone have some suggestions? Is it better to use other file type, not pdf? Or when I produced the pdf, I should set some other parameters? Questions are: 1. Why do you need to modify it, perhaps you don't. 2. What dio you want to do with the file in later steps? Perhaps a format with a representation in a more human readable form helps... Best, Uwe Ligges Thank you __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Compare data between two groups/countries on 5-point Likert scale questionnare?
This is the R-help mailing list. It is not a statistical consulting list nor the others write my thesis list. On 02.06.2012 14:56, Frankfoot wrote: Hi everyone, I'm stuck on my dissertation which is due next week. Interesting. The question given below should arise two years before the dissertation is due (actually, at the time when you planned the questionnaire). Otherwise I'm interested to hear which university accepts theses where the analysis chapters can be written within a week and the evaluation and analysis of questionnaires is not planned in advance. Uwe Ligges I'm a business major student and my project is a comparative research on corporate social responsibility (CSR) between Chinese and German firms. According to my literature review, it's quite obvious that German firms have much better CSR initiatives and strategies than the Chinese ones and I wanted to test whether it was true by sending out Likert-scale questionnaires to Chinese and German firms through bankers in my family. I have already got 24 responses from the Chinese and 27 from the Germans and it looked quite evident that the hypothesis is correct. Now that I am writing my analysis chapter, I am lost as I don't know which is the best way to analyse my data after trying to find a solution for days. Basically, my questionnaire is structured in this way: Q1 - Q5: statements on environment-oriented CSR Q6 - Q10: statements on workplace-oriented CSR Q11 - Q15: statements on community-oriented CSR Q16-Q20: statements on market-oriented CSR All of the statements are 5-pt Likert questions. I initially planed to compare the grouped mean values for each of the above section but I know that it's not scientific. So can someone give me any advice on which kind of tests is most suitable for my research? As you can see, my sample size is quite small. I really appreciate your time! -- View this message in context: http://r.789695.n4.nabble.com/Compare-data-between-two-groups-countries-on-5-point-Likert-scale-questionnare-tp4632163.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] Modify pdf file with Illustrator.
On 03.06.2012 17:03, Jinyan Huang wrote: Thank you. 1, I want to put some text and title. Then put several figures into one. So just do it within R and use title() within R and use par() and its argument mfrow to arrange several figures in rows and columns. Uwe Ligges On Sun, Jun 3, 2012 at 10:59 PM, Uwe Ligges lig...@statistik.tu-dortmund.de wrote: On 03.06.2012 08:42, Jinyan Huang wrote: Dear list, Some times I want to modify the pdf file which produced by R with illustrator. But when I use Illustrator open the pdf file, it often makes the pdf some little changed. Anyone have some suggestions? Is it better to use other file type, not pdf? Or when I produced the pdf, I should set some other parameters? Questions are: 1. Why do you need to modify it, perhaps you don't. 2. What dio you want to do with the file in later steps? Perhaps a format with a representation in a more human readable form helps... Best, Uwe Ligges Thank you __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Memory-random forest
On 02.06.2012 16:11, MYRIAM TABASSO wrote: Hi all, I am working with random forest on the large data set( 39). I have a warning message : In matrix(integer(nrnodes * nt), ncol = nt) : Reached total allocation of 3766Mb: see help(memory.size). Can you have any suggestions? Use anther methods that can deal with such huge amounts of data. Uwe Ligges Thanks, Myriam [[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 make a transaction class data?
On 01.06.2012 20:08, jasminedawn wrote: Hi, I have encounter a problem that my data a_data.frame is of data.frame class with columns: sequenceID, eventID, items. when I convert it to transaction class: as(a_data.frame, transactions) All columns are grouped together under items, which is like this: {sequenceID, eventID, items} instead of the right form: sequenceID, eventID, {items} Also when i read_baskets, there is always an error: Error in readLines(con) : 'con' is not a connection Can anyone help me with the problem? Thanks very much! Read the posting guide and provide reproducible examples so that people can help. Uwe Ligges -- View this message in context: http://r.789695.n4.nabble.com/How-to-make-a-transaction-class-data-tp4632114.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] Partial R-square in multiple linear regression
On Jun 3, 2012, at 17:00 , Uwe Ligges wrote: On 01.06.2012 21:05, Jin Choi wrote: Hello, I am trying to obtain the partial r-square values (r^2 or R2) for individual predictors of an outcome variable in multiple linear regression. I am using the 'lm' function to calculate the beta coefficients, however, I would like to know the individual % contributions of several indepenent variables. I tried searching for this function in many R packages, but it has proven elusive to me. I am an R beginner, and I am hoping that I will find a solution! summary(lm(...)) calculates the R^2. See ?summary.lm The question was about _partial_ R^2. There is such a thing and it would be calculated as SS_term/(SS_term+SS_error) where SS_term is the sum of squares of the kind you'd get from drop1(). For single quantitative terms, as far as I can tell this is the square of the partial correlation obtained by regression of y-residuals on x-residuals, removing effects of all other terms in the model. However, that is not a partitioning of the full R^2. The partial R-squares do not sum or otherwise combine to give that number. Rather, it is just a transformation of the F-statistic for the relevant term. Uwe Ligges Thank you very much. Sincerely, Jin Choi MSc Epidemiology student McGill University, Montreal, Quebec, CANADA __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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. -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Email: pd@cbs.dk Priv: pda...@gmail.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] Regions of significance plots with ggplot2
I'd like to create a plot similar to this one from Kochanska et al. (Development and Psychopathology, 2011): http://pages.videotron.com/do999/r-help/Kochanska_graph_ros.jpg http://pages.videotron.com/do999/r-help/Kochanska_graph_ros.jpg I am new to ggplot2 and can't see any obvious way to create distinct coloured regions for the background, nor can I find any relevant examples. Any guidance appreciated. DC PS: The context is practically the same as the one from the image (Gene x Environment interaction study). I used the following tool to find the regions of significance, if this is of interest to anyone: http://www.quantpsy.org/interact/mlr2 http://www.quantpsy.org/interact/mlr2 [[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] Problems installing Packages
Hello, I am going through Zhao's RDataMining PDF, and to redo all the graphics on my computer, I need several packages, 'coin' and 'party' to name two. I get the following error: install.packages(coin) Installing package(s) into ‘/home/sven/R/i686-pc-linux-gnu-library/2.15’ (as ‘lib’ is unspecified) trying URL 'http://cran.ma.imperial.ac.uk/src/contrib/coin_1.0-21.tar.gz' Content type 'application/x-gzip' length 903944 bytes (882 Kb) opened URL == downloaded 882 Kb * installing *source* package ‘coin’ ... ** package ‘coin’ successfully unpacked and MD5 sums checked ** libs gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -O3 -pipe -g -c Classes.c -o Classes.o gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -O3 -pipe -g -c Helpers.c -o Helpers.o gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -O3 -pipe -g -c LinearStatistic.c -o LinearStatistic.o gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -O3 -pipe -g -c StreitbergRoehmel.c -o StreitbergRoehmel.o gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -O3 -pipe -g -c vandeWiel.c -o vandeWiel.o gcc -std=gnu99 -shared -o coin.so Classes.o Helpers.o LinearStatistic.o StreitbergRoehmel.o vandeWiel.o -lblas -lgfortran -lm -L/usr/lib/R/lib -lR /usr/bin/ld: cannot find -lblas collect2: ld returned 1 exit status make: *** [coin.so] Error 1 ERROR: compilation failed for package ‘coin’ * removing ‘/home/sven/R/i686-pc-linux-gnu-library/2.15/coin’ Warning in install.packages : installation of package ‘coin’ had non-zero exit status The downloaded source packages are in ‘/tmp/RtmpYPqZgS/downloaded_packages’ My system session info is as follows: R version 2.15.0 (2012-03-30) Platform: i686-pc-linux-gnu (32-bit) locale: [1] LC_CTYPE=en_GB.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_GB.UTF-8LC_COLLATE=en_GB.UTF-8 [5] LC_MONETARY=en_GB.UTF-8LC_MESSAGES=en_GB.UTF-8 [7] LC_PAPER=C LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods [7] base loaded via a namespace (and not attached): [1] tools_2.15.0 I do not have a problem loading it on my windows PC. Anyone having similar experience, and perhaps know the solution? Furthermore, package 'RHTMLForms' from Omegahat I could only install on the ubuntu computer and not on the windows computer. Anyone know the reason why? Perhaps this is not even an R question, but any hint would be great. Thanks Sven -- View this message in context: http://r.789695.n4.nabble.com/Problems-installing-Packages-tp4632217.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] How can I export a paired t-test output table to an excel file?
If you wish to use the table in a write-up or something like this, there is a package for exporting to MS Word - see http://cran.r-project.org/web/packages/R2wd/index.html http://cran.r-project.org/web/packages/R2wd/index.html and these examples http://thebiobucket.blogspot.co.at/2012/04/reproducible-research-export-regression.html http://thebiobucket.blogspot.co.at/2012/04/reproducible-research-export-regression.html . You could also copy-paste it to excel from there.. Yours, Kay -- View this message in context: http://r.789695.n4.nabble.com/How-can-I-export-a-paired-t-test-output-table-to-an-excel-file-tp4632162p4632218.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] pre-clinical results analysis in R using the function 'aov'
Hi. I hope someone could help me with my question. I have clinical scores of a longitudinal study: 4 treatments. In each treatment j there are nj different subjects that were measured few times (of course for each subject the measurements are dependent during time). I want to check it with ANOVA for repeated measurements and then go PostHoc tests. Should I use the R function 'aov'? What should be its parameters and especially the model grammar? What format should I use for the data file (Groups(=Treatments), Subjects, TimePoints, Scores). Thank you very much, Amit. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Bug in truncgof package?
Dear Carlos, Duncan and everyone You may have already sorted the matter by now, but since I have not seen anything posted since Duncan's reply, here I go. I apologize in advance for the spam, if it turns out I've missed some post. I think the test and the implementation of the truncgof package are just fine. I've done Carlos' experiment (repeatedly generating samples and testing them with AD) and the test never rejected the null hypothesis. @Carlos: in the first piece of code you are using ad.test ( ad.test(xt, plnorm, list(meanlog = 2, sdlog = 2), H = 10)), but in the function that you are later defining for iteration purposes, you are use the KS test ( ks.test(xt, plnorm, list(meanlog = 2, sdlog = 2), H = 10)$p.value)... This may have something to do with the contradictory results that you thought you were getting. Cheers Andreea Carlos J. Gil Bellosta wrote: Dear R-helpers, I was testing the truncgof CRAN package, found something that looked like a bug, and did my job: contacted the maintainer. But he did not reply, so I am resending my query here. I installed package truncgof and run the example for function ad.test. I got the following output: set.seed(123) treshold - 10 xc - rlnorm(100, 2, 2)# complete sample xt - xc[xc = treshold]# left truncated sample ad.test(xt, plnorm, list(meanlog = 2, sdlog = 2), H = 10) Supremum Class Anderson-Darling Test data: xt AD = 3.124, p-value = 0.12 alternative hypothesis: two.sided treshold = 10, simulations: 100 So I cannot reject the hipothesis (at a standard confidence level) that the original sample comes from a lognormal distribution (as it is the case). But let us try to iterate on this example: set.seed( 123 ) treshold - 10 foo - function(){ xc - rlnorm(100, 2, 2) # complete sample xt - xc[xc = treshold] # left truncated sample ks.test(xt, plnorm, list(meanlog = 2, sdlog = 2), H = 10)$p.value } results - replicate( 100, foo() ) Then: table( results ) results 0 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.1 0.11 0.16 0.18 0.19 0.2 257931234112211 32 0.21 0.22 0.26 0.27 0.28 0.3 0.31 0.32 0.33 0.36 0.38 0.4 0.44 0.49 0.54 0.55 22131211121211 21 0.56 0.57 0.62 0.7 0.76 0.78 0.96 0.98 12111111 This is, in a 45% of the cases, you would reject the H_0 hypothesis, which happens to be true, at the 5% standard confidence level. That looks to me that the test as implemented is not very good. This could be an implementation bug, but it could also be a limitation of the test itself. I don't know the theory underlying this particular test, but a way to determine it is in implementation bug is to carefully implement the test and see if you got the same answer. Duncan Murdoch Do you think this behaviour is buggy? If so, given that the maintainer does not seem to be contactable, what would be the next step to take? Best regards, Carlos J. Gil Bellosta http://www.datanalytics.com __ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- -- Andreea Picu Communication Systems Research Group, ETH Zurich Web: http://www.csg.ethz.ch/people/apicu Office: ETZ G 96, Gloriastrasse 35, 8092 Zurich Phone: +41 44 632 6894 Fax: +41 44 632 1035 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] a question about subsetting
Hi all, I started using R about 3 weeks ago, and now I've pretty much figured out how to do the types of statistical modeling, graphs, tables etc. that I frequently use (with zero background in computer languages or other statistical packages that are similar to R like S or SAS!). So it's been a quite rewarding process so far, and I thank you all R gurus for all your generous help! That being said, my question is about applying a model or an analysis to different groups based on a grouping variable. Below is the first six rows of my data: ID Group1 Group2 Mem Gen Chance MSELGM MSELVR MSELFM MSELRL MSELEL ADOS Age 1 1 1 1 75 50.0 50 53 52 62 57 56 3 25 2 2 1 1 75 12.5 50 46 48 47 52 55 2 30 3 3 1 1 25 37.5 50 48 43 52 63 63 3 24 4 4 1 1 25 37.5 50 51 62 52 59 54 0 31 5 5 1 1 50 87.5 50 45 58 42 46 43 6 31 6 6 1 1 100 100.0 50 45 80 49 69 63 1 31 Group1: First grouping variable Group2: Second grouping variable Mem: Memory trial Gen: Generalization trial MSEL: Mullen Scales of Early Learning (a scale measuring various skills in little children). GM: Gross Motor Scale, VR: Visual Reception, FM: Fine Motor, RL: receptive Language, EL: Expressive Language. ADOS: An autism-specific measure. First I wanted to do correlations between Generalization (variable Gen) and expressive language (MSELEL) for each group of Group1. For this, I used lapply or by functions which work just fine. Here is the code with lapply: lapply(split(mydata, mydata$Group1), function(x){cor.test(x[,5], x[,11], method = pearson)}) Then I did regression. My DV is the variable Gen, and the IV is MSELEL. And again I wanted to do this for each group. Here is the code I came up with for each group: fit1-lm(Gen~ MSELEL, data=mydata, subset=mydata$Group1==1) fit2-lm(Gen~MSELEL, data=mydata, subset=mydata$Group1==2) This works fine for regression, but when I used the subset function with the correlation (e.g. cor.test (mydata$Gen, mydata$MSELEL, method=pearson, subset=mydata$Group1==1) , it did not work. It just did the correlation for the entire group and then used this for both groups. I was just curious as to why subset function works with regression, but not with correlation. Any thoughts? Thanks, [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] plotting evolution of dates
Dear R users, I have the following problem I have a panel data across countries and individuals. For each country I have a sequence of dates For France for example 22/02/09 22/03/09 19/04/09 17/05/09 12/07/09 09/08/09 06/09/09 04/10/09 01/11/09 29/11/09 27/12/09 31/01/10 For Italy 14/06/09 12/07/09 09/08/09 06/09/09 04/10/09 01/11/09 29/11/09 27/12/09 31/01/10 28/02/10 28/03/10 The structure of the MS excel file is the following France Italy.. 22/02/09 14/06/09 22/03/09 12/7/2009 19/04/09 9/8/2009 17/05/096/9/2009 12/7/2009 4/10/2009 09/08/09 01/11/09 6/9/200929/11/09 4/10/2009 27/12/09 01/11/09 31/01/10 29/11/09 28/02/10 27/12/09 28/03/10 31/01/10 I want to plot (in one graph) these sequences of dates in the sense that I want to have a visual contact of the behaviour of each of these 2 sequences because as you can see I do not have the same start date and end date for each country and each next date is not always every other 28 days. So the difference between 2 successive dates is not always 28 days but 35 is some cases or otherwise. Put differently, I have jumps. I would like to visualize these characteristics of the series of dates by making a plot similar to http://i46.tinypic.com/2h7gpvn.png But this is not enough. I want to measure the distance between 2 successive knots (the difference between 2 successive dates) and note on the plot the number of weeks that separate apart the successive knots-dates Something like http://www.survey-design.com.au/stripplot3.png where as you can see between the knots there are some red lines. In my case these red lines would inform the reader about the number of weeks between successive knots-dates I need a specific code for this because a simple hint will not help me as I am a new R user. Thank you all __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Multiple imputation, multinomial response random effects
Dear R-group, Could somebody recommend a package that can deal with a multinomial response variable (choice of breeding tactic in mice, which has four unordered levels), multiply-imputed data (generated using the Amelia package) and two non-nested random effects: individual identity (133 individuals made up to four choices each) and year (for which there are six levels and sample size varies between years)? I've tried sabreR, drm, mixcat and mlogit but none of them seem able to accommodate multiply-imputed datasets. The most promising package Ive found so far is Zelig, which can handle multiply-imputed data and either multinomial responses OR random effects (but seemingly not both). I could randomly select one case per individual and run the following model (with year as a fixed rather than random effect): z.out - zelig(as.factor(tactic) ~ mass+age+year, model = mlogit, data = a.out$imputations) but it probably isn't the most elegant solution. Does anybody have any suggestions? Thanks in advance, Davina -- Animal, Plant and Environmental Sciences University of the Witwatersrand South Africa htmlpfont face = verdana size = 0.8 color = navyThis communication is intended for the addressee only. It is confidential. If you have received this communication in error, please notify us immediately and destroy the original message. You may not copy or disseminate this communication without the permission of the University. Only authorized signatories are competent to enter into agreements on behalf of the University and recipients are thus advised that the content of this message may not be legally binding on the University and may contain the personal views and opinions of the author, which are not necessarily the views and opinions of The University of the Witwatersrand, Johannesburg. All agreements between the University and outsiders are subject to South African Law unless the University agrees in writing to the contrary./font/p/html [[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] reduced variate in R
Dear R users, is there a way in R to calculate normal reduced variate?? 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.
Re: [R] Adding a column into the file
On Jun 1, 2012, at 4:08 PM, David Winsemius wrote: On Jun 1, 2012, at 12:27 PM, pigpigmeow wrote: Dear all, I have a lot of problems on R-programming. for example my csv. file is .. That certainly does not look like any csv file I have ever seen. Date wrfRH wrfsolar wrfwindspeed wrfrain wrftd wrfta 21/10/2010 92.97 22.11 53.27 0 1546.337861 61.00852664 i calculate the ratio of wrfRH/wrfsolar for each day. If you are confused in your terminology, and you really have a data.frame created by read.table, then adding a column to an existing data.frame , say the ratio of wrftd divided by wrfta, is really simple: dfrm$ratio - with dfrm, wrftd/wrfta) And that of course should have been : dfrm$ratio - with( dfrm, wrftd/wrfta) -- David Winsemius, MD West Hartford, CT __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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 question about subsetting
Hi jacaranda, Try with(subset(mydata, Group1 == 1), cor.test(Gen, MSELEL, method = pearson)) HTH, Jorge.- On Sun, Jun 3, 2012 at 11:51 AM, jacaranda tree wrote: Hi all, I started using R about 3 weeks ago, and now I've pretty much figured out how to do the types of statistical modeling, graphs, tables etc. that I frequently use (with zero background in computer languages or other statistical packages that are similar to R like S or SAS!). So it's been a quite rewarding process so far, and I thank you all R gurus for all your generous help! That being said, my question is about applying a model or an analysis to different groups based on a grouping variable. Below is the first six rows of my data: ID Group1 Group2 Mem Gen Chance MSELGM MSELVR MSELFM MSELRL MSELEL ADOS Age 1 1 1 175 50.0 50 53 5262 5756325 2 2 1 175 12.5 50 46 4847 5255230 3 3 1 125 37.5 50 48 4352 6363324 4 4 1 125 37.5 50 51 6252 5954031 5 5 1 150 87.5 50 45 5842 4643631 6 6 1 1 100100.0 50 45 8049 6963131 Group1: First grouping variable Group2: Second grouping variable Mem: Memory trial Gen: Generalization trial MSEL: Mullen Scales of Early Learning (a scale measuring various skills in little children). GM: Gross Motor Scale, VR: Visual Reception, FM: Fine Motor, RL: receptive Language, EL: Expressive Language. ADOS: An autism-specific measure. First I wanted to do correlations between Generalization (variable Gen) and expressive language (MSELEL) for each group of Group1. For this, I used lapply or by functions which work just fine. Here is the code with lapply: lapply(split(mydata, mydata$Group1), function(x){cor.test(x[,5], x[,11], method = pearson)}) Then I did regression. My DV is the variable Gen, and the IV is MSELEL. And again I wanted to do this for each group. Here is the code I came up with for each group: fit1-lm(Gen~ MSELEL, data=mydata, subset=mydata$Group1==1) fit2-lm(Gen~MSELEL, data=mydata, subset=mydata$Group1==2) This works fine for regression, but when I used the subset function with the correlation (e.g. cor.test (mydata$Gen, mydata$MSELEL, method=pearson, subset=mydata$Group1==1) , it did not work. It just did the correlation for the entire group and then used this for both groups. I was just curious as to why subset function works with regression, but not with correlation. Any thoughts? Thanks, [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Log-normal probability plot
On Jun 2, 2012, at 9:38 PM, eliza botto wrote: You might consider the strategy of reading the Posting Guide, followed by posting an intelligible message. Dear R users, You can literally safe my life my telling me the solution of my problem. I have created matrix of a data frame with 3 columns, with each column representing data of different year. 2 ...snipped useless srting of numbers mangled by mailer processing of HTML. 4 I now want to plot Lognormal probability plot of each column data against its respective normal reduced variante(z). Normal reduced variate? What is that? Is it a set of numbers that have been centered and scaled, also known as a z-transform? If so, I do not think it should affect the results of a probability plot since it is just a linear transformation and the theoretical quantiles will be unaffected. You might look at qqplot() How to do that? If you dont know the answer, consider me dead. What greater lifesaving project are you trying to accomplish, other than getting homework done? [[alternative HTML version deleted]] -- David Winsemius, MD West Hartford, CT __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] reduced variate in R
On Jun 3, 2012, at 17:57 , eliza botto wrote: Dear R users, is there a way in R to calculate normal reduced variate?? Yes. It depends on what you mean, though. AFAICT reduced is just what others call standard normal (mean 0, variance 1), so rnorm(n, 0, 1) is one answer; z - (X - mu)/s is another. -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Email: pd@cbs.dk Priv: pda...@gmail.com __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] reduced variate in R
thankyou very much for answer. i want to calculate normal reduced variate of a matix consisting of 366 rows and 92 columns. how can i do that?? please reply if you know the answer.. eliza Subject: Re: [R] reduced variate in R From: pda...@gmail.com Date: Sun, 3 Jun 2012 19:11:55 +0200 CC: r-help@r-project.org To: eliza_bo...@hotmail.com On Jun 3, 2012, at 17:57 , eliza botto wrote: Dear R users, is there a way in R to calculate normal reduced variate?? Yes. It depends on what you mean, though. AFAICT reduced is just what others call standard normal (mean 0, variance 1), so rnorm(n, 0, 1) is one answer; z - (X - mu)/s is another. -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Email: pd@cbs.dk Priv: pda...@gmail.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.
Re: [R] reduced variate in R
Hello, Try scale(x) Half of homework done. The other half is to have a quick look at R-intro.pdf, it comes with every installation of R. Chapters 8 and 12. Hope this helps, Rui Barradas Em 03-06-2012 18:15, eliza botto escreveu: thankyou very much for answer. i want to calculate normal reduced variate of a matix consisting of 366 rows and 92 columns. how can i do that?? please reply if you know the answer.. eliza Subject: Re: [R] reduced variate in R From: pda...@gmail.com Date: Sun, 3 Jun 2012 19:11:55 +0200 CC: r-help@r-project.org To: eliza_bo...@hotmail.com On Jun 3, 2012, at 17:57 , eliza botto wrote: Dear R users, is there a way in R to calculate normal reduced variate?? Yes. It depends on what you mean, though. AFAICT reduced is just what others call standard normal (mean 0, variance 1), so rnorm(n, 0, 1) is one answer; z- (X - mu)/s is another. -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Email: pd@cbs.dk Priv: pda...@gmail.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] mgcv (bam) very large standard error difference between versions 1.7-11 and 1.7-17, bug?
Dear useRs, I've ran some additional analyses (see below), which strongly suggest the standard errors of the bam (and gam) function are much too low in mgcv version 1.7-17, at least when including an s(X,bs=re) term. Until this issue has been clarified, it's perhaps best to use an older version of mgcv (unfortunately, however, in earlier versions the p-value calculation of s(X,bs=re) is not correct). All analyses were conducted in R 2.15.0. My approach was the following: I created a mixed-effects regression model with a single random intercept and only linear predictors. In my view, the results using lmer (lme4) should be comparable to those of bam and gam (mgcv). This was the case when using an older version of mgcv (version 1.7-13), but this is not the case anymore in version 1.7-17. In version 1.7-17, the standard errors and p-values are much lower and very similar to those of a linear model (which does not take the random-effects structure into account). The R-code and results are shown below. (The results using gam are not shown, but show the same pattern.) Furthermore, note that the differences in standard errors become less severe (but still noticeable) when less data is involved (e.g., using only 500 rows as opposed to 100.000). Finally, when not including an s(X,bs=re) term, but another non-random-effect smooth, the standard errors do not appear to be structurally lower (only for some variables, but not by a great deal - see also below). With kind regards, Martijn Wieling University of Groningen lme4 model (most recent version of lme4) modelLMER - lmer(RefPMIdistMeanLog.c ~ SpYearBirth.z*IsAragon + SpIsMale + (1|Key), data=wrddst) #Estimate Std. Error t value #SpYearBirth.z -0.012084 0.004577 -2.640 #IsAragon0.138959 0.010040 13.840 #SpIsMale -0.003087 0.008290 -0.372 #SpYearBirth.z:IsAragon 0.015429 0.010159 1.519 mgcv 1.7-13, default (method = REML) - almost identical to modelLMER modelBAMold - bam(RefPMIdistMeanLog.c ~ SpYearBirth.z*IsAragon + SpIsMale + s(Key,bs=re), data=wrddst) #Estimate Std. Error t value Pr(|t|) #SpYearBirth.z -0.012084 0.004578 -2.640 0.00829 ** #IsAragon0.138959 0.010042 13.838 2e-16 *** #SpIsMale -0.003087 0.008292 -0.372 0.70968 #SpYearBirth.z:IsAragon 0.015429 0.010160 1.519 0.12886 mgcv 1.7-17, method = REML - standard errors greatly reduced # (comparable to standard errors of LM without random intercept) modelBAMnew - bam(RefPMIdistMeanLog.c ~ SpYearBirth.z*IsAragon + SpIsMale + s(Key,bs=re), data=wrddst); print(testje,cor=F) #Estimate Std. Error t value Pr(|t|) #SpYearBirth.z -0.012084 0.001159 -10.428 2e-16 *** #IsAragon0.138959 0.002551 54.472 2e-16 *** #SpIsMale -0.003087 0.002098 -1.4710.141 #SpYearBirth.z:IsAragon 0.015429 0.002587 5.965 2.45e-09 *** lm results, standard errors comparable to mgcv 1.7-17 modelLM - lm(RefPMIdistMeanLog.c ~ SpYearBirth.z*IsAragon + SpIsMale, data=wrddst) #Estimate Std. Error t value Pr(|t|) #(Intercept)-0.025779 0.001653 -15.595 2e-16 *** #SpYearBirth.z -0.011906 0.001182 -10.070 2e-16 *** #IsAragon0.139323 0.002603 53.531 2e-16 *** #SpIsMale -0.003076 0.002140 -1.4370.151 #SpYearBirth.z:IsAragon 0.015252 0.002639 5.780 7.49e-09 *** mgcv 1.7-17, default (method = fREML) - completely different from previous models modelBAMfREML - bam(RefPMIdistMeanLog.c ~ SpYearBirth.z*IsAragon + SpIsMale + s(Key,bs=re), data=wrddst); print(testje,cor=F) #Estimate Std. Error t value Pr(|t|) #(Intercept)-0.025391 0.106897 -0.2380.812 #SpYearBirth.z -0.012084 0.076300 -0.1580.874 #IsAragon0.138959 0.166697 0.8340.405 #SpIsMale -0.003087 0.138291 -0.0220.982 #SpYearBirth.z:IsAragon 0.015429 0.168260 0.0920.927 # #Approximate significance of smooth terms: # edf Ref.df F p-value #s(Key) -38.95310 15.67 2e-16 *** differences w.r.t. standard smooths mgcv version 1.7-13 m2old - bam(RefPMIdistMeanLog.c ~ s(GeoX,GeoY) + SpYearBirth.z*IsAragon + SpIsMale, data=wrddst, method=REML) ## RESULTS #Family: gaussian #Link function: identity # #Formula: #RefPMIdistMeanLog.c ~ s(GeoX, GeoY) + SpYearBirth.z * IsAragon + #SpIsMale # #Parametric coefficients: #Estimate Std. Error t value Pr(|t|) #(Intercept)-0.001386 0.004982 -0.278 0.7809 #SpYearBirth.z -0.012950 0.001167 -11.097 2e-16 *** #IsAragon0.020532 0.023608 0.870 0.3845 #SpIsMale -0.004788 0.002219 -2.158 0.0309 * #SpYearBirth.z:IsAragon 0.015611 0.002600 6.005 1.92e-09 *** #--- #Signif. codes:
Re: [R] Problems installing Packages
The error says you are missing the BLAS library... so install it? --- Jeff NewmillerThe . . Go Live... DCN:jdnew...@dcn.davis.ca.usBasics: ##.#. ##.#. 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. Sven D sd...@hotmail.com wrote: Hello, I am going through Zhao's RDataMining PDF, and to redo all the graphics on my computer, I need several packages, 'coin' and 'party' to name two. I get the following error: install.packages(coin) Installing package(s) into ‘/home/sven/R/i686-pc-linux-gnu-library/2.15’ (as ‘lib’ is unspecified) trying URL 'http://cran.ma.imperial.ac.uk/src/contrib/coin_1.0-21.tar.gz' Content type 'application/x-gzip' length 903944 bytes (882 Kb) opened URL == downloaded 882 Kb * installing *source* package ‘coin’ ... ** package ‘coin’ successfully unpacked and MD5 sums checked ** libs gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -O3 -pipe -g -c Classes.c -o Classes.o gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -O3 -pipe -g -c Helpers.c -o Helpers.o gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -O3 -pipe -g -c LinearStatistic.c -o LinearStatistic.o gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -O3 -pipe -g -c StreitbergRoehmel.c -o StreitbergRoehmel.o gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -O3 -pipe -g -c vandeWiel.c -o vandeWiel.o gcc -std=gnu99 -shared -o coin.so Classes.o Helpers.o LinearStatistic.o StreitbergRoehmel.o vandeWiel.o -lblas -lgfortran -lm -L/usr/lib/R/lib -lR /usr/bin/ld: cannot find -lblas collect2: ld returned 1 exit status make: *** [coin.so] Error 1 ERROR: compilation failed for package ‘coin’ * removing ‘/home/sven/R/i686-pc-linux-gnu-library/2.15/coin’ Warning in install.packages : installation of package ‘coin’ had non-zero exit status The downloaded source packages are in ‘/tmp/RtmpYPqZgS/downloaded_packages’ My system session info is as follows: R version 2.15.0 (2012-03-30) Platform: i686-pc-linux-gnu (32-bit) locale: [1] LC_CTYPE=en_GB.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_GB.UTF-8LC_COLLATE=en_GB.UTF-8 [5] LC_MONETARY=en_GB.UTF-8LC_MESSAGES=en_GB.UTF-8 [7] LC_PAPER=C LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods [7] base loaded via a namespace (and not attached): [1] tools_2.15.0 I do not have a problem loading it on my windows PC. Anyone having similar experience, and perhaps know the solution? Furthermore, package 'RHTMLForms' from Omegahat I could only install on the ubuntu computer and not on the windows computer. Anyone know the reason why? Perhaps this is not even an R question, but any hint would be great. Thanks Sven -- View this message in context: http://r.789695.n4.nabble.com/Problems-installing-Packages-tp4632217.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] memory usage benefit from anonymous variable constructions.
This is an I was just wondering question. When the package dataframe was announced, the author claimed to reduce the number of times a data frame was copied, I started to wonder if I should care about this in my projects. Has anybody written a general guide for how to write R code that doesn't needlessly exhaust RAM? In Objective-C, we used to gain some considerable advantages by avoiding declaring objects separately, using anonymous variable instead. The storage was allocated on the stack, I think, and I think there was talk that the numbers might stay 'closer' to the CPU (register?) for immediate usage. Does this benefit in R as well? For example, instead of the way I would usually do this: mf - model.frame(model) y - model.response(mf) Here is the anonymous alternative, mf is never declared y - model.response(model.frame(model)) On the face of it, I can imagine this might be better because no permanent thing mf is created, the garbage collector wouldn't be called into play if all the data is local and disappears immediately. But, then again, R is doing lots of stuff under the hood that I've never bothered to learn about. pj -- Paul E. Johnson Professor, Political Science Assoc. Director 1541 Lilac Lane, Room 504 Center for Research Methods University of Kansas University of Kansas http://pj.freefaculty.org http://quant.ku.edu __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Partial R-square in multiple linear regression
On Fri, Jun 1, 2012 at 2:05 PM, Jin Choi oohps...@gmail.com wrote: Hello, I am trying to obtain the partial r-square values (r^2 or R2) for individual predictors of an outcome variable in multiple linear regression. I am using the 'lm' function to calculate the beta coefficients, however, I would like to know the individual % contributions of several indepenent variables. I tried searching for this function in many R packages, but it has proven elusive to me. I am an R beginner, and I am hoping that I will find a solution! Thank you very much. Sincerely, This is the kind of practical user request I've been trying to answer in the rockchalk package. I have a function called getDeltaRsquare. It takes a fitted regression and calculates the change in Rsquare when each variable is removed. It does not achieve the Partition idea for Rsquare that you might want because there is no logically meaningful way to partition Rsquare among predictors if there is any multicollinearity. I could point you at some stat books that try to achieve that partition, mostly they seem to be by psychologists (who like that kind of thing.) You will go down a rabbit hole of semi-partial correlation coefficients and so forth. But if you just want the how much does R-square drop if I leave out this variable, I got that for you :) Whether that is meaningful to you, well, that's a bigger methodological question. pj Jin Choi MSc Epidemiology student McGill University, Montreal, Quebec, CANADA __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Paul E. Johnson Professor, Political Science Assoc. Director 1541 Lilac Lane, Room 504 Center for Research Methods University of Kansas University of Kansas http://pj.freefaculty.org http://quant.ku.edu __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] merging single column from different dataframe
Hi all, probably really simple to solve, but having no background in programming I haven't been able to figure this out: I have two dataframes like df1 - data.frame(names1=c('aa','ab', 'ac', 'ad'), var1=c(1,5,7,12)) df2 - data.frame(names2=c('aa', 'ab', 'ac', 'ad', 'ae'), var2=c(3,6,9,12,15)) Now I want merge var1 to df2 by matching the dataframes by the 'names' columns, i.e. something like df3 - merge (df2, df1, by.x='names2', by.y='names1', all.x=T) However, the original dataframes have quite a lot of columns and I thought that I should be able to address the var1 column by something like df1$var[[df2$name2]]. Could somebody please enlighten me and/or maybe suggest a short tutorial for the extraction operator? Thanks! Best, Kai [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] plotting evolution of dates
On Jun 3, 2012, at 9:27 AM, stef salvez wrote: Dear R users, I have the following problem I have a panel data across countries and individuals. For each country I have a sequence of dates For France for example 22/02/09 22/03/09 19/04/09 17/05/09 12/07/09 09/08/09 06/09/09 04/10/09 01/11/09 29/11/09 27/12/09 31/01/10 For Italy 14/06/09 12/07/09 09/08/09 06/09/09 04/10/09 01/11/09 29/11/09 27/12/09 31/01/10 28/02/10 28/03/10 The structure of the MS excel file is the following France Italy.. 22/02/09 14/06/09 22/03/09 12/7/2009 19/04/09 9/8/2009 17/05/096/9/2009 12/7/2009 4/10/2009 09/08/09 01/11/09 6/9/200929/11/09 4/10/2009 27/12/09 01/11/09 31/01/10 29/11/09 28/02/10 27/12/09 28/03/10 31/01/10 I want to plot (in one graph) these sequences of dates in the sense that I want to have a visual contact of the behaviour of each of these 2 sequences because as you can see I do not have the same start date and end date for each country and each next date is not always every other 28 days. So the difference between 2 successive dates is not always 28 days but 35 is some cases or otherwise. Put differently, I have jumps. I would like to visualize these characteristics of the series of dates by making a plot similar to http://i46.tinypic.com/2h7gpvn.png That looks like an ordinary R plot and the fact that you might want jumps suggests you might want to use the s line type. Or you might be talking about gaps. Hard to tell without specific examples. Look at ?plot.default and ?par for information on the 'lty' parameter. You should be converting your dates to 'Date' class vectors so that they have the proper numeric distance. You would also get Date formating with the axis calls. Italy - scan(what=character) 1: 14/06/09 2: 12/07/09 3: 09/08/09 4: 06/09/09 5: 04/10/09 6: 01/11/09 7: 29/11/09 8: 27/12/09 9: 31/01/10 10: 28/02/10 11: 28/03/10 12: Read 11 items Italy.Dt - as.Date(Italy, format=%d/%m/%y) Italy.Dt [1] 2009-06-14 2009-07-12 2009-08-09 2009-09-06 2009-10-04 2009-11-01 2009-11-29 [8] 2009-12-27 2010-01-31 2010-02-28 2010-03-28 But this is not enough. Well, in many ways you are already asking too much, since you have provided no sample dataset in a form that can be readily pasted into a console session. There are Wiki entries on importing Excel data that you should be able to find without too much difficulty. You are expected to do quite a bit of self-study and to post your coding efforts. A lot of people have spent a lot of time over the years in putting material in the R-wiki, their own blogs and of course the Contributed materials at CRAN. I want to measure the distance between 2 successive knots (the difference between 2 successive dates) and note on the plot the number of weeks that separate apart the successive knots-dates Something like http://www.survey-design.com.au/stripplot3.png That reminds me a bit of a type of plot called something like beehive plot. There have been implementations in R and searching he archives would be the way to go. It's still not exactly clear how the stacking of interim observations should be specified. Again, with no data object (and please, please, do not offer console-print()ed output) , not much more coding can be suggested. where as you can see between the knots there are some red lines. In my case these red lines would inform the reader about the number of weeks between successive knots-dates Whatever that actually means ... I need a specific code for this because a simple hint will not help me as I am a new R user. That's _not_ the implicit agreement that you committed to when you posted to Rhelp. Please read the Posting Guide.. again? This is not a tutorial website. -- David Winsemius, MD West Hartford, CT __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] merging single column from different dataframe
Hello, One way, with limited applicability, would be df4 - cbind(df2, var1=NA) df4$var1[ df2$names2 %in% df1$names1 ] - df1$var1 df4 Limited because it doesn't resist to duplicate key values (the columns names1/2). But with unique keys it should be much more efficient, speed- and memory-wise. Much, much more. There is also package data.table, designed for this type of problem. As for the extraction operator, there is An Introduction to R, R-intro.pdf, in the doc directory of your R installation. And several others on-line, on CRAN, for instance. (Your example wouldn't work, df2$names2 are the values of that variable, not row indexes. See df2[[ names2 ]].) Hope this helps, Rui Barradas Em 03-06-2012 20:22, Kai Mx escreveu: Hi all, probably really simple to solve, but having no background in programming I haven't been able to figure this out: I have two dataframes like df1- data.frame(names1=c('aa','ab', 'ac', 'ad'), var1=c(1,5,7,12)) df2- data.frame(names2=c('aa', 'ab', 'ac', 'ad', 'ae'), var2=c(3,6,9,12,15)) Now I want merge var1 to df2 by matching the dataframes by the 'names' columns, i.e. something like df3- merge (df2, df1, by.x='names2', by.y='names1', all.x=T) However, the original dataframes have quite a lot of columns and I thought that I should be able to address the var1 column by something like df1$var[[df2$name2]]. Could somebody please enlighten me and/or maybe suggest a short tutorial for the extraction operator? Thanks! Best, Kai [[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] community finding in a graph and heatplot
Hmm interesting. To come to think of it there could be many disconnected components in the graph and thus there should be a generic way to either mitigate the disconnectedness in the dendrogram or in the original graph. I had no luck in finding such a trick though google search. I then ran the script on minute-scale graphs and have following results: 1) disconnected graph with three modules: *Vertices 9 *Edges 1 2 1 2 3 1 3 1 1 4 5 1 5 6 1 6 4 1 7 8 1 8 9 1 9 7 1 corresponding fgc$merges matrix: [,1] [,2] [1,]10 [2,]29 [3,]76 [4,]8 11 [5,]43 [6,]5 13 2) connected graph by adding links 1-2 and 4-7 in graph 1): *Vertices 9 *Edges 1 2 1 2 3 1 3 1 1 4 5 1 5 6 1 6 4 1 7 8 1 8 9 1 9 7 1 1 4 1 4 7 1 corresponding fgc$merges matrix: [,1] [,2] [1,]21 [2,]09 [3,]87 [4,]6 11 [5,]54 [6,]3 13 [7,] 14 12 [8,] 15 10 There needs to be a generic way to get fgc$merges of the form 2) from 1). Hints please. Thank you so much Gabor for your help so far and marvelous job in identifying the problem. Best, Fayez From: csardi.ga...@gmail.com [csardi.ga...@gmail.com] on behalf of Gábor Csárdi [csa...@rmki.kfki.hu] Sent: Sunday, June 03, 2012 8:56 AM To: Aziz, Muhammad Fayez Cc: r-help@r-project.org; Caetano-Anolles, Gustavo Subject: Re: [R] community finding in a graph and heatplot The problem is that your graph is unconnected, it has two components and the as.dendrogram() function in igraph cannot handle that. fastgreedy.community() returns a matrix of merges that is not a complete dendrogram, the final top level merge of the components is missing. A workaround is to modify the result of fastgreedy.community and add the missing row to the merges matrix, before calling as.dendrogram(). G. On Thu, May 31, 2012 at 7:42 PM, Aziz, Muhammad Fayez az...@illinois.edu wrote: Thank you so much Gabor for taking this on. Please find attached a sample scenario with the problem of malfunctioning dendogram by fgc. I hope this helps you narrow down to the solution. Best, Fayez From: csardi.ga...@gmail.com [csardi.ga...@gmail.com] on behalf of Gábor Csárdi [csa...@rmki.kfki.hu] Sent: Thursday, May 31, 2012 4:23 PM To: Aziz, Muhammad Fayez Cc: r-help@r-project.org Subject: Re: [R] community finding in a graph and heatplot On Thu, May 31, 2012 at 12:08 PM, Aziz, Muhammad Fayez az...@illinois.edu wrote: Thank you so much Gabor for your reply. I had spotted your post earlier and it worked like a charm. Interestingly I have just ran into a trouble with the stament dend - igraph:::as.dendrogram.igraph.walktrap(fc). Apparently the members are empty as when I print(dend) it says 'dendrogram' with 2 branches and members total, at height 93 while the error with using dend with dendrapply remians to be Error in `[[.dendrogram`(X, 2L) : attempt to set an attribute on NULL Any ideas? I would need to see fgc for this. Can you send it to me in private? Or send some self-contained example that generates the same error? Gabor My code looks like this File2Open = paste(FilePath, NetworkFiles\\net\\, NetPrefix, , TPPostfix, .net, sep = ) g - read.graph(File2Open, format=pajek) g - delete.isolates(g) g - simplify(g) fgc - fastgreedy.community(g, modularity=TRUE, weights = E(g)$weight) ModularityIndexfgc - max(fgc$modularity) # fgc modularity ModularityIndexng - modularity(g, membership, weights = E(g)$weight) # newman-girvan modularity dend - igraph:::as.dendrogram.igraph.walktrap(fgc) png(filename = paste(FilePath, Analysis\\Graphs\\EColiStressModuleHeatMap, NetPrefixAbbr, TPPostfix, .png, sep = ), width = 800, height = 800) # heat map is square adjMatrix = get.adjacency(g, attr=weight) DendNodeCounter - 0 # counter for ColorGroupsOrdered ColorGroupsOrdered - rep(red, vcount(g)) dendrapply(dend, colLab) # modifies ColorGroupsOrdered From: csardi.ga...@gmail.com [csardi.ga...@gmail.com] on behalf of Gábor Csárdi [csa...@rmki.kfki.hu] Sent: Thursday, May 31, 2012 10:45 AM To: Aziz, Muhammad Fayez Cc: r-help@r-project.org Subject: Re: [R] community finding in a graph and heatplot On Tue, May 29, 2012 at 1:16 AM, Aziz, Muhammad Fayez az...@illinois.edu wrote: Hi everyone, I am using the fastgreedy.community function to get the $merges matrix and the $modularity vector. This serves my purpose of testing modularity of my graph. But I am greedy to plot the heat map and dendrrogram based on the $merges dendogram matrix. I know that heatplot does the graphics part but I am not sure if the dendogram generated by the heatplot will match
Re: [R] fine control of plots after use of layout(matrix ...
On Sun, Jun 3, 2012 at 4:05 PM, Matthew Johnson mcoog...@gmail.com wrote: Thanks. So i can call par after the layout command? I did not realise. Some par options are set by calling par() directly, while others must be included in the plot command itself. Sarah Sent from my iPad On 03/06/2012, at 9:42 PM, Sarah Goslee sarah.gos...@gmail.com wrote: On Sunday, June 3, 2012, Matthew Johnson wrote: Sir, I'm no sir, but you need to spend some quality time reading ?par to lean abot axes and margins. Sarah I would like to create a combined line-bar plot, with the line up top and bar plot below, but with the x-axes suppressed on the topmost plot, the line and bar plot areas joined by a common line, and the x-axes (of dates) joined to the bottom part of the bar plot. i have been able to format the area using the layout(matrix( ... commands, but cannot figure out the final step. here's the code so far: layout(matrix(c(1,2), 2, 1, byrow=TRUE), widths=c(3,3), heights=c(2,1)) plot(saDwlPx[,1]) barplot(saDwlMoM[,1]) thanks + best regards matt johnson -- Sarah Goslee http://www.stringpage.com http://www.sarahgoslee.com http://www.functionaldiversity.org -- Sarah Goslee http://www.functionaldiversity.org __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] package grid: mirror grob objects along an axis
My question was answered off list by Paul Murrell, author of 'grid'. Here's am excerpt of our email exchange for the records of R-help. Paul Murrell In some special cases, you would be able to flip shapes. If the coordinates of the shapes are given in native coordinates, then you could reverse the scales on the viewport that you are drawing in. However, there is no general flip operation in 'grid'. Especially not with respect to text. Text is always left-to-right and sized using absolute units (points [modulo cex multipliers]). If you really desperately needed to do something like this, a last resort might be to draw the required scene in hi-res raster format. You could then easily flip the raster and draw that. Thomas Zumbrunn I was actually asking the question primarily because I wanted to flip text grobs... If you really desperately needed to do something like this, a last resort might be to draw the required scene in hi-res raster format. You could then easily flip the raster and draw that. That's exactly what I did as a workaround, but I was hoping that there is a more elegant solution - especially since reading in and drawing hi-res raster format images slows down the execution time of my code quite considerably. What about converting text into paths? Could one do this in R? Then one could use your suggested solution of reversing the scales of the viewport. Paul Murrell Interesting idea. You could do that using the 'grImport'. Something like ... library(grid) postscript(test.ps) grid.text(test) dev.off() library(grImport) PostScriptTrace(test.ps, test.xml) test - readPicture(test.xml) # To check the scales on the picture # test@summary grid.picture(test, yscale=c(4400, 4000), xscale=c(2936.84, 3019.76)) On Tuesday 22 May 2012, Thomas Zumbrunn wrote: Hi everyone I'd like to flip grobs (grid graphical objects) along an axis, e.g. flip grobs horizontally or vertically. I couldn't find any hints, neither in the documentation nor by searching the web. Does anybody know how to achieve this? Cheers /thomas __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] merging single column from different dataframe
On Jun 3, 2012, at 3:22 PM, Kai Mx wrote: Hi all, probably really simple to solve, but having no background in programming I haven't been able to figure this out: I have two dataframes like df1 - data.frame(names1=c('aa','ab', 'ac', 'ad'), var1=c(1,5,7,12)) df2 - data.frame(names2=c('aa', 'ab', 'ac', 'ad', 'ae'), var2=c(3,6,9,12,15)) Now I want merge var1 to df2 by matching the dataframes by the 'names' columns, i.e. something like df3 - merge (df2, df1, by.x='names2', by.y='names1', all.x=T) However, the original dataframes have quite a lot of columns and I thought that I should be able to address the var1 column by something like df1$var[[df2$name2]]. Well there is no df1$var object or even a column with that reference. Even if you meant to type `var1`, the object df1$var[[df2$name2]] would not make much sense, since that would still be a failed attempt to access an named vector and df1$var1 is not named. names( df1$var1) NULL The [[ operation is different than the [ operation. [[ returns only one item. [ returns multiple items. In the case of dataframes (of which df1$var1 is _not_ an example) , [[ returns one entire column as a vector. If you had been trying to access a named vector using the 'names' in the character vector df1$names1 and there were any matches then you might have had some success with '['. Even then there are gators in the swamp. vec1 - c(aa=3, gx =10, ac=4, cc = 12) vec1[df1$names1] aa gx ac cc 3 10 4 12 WTF? Well, by default R's dataframes construct factor variables for character arguments and have an underlying numeric representation, so by the time df1$names got coerced it ended up as 1,2,3,4 and referenced all of vec1. These other methods would return something appropriate: vec1[as.character(df1$names1)] aa NA ac NA 3 NA4 NA vec1[which(names(vec1) %in% df1$names1)] aa ac 3 4 I happen to think that returning NA is unfortunate in the first inatance, but I did not construct the language and there must have been some good reason to make it that way. Could somebody please enlighten me and/or maybe suggest a short tutorial for the extraction operator? Arguments to [ can be numeric, character, or logical. If numeric, it will return values at the sequence locations along the referenced object. If character, it will return the matched items with those names. if logical, the call will return those items for which the index is TRUE (and there will be argument recycling, so this will return every second item in df1$var1 df1$var1[c(FALSE, TRUE)] [1] 5 12 Spend some time working through the examples on ?Extract and then re- reading that help page at least three times, although I probably took me ten or twenty times to get a pretty good grasp of it. The material there is accurate and precise, but the subtleties are numerous. -- David Winsemius, MD West Hartford, CT __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Dummies guide to getting HPC working on R
R-folks: Sorry for the cross-posting, but I wanted to share a link to a (fairly long) blog post I created which tries to take the mystery out of getting R setup for doing high performance/parallel computing if you have to compile R from scratch: http://lostingeospace.blogspot.com/2012/06/r-and-hpc-blas-mpi-in-linux-environment.html Let me know if you have any comments/corrections on it. Cheers! --j -- Jonathan A. Greenberg, PhD Assistant Professor Department of Geography and Geographic Information Science University of Illinois at Urbana-Champaign 607 South Mathews Avenue, MC 150 Urbana, IL 61801 Phone: 415-763-5476 AIM: jgrn307, MSN: jgrn...@hotmail.com, Gchat: jgrn307, Skype: jgrn3007 http://www.geog.illinois.edu/people/JonathanGreenberg.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] fine control of plots after use of layout(matrix ...
Thanks. The solution i have been persuing is reading Murrell - and trying to figure out grid / Viewport commands. Is it best to stay in the base graphics package if possible? Sent from my iPad On 04/06/2012, at 6:20 AM, Sarah Goslee sarah.gos...@gmail.com wrote: On Sun, Jun 3, 2012 at 4:05 PM, Matthew Johnson mcoog...@gmail.com wrote: Thanks. So i can call par after the layout command? I did not realise. Some par options are set by calling par() directly, while others must be included in the plot command itself. Sarah Sent from my iPad On 03/06/2012, at 9:42 PM, Sarah Goslee sarah.gos...@gmail.com wrote: On Sunday, June 3, 2012, Matthew Johnson wrote: Sir, I'm no sir, but you need to spend some quality time reading ?par to lean abot axes and margins. Sarah I would like to create a combined line-bar plot, with the line up top and bar plot below, but with the x-axes suppressed on the topmost plot, the line and bar plot areas joined by a common line, and the x-axes (of dates) joined to the bottom part of the bar plot. i have been able to format the area using the layout(matrix( ... commands, but cannot figure out the final step. here's the code so far: layout(matrix(c(1,2), 2, 1, byrow=TRUE), widths=c(3,3), heights=c(2,1)) plot(saDwlPx[,1]) barplot(saDwlMoM[,1]) thanks + best regards matt johnson -- Sarah Goslee http://www.stringpage.com http://www.sarahgoslee.com http://www.functionaldiversity.org -- Sarah Goslee http://www.functionaldiversity.org __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] fine control of plots after use of layout(matrix ...
On Sun, Jun 3, 2012 at 5:02 PM, Matthew Johnson mcoog...@gmail.com wrote: Thanks. The solution i have been persuing is reading Murrell - and trying to figure out grid / Viewport commands. Is it best to stay in the base graphics package if possible? It really depends on what you need to do. Your original example used plot, so I went with par. Murrell's explanation of par() options is also very good. Sarah On 04/06/2012, at 6:20 AM, Sarah Goslee sarah.gos...@gmail.com wrote: On Sun, Jun 3, 2012 at 4:05 PM, Matthew Johnson mcoog...@gmail.com wrote: Thanks. So i can call par after the layout command? I did not realise. Some par options are set by calling par() directly, while others must be included in the plot command itself. Sarah Sent from my iPad On 03/06/2012, at 9:42 PM, Sarah Goslee sarah.gos...@gmail.com wrote: On Sunday, June 3, 2012, Matthew Johnson wrote: Sir, I'm no sir, but you need to spend some quality time reading ?par to lean abot axes and margins. Sarah I would like to create a combined line-bar plot, with the line up top and bar plot below, but with the x-axes suppressed on the topmost plot, the line and bar plot areas joined by a common line, and the x-axes (of dates) joined to the bottom part of the bar plot. i have been able to format the area using the layout(matrix( ... commands, but cannot figure out the final step. here's the code so far: layout(matrix(c(1,2), 2, 1, byrow=TRUE), widths=c(3,3), heights=c(2,1)) plot(saDwlPx[,1]) barplot(saDwlMoM[,1]) thanks + best regards matt johnson -- Sarah Goslee http://www.sarahgoslee.com __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] package grid: mirror grob objects along an axis
Hi, Another option that you might want to try is the tikzDevice package; tikz has functions to flip and rotate objects and could it from R with tikzAnnotate / tikzAnnotateGrob. Of course these objects would not really be grobs but tikz code, though for text the end result would probably be the same. Cheers, baptiste On 4 June 2012 08:22, Thomas Zumbrunn t.zumbr...@unibas.ch wrote: My question was answered off list by Paul Murrell, author of 'grid'. Here's am excerpt of our email exchange for the records of R-help. Paul Murrell In some special cases, you would be able to flip shapes. If the coordinates of the shapes are given in native coordinates, then you could reverse the scales on the viewport that you are drawing in. However, there is no general flip operation in 'grid'. Especially not with respect to text. Text is always left-to-right and sized using absolute units (points [modulo cex multipliers]). If you really desperately needed to do something like this, a last resort might be to draw the required scene in hi-res raster format. You could then easily flip the raster and draw that. Thomas Zumbrunn I was actually asking the question primarily because I wanted to flip text grobs... If you really desperately needed to do something like this, a last resort might be to draw the required scene in hi-res raster format. You could then easily flip the raster and draw that. That's exactly what I did as a workaround, but I was hoping that there is a more elegant solution - especially since reading in and drawing hi-res raster format images slows down the execution time of my code quite considerably. What about converting text into paths? Could one do this in R? Then one could use your suggested solution of reversing the scales of the viewport. Paul Murrell Interesting idea. You could do that using the 'grImport'. Something like ... library(grid) postscript(test.ps) grid.text(test) dev.off() library(grImport) PostScriptTrace(test.ps, test.xml) test - readPicture(test.xml) # To check the scales on the picture # test@summary grid.picture(test, yscale=c(4400, 4000), xscale=c(2936.84, 3019.76)) On Tuesday 22 May 2012, Thomas Zumbrunn wrote: Hi everyone I'd like to flip grobs (grid graphical objects) along an axis, e.g. flip grobs horizontally or vertically. I couldn't find any hints, neither in the documentation nor by searching the web. Does anybody know how to achieve this? Cheers /thomas __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] fine control of plots after use of layout(matrix ...
Thank you. Sent from my iPad On 04/06/2012, at 7:12 AM, Sarah Goslee sarah.gos...@gmail.com wrote: On Sun, Jun 3, 2012 at 5:02 PM, Matthew Johnson mcoog...@gmail.com wrote: Thanks. The solution i have been persuing is reading Murrell - and trying to figure out grid / Viewport commands. Is it best to stay in the base graphics package if possible? It really depends on what you need to do. Your original example used plot, so I went with par. Murrell's explanation of par() options is also very good. Sarah On 04/06/2012, at 6:20 AM, Sarah Goslee sarah.gos...@gmail.com wrote: On Sun, Jun 3, 2012 at 4:05 PM, Matthew Johnson mcoog...@gmail.com wrote: Thanks. So i can call par after the layout command? I did not realise. Some par options are set by calling par() directly, while others must be included in the plot command itself. Sarah Sent from my iPad On 03/06/2012, at 9:42 PM, Sarah Goslee sarah.gos...@gmail.com wrote: On Sunday, June 3, 2012, Matthew Johnson wrote: Sir, I'm no sir, but you need to spend some quality time reading ?par to lean abot axes and margins. Sarah I would like to create a combined line-bar plot, with the line up top and bar plot below, but with the x-axes suppressed on the topmost plot, the line and bar plot areas joined by a common line, and the x-axes (of dates) joined to the bottom part of the bar plot. i have been able to format the area using the layout(matrix( ... commands, but cannot figure out the final step. here's the code so far: layout(matrix(c(1,2), 2, 1, byrow=TRUE), widths=c(3,3), heights=c(2,1)) plot(saDwlPx[,1]) barplot(saDwlMoM[,1]) thanks + best regards matt johnson -- Sarah Goslee http://www.sarahgoslee.com __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Problems installing Packages
I'm not really an expert on BLAS-y things, but wouldn't there be more problems upstream with R if it weren't able to find the local BLAS? I was under the impression that R shipped it's own BLAS but could also be directed to one at compile time -- either way, I would guess that many other would break if the whole BLAS went missing for whatever reason. to Sven: Did you use a repository build or compile it yourself? And did you touch the BLAS or R's linker flags? Best, Michael On Sun, Jun 3, 2012 at 1:46 PM, Jeff Newmiller jdnew...@dcn.davis.ca.us wrote: The error says you are missing the BLAS library... so install it? --- Jeff Newmiller The . . Go Live... DCN:jdnew...@dcn.davis.ca.us Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/Batteries O.O#. #.O#. with /Software/Embedded Controllers) .OO#. .OO#. rocks...1k --- Sent from my phone. Please excuse my brevity. Sven D sd...@hotmail.com wrote: Hello, I am going through Zhao's RDataMining PDF, and to redo all the graphics on my computer, I need several packages, 'coin' and 'party' to name two. I get the following error: install.packages(coin) Installing package(s) into ‘/home/sven/R/i686-pc-linux-gnu-library/2.15’ (as ‘lib’ is unspecified) trying URL 'http://cran.ma.imperial.ac.uk/src/contrib/coin_1.0-21.tar.gz' Content type 'application/x-gzip' length 903944 bytes (882 Kb) opened URL == downloaded 882 Kb * installing *source* package ‘coin’ ... ** package ‘coin’ successfully unpacked and MD5 sums checked ** libs gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -O3 -pipe -g -c Classes.c -o Classes.o gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -O3 -pipe -g -c Helpers.c -o Helpers.o gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -O3 -pipe -g -c LinearStatistic.c -o LinearStatistic.o gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -O3 -pipe -g -c StreitbergRoehmel.c -o StreitbergRoehmel.o gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -O3 -pipe -g -c vandeWiel.c -o vandeWiel.o gcc -std=gnu99 -shared -o coin.so Classes.o Helpers.o LinearStatistic.o StreitbergRoehmel.o vandeWiel.o -lblas -lgfortran -lm -L/usr/lib/R/lib -lR /usr/bin/ld: cannot find -lblas collect2: ld returned 1 exit status make: *** [coin.so] Error 1 ERROR: compilation failed for package ‘coin’ * removing ‘/home/sven/R/i686-pc-linux-gnu-library/2.15/coin’ Warning in install.packages : installation of package ‘coin’ had non-zero exit status The downloaded source packages are in ‘/tmp/RtmpYPqZgS/downloaded_packages’ My system session info is as follows: R version 2.15.0 (2012-03-30) Platform: i686-pc-linux-gnu (32-bit) locale: [1] LC_CTYPE=en_GB.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_GB.UTF-8 LC_COLLATE=en_GB.UTF-8 [5] LC_MONETARY=en_GB.UTF-8 LC_MESSAGES=en_GB.UTF-8 [7] LC_PAPER=C LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods [7] base loaded via a namespace (and not attached): [1] tools_2.15.0 I do not have a problem loading it on my windows PC. Anyone having similar experience, and perhaps know the solution? Furthermore, package 'RHTMLForms' from Omegahat I could only install on the ubuntu computer and not on the windows computer. Anyone know the reason why? Perhaps this is not even an R question, but any hint would be great. Thanks Sven -- View this message in context: http://r.789695.n4.nabble.com/Problems-installing-Packages-tp4632217.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.
[R] CRAN (and crantastic) updates this week
CRAN (and crantastic) updates this week New packages * anametrix (0.1) Maintainer: Roman Jugai Author(s): Roman Jugai License: LGPL http://crantastic.org/packages/anametrix Connects to Anametrix API and extracts data into R data structure * assertive (0.1-4) Maintainer: Richard Cotton Author(s): Richard Cotton [aut, cre] License: Unlimited http://crantastic.org/packages/assertive assertive contains lots of is_* functions to check the state of your variables, and assert_* functions to throw errors if they aren't in the right form. * crblocks (0.5-0) Maintainer: David Allingham Author(s): David Allingham, D.J. Best License: GPL (= 2) http://crantastic.org/packages/crblocks Implements a statistical test for comparing bar plots or histograms of categorical data derived from a randomized block repeated measures layout. * deltaPlotR (1.0) Maintainer: David Magis Author(s): David Magis (U Liege), Bruno Facon (Univ Lille-Nord de France) License: GPL (= 2) http://crantastic.org/packages/deltaPlotR The deltaPlot package proposes an implementation of Angoff's elta Plot method to detect dichotomous DIF. Several detection thresholds are included, either from multivariate normality asumption, random simulation, or by prior determination. Item purification is supported. * disp2D (1.0) Maintainer: Guillermo Ayala Author(s): Guillermo Ayala License: GPL-2 http://crantastic.org/packages/disp2D An implementation of two exact algorithms for testing the Hausdorff and simplex dispersion orderings * foodweb (1-0) Maintainer: Giselle Perdomo Author(s): Giselle Perdomo License: GPL (= 2) http://crantastic.org/packages/foodweb Calculates twelve commonly-used, basic measures of food web network structure from binary, predator-prey matrices: species richness, connectance, total number of links, link density, number of trophic positions, predator:prey ratio, and fraction of carnivores, herbivores, top species and intermediate species. Employs food web language in the code and output, translates between a couple of common food web formats, can handle food webs consisting of multiple levels, and can automate the analysis for a large number of webs. The program produces 3-dimensional graphs of high quality that can be customized by the user. * genomicper (1.3) Maintainer: Claudia Cabrera Author(s): Claudia P.Cabrera-Cardenas,Pau Navarro,Chris S.Haley License: GPL-2 http://crantastic.org/packages/genomicper Circular genomic permutation approach uses GWAS results to establish the significance of pathway/gene-set associations whilst accounting for genomic structure. All SNPs in the GWAS are placed in a 'circular genome' according to their location. Then the complete set of SNP association p-values are permuted by rotation with respect to the SNPs' genomic locations * hiPOD (1.0) Maintainer: Wei E. Liang Author(s): Wei E. Liang License: GPL-3 http://crantastic.org/packages/hiPOD Based on hierarchical modeling, this package provides a few practical functions to find and present the optimal designs for a pooled NGS design. * intpoint (1.0) Maintainer: Alejandro Quintela del Rio Author(s): Alejandro Quintela del Rio License: GPL-2 http://crantastic.org/packages/intpoint Solves linear programming problems by the interior point method, and plots the graphical solution of a linear programming problem of two dimensions. * jmec (1.0-3) Maintainer: Willem M. van der Wal Author(s): Willem M. van der Wal w.m.vd@umcutrecht.nl License: GPL (= 2) http://crantastic.org/packages/jmec Fit joint model for event and censoring, with cluster-level frailties, according to Huang amp; Wolfe (2002). * knnGarden (1.0) Maintainer: Boxian Wei Author(s): Boxian Wei Fan Yang Xinmiao Wang Yanni Ge License: GPL (= 2) http://crantastic.org/packages/knnGarden Muti-distance based k-Nearest Neighbors Classification with K Threshold Value Check and Same K_i Problem Dealing, Missing Observations Filling * longclust (1.1) Maintainer: K. Raju Jampani Author(s): P. D. McNicholas, K. Raju Jampani and Sanjeena Subedi License: GPL-2 http://crantastic.org/packages/longclust Clustering or classification of longitudinal data based on a mixture of multivariate t or Gaussian distributions with a Cholesky-decomposed covariance structure. * OIdata (1.0) Maintainer: Andrew P Bray Author(s): Andrew P Bray and David M Diez License: GPL-2 | GPL-3 http://crantastic.org/packages/OIdata A collection of data sets from several sources that may be useful for teaching, practice, or other purposes. Functions have also been included to assist in the retrieval of table data from websites or in visualizing sample data. * ParamHelpers (1.0-55) Maintainer: Bernd Bischl Author(s): Bernd Bischl bernd_bis...@gmx.net, Patrick Koch
Re: [R] regsubsets (Leaps)
On Sat, Jun 2, 2012 at 3:19 AM, farmedgirl ksteinm...@cdpr.ca.gov wrote: Hi i need to create a model from 250 + variables with high collinearity, and only 17 data points (p = 250, n = 750). I would prefer to use Cp, AIC, and/or BIC to narrow down the number of variables, and then use VIF to choose a model without collinearity (if possible). I realize that having a huge p and small n is going to give me extreme linear dependency problems, but I *think* these model selection criteria should still be useful? I have currently been running regsubsets for over a week with no results. I have no idea if R is still working, or if the computer is hung. I ran regsubsets on a smaller portion of the data, also with linear dependency problems, and got results. However, the hourglass continues its endless spiraling with the full dataset. I am running the following on Windows 7 library(leaps) m_250-regsubsets(Y~., data=model2, nbest=1, really.big=TRUE) (NOTE: The ~ is a tilda, not a dash, in the regression statement above: Y~.) Does anyone have any opinions on: 1) is R likely to still be running, even after a week, or should i just shut it down? It's likely to be running for years. 2^250 is a large number, even with the branch-and-bound algorithm to cut it down. 2) am i doing something wrong with regsubsets? Yes. At the very least, set nvmax to something reasonable. You certainly don't want to find a model with 243 variables, so don't waste time looking for one. 3) is there a better option than regsubsets, Almost certainly. regsubsets() is pretty much useless as a way of selecting a single model, unless perhaps when p is very small. It was produced as a way of viewing a large collection of best models, as in the example for the plot() method, by setting nbest fairly large -thomas -- Thomas Lumley Professor of Biostatistics University of Auckland __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Variate
Dear R users, We are working on a project called,Environmental Impact Assessment. We are stationed at alpine regions of Ireland to see the impact of rainfall on localities. We have divided our study area into 92 stations. We have also collected 1 year data from each station. Afterwards we placed data into a matrix in such a way that we got 366*92 matrix. 366 stands for number of days. What we want is a lognormal probability plot, of each station(which is individual column of matrix) with normal reduced variant on x-axis. In this way, we should be getting, at the end, 92 curves, one for each station, on same coordinate axis. Kindly help us on that. We are all very new to R. Eliza botto Waters Inn CC: r-help@r-project.org From: dwinsem...@comcast.net To: eliza_bo...@hotmail.com Subject: Re: [R] Log-normal probability plot Date: Sun, 3 Jun 2012 13:11:35 -0400 On Jun 2, 2012, at 9:38 PM, eliza botto wrote: You might consider the strategy of reading the Posting Guide, followed by posting an intelligible message. Dear R users, You can literally safe my life my telling me the solution of my problem. I have created matrix of a data frame with 3 columns, with each column representing data of different year. 2 ...snipped useless srting of numbers mangled by mailer processing of HTML. 4 I now want to plot Lognormal probability plot of each column data against its respective normal reduced variante(z). Normal reduced variate? What is that? Is it a set of numbers that have been centered and scaled, also known as a z-transform? If so, I do not think it should affect the results of a probability plot since it is just a linear transformation and the theoretical quantiles will be unaffected. You might look at qqplot() How to do that? If you dont know the answer, consider me dead. What greater lifesaving project are you trying to accomplish, other than getting homework done? [[alternative HTML version deleted]] -- David Winsemius, MD West Hartford, CT [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Variate
Hi Eliza You will not want 1 panel with 96 lines - too confusing after about 20 Instead 1 per panel or with groups using useOuterStrips and combineLimits from latticeExtra package Try this -- a minimal example with an 12 row 8 col grid done on the fly setseed(12) Sites - 1:92 dat - data.frame(y = rep(rnorm(5),92), x = rep(1:5,92), site = rep(Sites,each = 5)) xyplot(y ~ x|site,dat, as.table=T, strip = F, layout = c(8,12), scales = list(x = list(alternating = 2),y=list(alternating=1)), type = b, panel = function(x,y,...){ pnl=panel.number() panel.xyplot(x,y,...) panel.text(4,-1.5,Sites[pnl], cex = 0.6) } ) or with groupings for Site something like (untested) xyplot(y ~ x|groupings,dat, as.table=T, strip = F, strip.left = T, groups = site, scales = list(x = list(alternating = 2),y=list(alternating=1)), type = b, panel = function(x,y,...){ pnl=panel.number() panel.xyplot(x,y,...) panel.text(4,-1.5,Sites[pnl], cex = 0.6) } ) You will need an extra column for groupings This can also be done with the base plot function but lattice gives more flexibility, see ?xyplot and particularly par.settings into get things right size Regards Duncan Duncan Mackay Department of Agronomy and Soil Science University of New England Armidale NSW 2351 Email: home: mac...@northnet.com.au At 11:01 4/06/2012, you wrote: Content-Type: text/plain Content-Disposition: inline Content-length: 2431 Dear R users, We are working on a project called,Environmental Impact Assessment. We are stationed at alpine regions of Ireland to see the impact of rainfall on localities. We have divided our study area into 92 stations. We have also collected 1 year data from each station. Afterwards we placed data into a matrix in such a way that we got 366*92 matrix. 366 stands for number of days. What we want is a lognormal probability plot, of each station(which is individual column of matrix) with normal reduced variant on x-axis. In this way, we should be getting, at the end, 92 curves, one for each station, on same coordinate axis. Kindly help us on that. We are all very new to R. Eliza botto Waters Inn CC: r-help@r-project.org From: dwinsem...@comcast.net To: eliza_bo...@hotmail.com Subject: Re: [R] Log-normal probability plot Date: Sun, 3 Jun 2012 13:11:35 -0400 On Jun 2, 2012, at 9:38 PM, eliza botto wrote: You might consider the strategy of reading the Posting Guide, followed by posting an intelligible message. Dear R users, You can literally safe my life my telling me the solution of my problem. I have created matrix of a data frame with 3 columns, with each column representing data of different year. 2 ...snipped useless srting of numbers mangled by mailer processing of HTML. 4 I now want to plot Lognormal probability plot of each column data against its respective normal reduced variante(z). Normal reduced variate? What is that? Is it a set of numbers that have been centered and scaled, also known as a z-transform? If so, I do not think it should affect the results of a probability plot since it is just a linear transformation and the theoretical quantiles will be unaffected. You might look at qqplot() How to do that? If you don't know the answer, consider me dead. What greater lifesaving project are you trying to accomplish, other than getting homework done? [[alternative HTML version deleted]] -- David Winsemius, MD West Hartford, CT [[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] Modify pdf file with Illustrator.
Thank you for your suggestion. Do you have some example codes using ggplot2 or grid.arrange() and arrangeGrob to composite figures? On Mon, Jun 4, 2012 at 7:36 AM, Neil Collier neilander...@gmail.com wrote: ggplot2 handles all of these requirements. I highly recommend using it for composite figures. Try the grid.arrange() and arrangeGrob in the 'gridExtra' package in addition to ggplot2. On Mon, Jun 4, 2012 at 1:08 AM, Uwe Ligges lig...@statistik.tu-dortmund.de wrote: On 03.06.2012 17:03, Jinyan Huang wrote: Thank you. 1, I want to put some text and title. Then put several figures into one. So just do it within R and use title() within R and use par() and its argument mfrow to arrange several figures in rows and columns. Uwe Ligges On Sun, Jun 3, 2012 at 10:59 PM, Uwe Ligges lig...@statistik.tu-dortmund.de wrote: On 03.06.2012 08:42, Jinyan Huang wrote: Dear list, Some times I want to modify the pdf file which produced by R with illustrator. But when I use Illustrator open the pdf file, it often makes the pdf some little changed. Anyone have some suggestions? Is it better to use other file type, not pdf? Or when I produced the pdf, I should set some other parameters? Questions are: 1. Why do you need to modify it, perhaps you don't. 2. What dio you want to do with the file in later steps? Perhaps a format with a representation in a more human readable form helps... Best, Uwe Ligges Thank you __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Legend colors not matching with Intxplot line colors
Dear R help, I am using intxplot() from the library(HH). I have a dataset with 12 treatment groups. At first, I tried intxplot with no color settings. Then, the legend color was matching with the plot line colors, but some of the colors were repeated. So, I set the colors using par.settings. Now, I have the plot lines with different colors, but it seemed to be not matching with legend color. Legend colors are repeated. I am pasting below sample dataset with codes. set.seed(1) dat1-rnorm(120,0.5,0.2) dat2-data.frame(time=rep(c(1:20),rep(12,20)),trt=rep(LETTERS[1:12],each=1)) dat3-data.frame(dat2,dat1) colnames(dat3)-c(names(dat2),Response) dat3-transform(dat3,trt=ordered(trt,levels=LETTERS[1:12])) dat3$time-factor(dat3$time) position(dat3$time)-as.numeric(levels(dat3$time)) library(HH) par.settings-simpleTheme(col=c(8,12,28,36,41,47,81,92,98,113,125,155)) intxplot(Response ~ time, data = dat3, groups = trt, ylim=c(0,1), par.settings=par.settings, main= Response) Any help will be appreciated. Thanks, A.K. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Separate Array Variable Content
Hi Antony, I am sending this message again as it was not yet posted by the rhelp. One more solution: dat2-read.table(text= ABC PQR XYZ 42 29 22 65 22 78 10 20 30 40 50 60 70 80 90 61 15 24 ,sep=,header=T) exprv - expression(c( ABC10 XYZ 30 PQR 90,ABC 9 XYZ 25 PQR 60,ABC 60 XYZ 79 PQR 100)) dat3-list(ABC=dat2[,1],PQR=dat2[,2],XYZ=dat2[,3]) res1-sapply(exprv,function(x) with(dat3,eval(x))) res2-data.frame(ABC_CHECK=res1[1:6,],XYZ_CHECK=res1[7:12,],PQR_CHECK=res1[13:18,]) resultA-data.frame(dat2,res2) resultA ABC PQR XYZ ABC_CHECK XYZ_CHECK PQR_CHECK 1 42 29 22 TRUE TRUE FALSE 2 65 22 78 FALSE FALSE TRUE 3 10 20 30 FALSE FALSE FALSE 4 40 50 60 FALSE FALSE FALSE 5 70 80 90 FALSE FALSE FALSE 6 61 15 24 TRUE TRUE TRUE # which is the same as the one below. A.K. - Original Message - From: arun smartpink...@yahoo.com To: Akkara, Antony (GE Energy, Non-GE) antony.akk...@ge.com Cc: R help r-help@r-project.org Sent: Friday, June 1, 2012 7:21 PM Subject: Re: [R] Separate Array Variable Content Hi Antony, I guess I understood the format you needed. I assume that there are only few conditions in the second matrix. Based on the information given, I would do: dat1-read.table(text= ABC PQR XYZ 42 29 22 65 22 78 10 20 30 40 50 60 70 80 90 61 15 24 ,sep=,header=T) #I added some more datapoints dat1[dat1$ABC 10 dat1$XYZ 30 dat1$PQR 90,ABC_CHECK]-TRUE dat1[dat1$ABC 9 dat1$XYZ 25 dat1$PQR 60,XYZ_CHECK]-TRUE dat1[dat1$ABC 60 dat1$XYZ 79 dat1$PQR 100,PQR_CHECK]-TRUE dat1[is.na(dat1)]-FALSE dat1 ABC PQR XYZ ABC_CHECK XYZ_CHECK PQR_CHECK 1 42 29 22 TRUE TRUE FALSE 2 65 22 78 FALSE FALSE TRUE 3 10 20 30 FALSE FALSE FALSE 4 40 50 60 FALSE FALSE FALSE 5 70 80 90 FALSE FALSE FALSE 6 61 15 24 TRUE TRUE TRUE #if your data is in matrix format, convert it to dataframe. dat1-as.matrix(dat1) dat1-data.frame(dat1) I hope this helps. A.K. - Original Message - From: Akkara, Antony (GE Energy, Non-GE) antony.akk...@ge.com To: arun smartpink...@yahoo.com Cc: Sent: Friday, June 1, 2012 2:15 AM Subject: RE: [R] Separate Array Variable Content Hi Arun, What you showed, same like I am also expecting. There is two matrix, 1) 1st - matrix contain values like this, ABC XYZ PQR ABC_CHECK XYZ_CHECK PQR_CHECK -- - 10 20 30 40 50 60 70 80 90 2)2nd matrix have some conditions, need to check with 1st matrix columns. Like this, CHECK FOR CONDITION -- - ABC_CHECK ABC 10 XYZ 30 PQR 90 XYZ_CHECK ABC 9 XYZ 25 PQR 60 PQR_CHECK ABC 60 XYZ 79 PQR 100 So, Finally the result should get like this, ABC XYZ PQR ABC_CHECK XYZ_CHECK PQR_CHECK -- - 10 20 30 FALSE TRUE FALSE 40 50 60 FALSE FALSE FALSE 70 80 90 FALSE FALSE TRUE And can please tell me which is the best way to do this ?, Can we do this with-out loop ? - Thanks Antony. -Original Message- From: arun [mailto:smartpink...@yahoo.com] Sent: Wednesday, May 30, 2012 10:43 PM To: Akkara, Antony (GE Energy, Non-GE) Cc: R help Subject: Re: [R] Separate Array Variable Content HI Antony, I am not sure how you want the result. Is it something like this? Also, do you have lots of conditions in the array? Mydat2 ABC PQR XYZ ELIGIBLE_ABC ELIGIBLE_PQR ELIGIBLE_ABC_XYZ 1 10 20 30 TRUE 2 40 50 60 3 70 80 90 TRUE TRUE A.K. - Original Message - From: Rantony antony.akk...@ge.com To: r-help@r-project.org Cc: Sent: Wednesday, May 30, 2012 2:44 AM Subject: [R] Separate Array Variable Content Hi, I am new in R, i have a matrix like this MyMatrix - *ABC PQR XYZ* 10 20 30 40 50 60 70 80 90 And, i have an array containing some conditions like this, MyArray - c(*ABC*50,*PQR*50,*ABC*30 * XYZ*40) ABC50 PQR50 ABC30 XYZ40 My purpose what is, i need to check this conditions in *MyArray* with *MyMatrix* value for particular column How it is possible ? - Thanks Antony. -- View this message in context:
Re: [R] a question about subsetting
HI, I am not sure about whether your subset function is correct. If you look into this link (http://stat.ethz.ch/R-manual/R-devel/library/base/html/subset.html), it says about how to use subset (subset(data, condition) instead of (subset=data==condition). Also, the one I am describing about use a different format. For eg, in your data, both Group1 and Group2 are separate columns with each having the same values for the independent variables. Normally, for different groups (or factors with multiple levels), it will be in the same column like this: dat2 ID Group Mem Gen Chance MSELGM MSELVR MSELFM MSELRL MSELEL ADOS Age 1 1 1 75 50.0 50 53 52 62 57 56 3 25 2 2 1 75 12.5 50 46 48 47 52 55 2 30 3 3 1 25 37.5 50 48 43 52 63 63 3 24 4 4 1 25 37.5 50 51 62 52 59 54 0 31 5 5 1 50 87.5 50 45 58 42 46 43 6 31 6 6 1 100 100.0 50 45 80 49 69 63 1 31 7 7 2 75 50.0 50 53 52 62 57 56 3 25 8 8 2 75 12.5 50 46 48 47 52 55 2 30 9 9 2 25 37.5 50 48 43 52 63 63 3 24 10 10 2 25 37.5 50 51 62 52 59 54 0 31 11 11 2 50 87.5 50 45 58 42 46 43 6 31 12 12 2 100 100.0 50 45 80 49 69 63 1 31 dat3-subset(dat2,Group==1) dat4-subset(dat2,Group==2) dat4 ID Group Mem Gen Chance MSELGM MSELVR MSELFM MSELRL MSELEL ADOS Age 7 7 2 75 50.0 50 53 52 62 57 56 3 25 8 8 2 75 12.5 50 46 48 47 52 55 2 30 9 9 2 25 37.5 50 48 43 52 63 63 3 24 10 10 2 25 37.5 50 51 62 52 59 54 0 31 11 11 2 50 87.5 50 45 58 42 46 43 6 31 12 12 2 100 100.0 50 45 80 49 69 63 1 31 fit1-lm(Gen~MSELEL,data=dat3) fit2-lm(Gen~MSELEL,data=dat4) cor.test (dat3$Gen, dat3$MSELEL, method=pearson) In the sample dataset that you showed here, you will get the same correlation results and regression results for both groups as there was no change in the values of the dependent or independent variables. I guess this helps. A.K. - Original Message - From: jacaranda tree myjacara...@yahoo.com To: R-help@r-project.org R-help@r-project.org Cc: Sent: Sunday, June 3, 2012 11:51 AM Subject: [R] a question about subsetting Hi all, I started using R about 3 weeks ago, and now I've pretty much figured out how to do the types of statistical modeling, graphs, tables etc. that I frequently use (with zero background in computer languages or other statistical packages that are similar to R like S or SAS!). So it's been a quite rewarding process so far, and I thank you all R gurus for all your generous help! That being said, my question is about applying a model or an analysis to different groups based on a grouping variable. Below is the first six rows of my data: ID Group1 Group2 Mem Gen Chance MSELGM MSELVR MSELFM MSELRL MSELEL ADOS Age 1 1 1 1 75 50.0 50 53 52 62 57 56 3 25 2 2 1 1 75 12.5 50 46 48 47 52 55 2 30 3 3 1 1 25 37.5 50 48 43 52 63 63 3 24 4 4 1 1 25 37.5 50 51 62 52 59 54 0 31 5 5 1 1 50 87.5 50 45 58 42 46 43 6 31 6 6 1 1 100 100.0 50 45 80 49 69 63 1 31 Group1: First grouping variable Group2: Second grouping variable Mem: Memory trial Gen: Generalization trial MSEL: Mullen Scales of Early Learning (a scale measuring various skills in little children). GM: Gross Motor Scale, VR: Visual Reception, FM: Fine Motor, RL: receptive Language, EL: Expressive Language. ADOS: An autism-specific measure. First I wanted to do correlations between Generalization (variable Gen) and expressive language (MSELEL) for each group of Group1. For this, I used lapply or by functions which work just fine. Here is the code with lapply: lapply(split(mydata, mydata$Group1), function(x){cor.test(x[,5], x[,11], method = pearson)}) Then I did regression. My DV is the variable Gen, and the IV is MSELEL. And again I wanted to do this for each group. Here is the code I came up with for each group: fit1-lm(Gen~ MSELEL,
[R] Dummies guide to getting HPC working on R
R-folks. Sorry for the cross-posting, but I wanted to share a link to a (fairly long) blog post I created which tries to take the mystery out of getting R setup for doing high performance/parallel computing if you have to compile R from scratch: http://lostingeospace.blogspot.com/2012/06/r-and-hpc-blas-mpi-in-linux-environment.html Let me know if you have any comments/corrections on it. Cheers! --j -- Jonathan A. Greenberg, PhD Assistant Professor Department of Geography and Geographic Information Science University of Illinois at Urbana-Champaign 607 South Mathews Avenue, MC 150 Urbana, IL 61801 Phone: 415-763-5476 AIM: jgrn307, MSN: jgrn...@hotmail.com, Gchat: jgrn307, Skype: jgrn3007 http://www.geog.illinois.edu/people/JonathanGreenberg.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.
[R] Rexcel question
I am using the worksheet functions of RExcel. I am trying to pass a datatable to a function in the following call: =RApply(O14:O18,D6) Cells O14:O18 contain the definition of the function. This is a function that takes one argument which is a data.table. Cell D6 has the name of the data.table object. When I call the function this way, D6 is passed to the function as a string, not as a data.table. So I get an error. How can I fix this? I know that there is a data.table in R workspace with this name... I just can't seem to pass it to the function... [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Modify pdf file with Illustrator.
ggplot2 handles all of these requirements. I highly recommend using it for composite figures. Try the grid.arrange() and arrangeGrob in the 'gridExtra' package in addition to ggplot2. On Mon, Jun 4, 2012 at 1:08 AM, Uwe Ligges lig...@statistik.tu-dortmund.dewrote: On 03.06.2012 17:03, Jinyan Huang wrote: Thank you. 1, I want to put some text and title. Then put several figures into one. So just do it within R and use title() within R and use par() and its argument mfrow to arrange several figures in rows and columns. Uwe Ligges On Sun, Jun 3, 2012 at 10:59 PM, Uwe Ligges lig...@statistik.tu-dortmund.**de lig...@statistik.tu-dortmund.de wrote: On 03.06.2012 08:42, Jinyan Huang wrote: Dear list, Some times I want to modify the pdf file which produced by R with illustrator. But when I use Illustrator open the pdf file, it often makes the pdf some little changed. Anyone have some suggestions? Is it better to use other file type, not pdf? Or when I produced the pdf, I should set some other parameters? Questions are: 1. Why do you need to modify it, perhaps you don't. 2. What dio you want to do with the file in later steps? Perhaps a format with a representation in a more human readable form helps... Best, Uwe Ligges Thank you __** R-help@r-project.org mailing list https://stat.ethz.ch/mailman/**listinfo/r-helphttps://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/**posting-guide.htmlhttp://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __** R-help@r-project.org mailing list https://stat.ethz.ch/mailman/**listinfo/r-helphttps://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/** posting-guide.html http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __** R-help@r-project.org mailing list https://stat.ethz.ch/mailman/**listinfo/r-helphttps://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/** posting-guide.html http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Fwd: Rgraphviz installation problem
Martin -- I know this is about a year late, but I have to thank you for taking the time to answer Ram's question in this thread. It helped me get Rgraphviz up and running. I've been struggling with this for about 90 minutes, so thank you so much! And to anyone else who may run upon this thread with the same issues, I found this link helpful: https://wiki.duke.edu/display/DUKER/Install+RGraphviz+under+Windows Thanks, Jess -- View this message in context: http://r.789695.n4.nabble.com/Rgraphviz-installation-problem-tp3692733p4632271.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] Plotting with Rgraphviz
Hi All, After a lengthy battle just to get the package installed, I am not able to actually use Rgraphviz to generate any plots. I tried just using the sample code in the documentation (http://www2.warwick.ac.uk/fac/sci/moac/people/students/peter_cock/r/rgraphviz/) and I get the following: * library(Rgraphviz) test.matrix-matrix(rep(c(0,1,0,0), 9), ncol=6, nrow=6) rownames(test.matrix)-c(a, b, c, d, e, f) colnames(test.matrix)-c(a, b, c, d, e, f) test.matrix a b c d e f a 0 0 0 0 0 0 b 1 0 1 0 1 0 c 0 0 0 0 0 0 d 0 1 0 1 0 1 e 0 0 0 0 0 0 f 1 0 1 0 1 0 am.graph-new(graphAM, adjMat=test.matrix, edgemode=directed) am.graph A graphAM graph with directed edges Number of Nodes = 6 Number of Edges = 9 plot(am.graph, attrs = list(node = list(fillcolor = lightblue), + edge = list(arrowsize=0.5))) There were 18 warnings (use warnings() to see them) warnings() Warning messages: 1: In plot.xy(xy.coords(x, y), type = type, ...) : len is not a graphical parameter 2: In plot.xy(xy.coords(x, y), type = type, ...) : edgemode is not a graphical parameter 3: In plot.xy(xy.coords(x, y), type = type, ...) : len is not a graphical parameter 4: In plot.xy(xy.coords(x, y), type = type, ...) : edgemode is not a graphical parameter 5: In plot.xy(xy.coords(x, y), type = type, ...) : len is not a graphical parameter 6: In plot.xy(xy.coords(x, y), type = type, ...) : edgemode is not a graphical parameter 7: In plot.xy(xy.coords(x, y), type = type, ...) : len is not a graphical parameter 8: In plot.xy(xy.coords(x, y), type = type, ...) : edgemode is not a graphical parameter 9: In plot.xy(xy.coords(x, y), type = type, ...) : len is not a graphical parameter 10: In plot.xy(xy.coords(x, y), type = type, ...) : edgemode is not a graphical parameter 11: In plot.xy(xy.coords(x, y), type = type, ...) : len is not a graphical parameter 12: In plot.xy(xy.coords(x, y), type = type, ...) : edgemode is not a graphical parameter 13: In plot.xy(xy.coords(x, y), type = type, ...) : len is not a graphical parameter 14: In plot.xy(xy.coords(x, y), type = type, ...) : edgemode is not a graphical parameter 15: In plot.xy(xy.coords(x, y), type = type, ...) : len is not a graphical parameter 16: In plot.xy(xy.coords(x, y), type = type, ...) : edgemode is not a graphical parameter 17: In plot.xy(xy.coords(x, y), type = type, ...) : len is not a graphical parameter 18: In plot.xy(xy.coords(x, y), type = type, ...) : edgemode is not a graphical parameter* Anyone with the same problem? Any ideas on how to fix? Thanks, Jess -- View this message in context: http://r.789695.n4.nabble.com/Plotting-with-Rgraphviz-tp4632274.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] R 15.0 Warning message.
At last, the administrator provide me this command to fix this problem. echo setenv LC_ALL en_US.UTF8 ~/.cshrc.aliases On Sun, Jun 3, 2012 at 5:47 PM, peter dalgaard pda...@gmail.com wrote: On Jun 3, 2012, at 11:36 , Prof Brian Ripley wrote: ls -ld /usr/share/locale/en_US* drwxr-xr-x 2 root root 4096 Dec 15 15:19 /usr/share/locale/en_US This is clearly not an R issue: so ask your IT support for help. Or check out the Ubuntu docs/forums for information on which package of configuration trick you might be missing to get UTF-8 locales properly installed. (Googling utf-8 ubuntu seem to come up with relevant stuff.) -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Email: pd@cbs.dk Priv: pda...@gmail.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] Error while trying to install RPostgreSQL.
Hi, I am getting the following error while trying to install RPostgreSQL. I tried all three methods(install.packages(RPostgreSQL, type = source),install.packages(RPostgreSQL) R CMD INSTALL RPostgreSQL_0.3-1.tar.gz ) , but none of them is working. ++ Error gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I -fpic -O3 -pipe -g -c RS-PQescape.c -o RS-PQescape.o In file included from RS-PQescape.c:7:0: RS-PostgreSQL.h:23:26: fatal error: libpq-fe.h: No such file or directory compilation terminated. make: *** [RS-PQescape.o] Error 1 ERROR: compilation failed for package RPostgreSQL * removing /home/intel/R/x86_64-pc-linux-gnu-library/2.15/RPostgreSQL The downloaded source packages are in /tmp/Rtmpz4zF04/downloaded_packages Warning message: In install.packages(RPostgreSQL, type = source) : installation of package RPostgreSQL had non-zero exit status ++ Thanks Regards, Thomas [[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] Re : Error while trying to install RPostgreSQL.
Hello, You got the detail of the error: RS-PostgreSQL.h:23:26: fatal error: libpq-fe.h: No such file or directory compilation terminated. Please searc on Internet libpq-fe.h. You will get answer to your problem. Regards - Mail original - De : Prakash Thomas pthomas2...@gmail.com À : r-help@r-project.org Cc : Envoyé le : Lundi 4 juin 2012 14h14 Objet : [R] Error while trying to install RPostgreSQL. Hi, I am getting the following error while trying to install RPostgreSQL. I tried all three methods(install.packages(RPostgreSQL, type = source),install.packages(RPostgreSQL) R CMD INSTALL RPostgreSQL_0.3-1.tar.gz ) , but none of them is working. ++ Error gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I -fpic -O3 -pipe -g -c RS-PQescape.c -o RS-PQescape.o In file included from RS-PQescape.c:7:0: RS-PostgreSQL.h:23:26: fatal error: libpq-fe.h: No such file or directory compilation terminated. make: *** [RS-PQescape.o] Error 1 ERROR: compilation failed for package ‘RPostgreSQL’ * removing ‘/home/intel/R/x86_64-pc-linux-gnu-library/2.15/RPostgreSQL’ The downloaded source packages are in ‘/tmp/Rtmpz4zF04/downloaded_packages’ Warning message: In install.packages(RPostgreSQL, type = source) : installation of package ‘RPostgreSQL’ had non-zero exit status ++ Thanks Regards, Thomas [[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.