Re: [R] I don't know the difference between rank and order
On 21-Nov-2012 02:57:19 li1127217ye wrote: I don't know the difference between rank and order.For example: x=c(10,30,30,20,10,20) x[rank(x,ties.method=first)] [1] 10 10 20 30 30 20 x[order(x)] [1] 10 10 20 20 30 30 the result is quite different, x[rank(x,ties.method=first)] [1] 10 10 20 30 30 20 It is not sorted,why? It is because rank() gives, for each element of x, the position of that value within the sorted series of all the values in x. This will not, in general, be the same as the index, within x, of the value that should be in that position. Example: x1=c(6,5,4,2,3,1) x1[rank(x1,ties.method=first)] # [1] 1 3 2 5 4 6 rank(x1,ties.method=first) # [1] 6 5 4 2 3 1 So 2 indeed has rank 2, and 3 has rank 3; but what will be returned by x1[rank(x)] will depend on what is in x[2] and x[3] (in this case 5 and 4 respectively). Ted. - E-Mail: (Ted Harding) ted.hard...@wlandres.net Date: 21-Nov-2012 Time: 08:13:23 This message was sent by XFMail __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Stepwise analysis with fixed variables
I am sorry, but I think my questions were forgotten. Can someone please answer them? Thank you :) -- View this message in context: http://r.789695.n4.nabble.com/Stepwise-analysis-with-fixed-variables-tp4650015p4650264.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] Is it possible to draw with function image.asc and show a legend strip in the same window?
Thank you David, Nice idea, but i think that the problem is with the map, (maybe, because image.plot is not for this kind of date) I can try to tranform the map with your idea, but it could be hard. I'm looking for an easier solution :) Forget the points. Example (with library adehabitat) CASE 1 library(fields) file1 - paste(system.file(package = adehabitat),ascfiles/elevation.asc, sep = /) map-import.asc(file1) image.plot(map,col=terrain.colors(100)) Focus in one single point. Changing the size window we observe that the axis values are incorrect. I wrote the solution: use image.asc # (from library adehabitat) But image.asc has not a legend strip... -- View this message in context: http://r.789695.n4.nabble.com/Is-it-possible-to-draw-with-function-image-asc-and-show-a-legend-strip-in-the-same-window-tp4650150p4650267.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] FW: Select a random subset of rows out of matrix
Hi, This is Madhu and I have a following doubt please give a solution... **i have the following data frame from this i want to select a 80% of data randomly in such a way that if the selected records are 1 and then we have to get the all records corresponding to 1 similarly for 2 also and soon. help me data-data.frame(x=c(1,1,2,2,2,3,4,4,4),y=c(23,45,87,46,78,12,87,79));** Regards, Madhu. [[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] Integration in R
Dear R - Experts, I am trying to integrate lognormal distribution (mu = -0.3 and sigma2 = 0.00041.. ) based on the some hypothetical data. But I am getting 0 as the result. I have checked that my R-code is correct as code is giving me result for some other data. As I understand, when I am integrating some pdf with in the range of (0, Inf), I should not get 0. How to handle this kind of problem? Please help. Looking forward for your reply. Regards, rehena [[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] I don't know the difference between rank and order
Obviously something that is possible to get wrong even when you know it: http://www.portfolioprobe.com/2012/07/26/r-inferno-ism-order-is-not-rank/ Pat On 21/11/2012 08:13, (Ted Harding) wrote: On 21-Nov-2012 02:57:19 li1127217ye wrote: I don't know the difference between rank and order.For example: x=c(10,30,30,20,10,20) x[rank(x,ties.method=first)] [1] 10 10 20 30 30 20 x[order(x)] [1] 10 10 20 20 30 30 the result is quite different, x[rank(x,ties.method=first)] [1] 10 10 20 30 30 20 It is not sorted,why? It is because rank() gives, for each element of x, the position of that value within the sorted series of all the values in x. This will not, in general, be the same as the index, within x, of the value that should be in that position. Example: x1=c(6,5,4,2,3,1) x1[rank(x1,ties.method=first)] # [1] 1 3 2 5 4 6 rank(x1,ties.method=first) # [1] 6 5 4 2 3 1 So 2 indeed has rank 2, and 3 has rank 3; but what will be returned by x1[rank(x)] will depend on what is in x[2] and x[3] (in this case 5 and 4 respectively). Ted. - E-Mail: (Ted Harding) ted.hard...@wlandres.net Date: 21-Nov-2012 Time: 08:13:23 This message was sent by XFMail __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Patrick Burns pbu...@pburns.seanet.com twitter: @portfolioprobe http://www.portfolioprobe.com/blog http://www.burns-stat.com (home of 'Some hints for the R beginner' and 'The R Inferno') __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Function storing error messages in 32 bit R-2.15.2 version
I think we need the data in order to see if this is a bug or just some numerical issue. Uwe Ligges On 21.11.2012 07:14, Maulik Shah wrote: I am using 32 bit R - 2.15.2 version and working on package ltm. The program does not give me any warning message when I run tpm command for a dataset. If run tpm command for the same dataset in 64-bit R 2.15.1 version, I get the warning message shown below. Can someone suggest why is no warning message being generated by 32-bit R? Or is it being generated but not getting printed? Which function will have this warning message stored? *Consider the following code that I ran on 64-bit R - * This is package 'ltm' version '0.9-7' resp-read.table(D:\\DriveE\\IRT\\Outfiles\\testFile.txt) params-tpm(resp) Warning message: *In tpm(resp) :* * Hessian matrix at convergence contains infinite or missing values; unstable solution.* *Consider the following code that I ran on 32-bit R - * resp-read.table(D:\\DriveE\\IRT\\Outfiles\\testFile.txt) params-tpm(resp) warnings() NULL Thanks and regards, Maulik Shah [[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] lattice density plot: add vertical lines at groupwise medians for all panels
Dear AnjaM There may be better ways of dealing with this, but the following works: densityplot(~gcsescore | factor(score), groups=gender, data=Chem97, auto.key=TRUE, plot.points=FALSE, ref=TRUE, panel=function(x,...){ panel.densityplot(x,...) median.values - tapply(Chem97$gcsescore, Chem97$gender, median) panel.abline(v=median.values, col=c(blue,red)) panel.grid(v=2)} ) Regards, José Iparraguirre Chief Economist Age UK -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of AnjaM Sent: 20 November 2012 14:13 To: r-help@r-project.org Subject: [R] lattice density plot: add vertical lines at groupwise medians for all panels Suppose you have the following code: ## Start code## data(Chem97, package=mlmRev) densityplot(~gcsescore | factor(score), groups=gender, data=Chem97, auto.key=TRUE, plot.points=FALSE, ref=TRUE, panel=function(x,...){ panel.densityplot(x,...) median.values - median(x) panel.abline(v=median.values)} ) ## End code## For some reason I don't understand, this adds only the median for one group (in this case for gender == M) into each panel. How do I calculate and add the medians for both groups in the right group colour? This is what I tried: ## Start code## densityplot(~gcsescore | factor(score), groups=gender, data=Chem97, auto.key=TRUE, plot.points=FALSE, ref=TRUE, panel=function(x,..., groups){ panel.densityplot(x,..., groups) median.values - tapply(x, groups, median) panel.abline(v=median.values)} ) ## End code## However, this gives an error. What's going wrong and how can I solve this problem? -- View this message in context: http://r.789695.n4.nabble.com/lattice-density-plot-add-vertical-lines-at-groupwise-medians-for-all-panels-tp4650163.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. Wrap Up Run 10k next March to raise vital funds for Age UK Six exciting new 10k races are taking place throughout the country and we want you to join in the fun! Whether you're a runner or not, these are events are for everyone ~ from walking groups to serious athletes. The Age UK Events Team will provide you with a training plan to suit your level and lots of tips to make this your first successful challenge of 2012. Beat the January blues and raise some vital funds to help us prevent avoidable deaths amongst older people this winter. Sign up now! www.ageuk.org.uk/10k Coming to; London Crystal Palace, Southport, Tatton Park, Cheshire Harewood House, Leeds,Coventry, Exeter Age UK Improving later life www.ageuk.org.uk --- Age UK is a registered charity and company limited by guarantee, (registered charity number 1128267, registered company number 6825798). Registered office: Tavis House, 1-6 Tavistock Square, London WC1H 9NA. For the purposes of promoting Age UK Insurance, Age UK is an Appointed Representative of Age UK Enterprises Limited, Age UK is an Introducer Appointed Representative of JLT Benefit Solutions Limited and Simplyhealth Access for the purposes of introducing potential annuity and health cash plans customers respectively. Age UK Enterprises Limited, JLT Benefit Solutions Limited and Simplyhealth Access are all authorised and regulated by the Financial Services Authority. -- This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you receive a message in error, please advise the sender and delete immediately. Except where this email is sent in the usual course of our business, any opinions expressed in this email are those of the author and do not necessarily reflect the opinions of Age UK or its subsidiaries and associated companies. Age UK monitors all e-mail transmissions passing through its network and may block or modify mails which are deemed to be unsuitable. Age Concern England (charity number 261794) and Help the Aged (charity number 272786) and their trading and other associated companies merged on 1st April 2009. Together they have formed the Age UK Group, dedicated to improving the lives of people in later life. The three national Age Concerns in Scotland, Northern Ireland and Wales have also merged with Help the Aged in these nations to form three registered charities: Age Scotland, Age NI, Age Cymru.
[R] Sourcing files with Umlaut in path no longer works
Dear helpeRs, on my new machine - Windows 7 64Bit, R 2.15-2, I can no longer source files for which the path contains the o-Umlaut (ö). As a historical burden, my username is Grömping and contains that Umlaut (I wouldn't have chosen it now, but decided to keep it for easy transfer). I have had the difficulty that I couldn't use the R CMD tools on files with Umlauts in the path (and solved it by having a dedicated directory without umlaut in the path for that purpose), but so far (Windows XP and earlier R versions) sourcing from within R worked fine. The issue is that the o-Umlaut (ö) is always replaced by a capital A with tilde above together with a paragraph symbol (ö). Apparently, the c3b6 used for the o-Umlaut in some encoding is translated back to the ö. Can I somehow fix this? Or is it a bug? Best regards, Ulrike __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Stepwise analysis with fixed variables
Hi. What questions? I do not see any. Petr -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of Einat Sent: Wednesday, November 21, 2012 9:32 AM To: r-help@r-project.org Subject: Re: [R] Stepwise analysis with fixed variables I am sorry, but I think my questions were forgotten. Can someone please answer them? Thank you :) -- View this message in context: http://r.789695.n4.nabble.com/Stepwise- analysis-with-fixed-variables-tp4650015p4650264.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] I don't know the difference between rank and order
On 12-11-21 4:59 AM, Patrick Burns wrote: Obviously something that is possible to get wrong even when you know it: http://www.portfolioprobe.com/2012/07/26/r-inferno-ism-order-is-not-rank/ They're not just different, they are inverses of each other: x - rnorm(10) rank(x) [1] 8 1 4 2 6 10 7 9 3 5 order(x) [1] 2 4 9 3 10 5 7 1 8 6 order(x)[rank(x)] [1] 1 2 3 4 5 6 7 8 9 10 rank(x)[order(x)] [1] 1 2 3 4 5 6 7 8 9 10 Duncan Murdoch Pat On 21/11/2012 08:13, (Ted Harding) wrote: On 21-Nov-2012 02:57:19 li1127217ye wrote: I don't know the difference between rank and order.For example: x=c(10,30,30,20,10,20) x[rank(x,ties.method=first)] [1] 10 10 20 30 30 20 x[order(x)] [1] 10 10 20 20 30 30 the result is quite different, x[rank(x,ties.method=first)] [1] 10 10 20 30 30 20 It is not sorted,why? It is because rank() gives, for each element of x, the position of that value within the sorted series of all the values in x. This will not, in general, be the same as the index, within x, of the value that should be in that position. Example: x1=c(6,5,4,2,3,1) x1[rank(x1,ties.method=first)] # [1] 1 3 2 5 4 6 rank(x1,ties.method=first) # [1] 6 5 4 2 3 1 So 2 indeed has rank 2, and 3 has rank 3; but what will be returned by x1[rank(x)] will depend on what is in x[2] and x[3] (in this case 5 and 4 respectively). Ted. - E-Mail: (Ted Harding) ted.hard...@wlandres.net Date: 21-Nov-2012 Time: 08:13:23 This message was sent by XFMail __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Sourcing files with Umlaut in path no longer works
On 12-11-21 6:49 AM, Ulrike Grömping wrote: Dear helpeRs, on my new machine - Windows 7 64Bit, R 2.15-2, I can no longer source files for which the path contains the o-Umlaut (ö). As a historical burden, my username is Grömping and contains that Umlaut (I wouldn't have chosen it now, but decided to keep it for easy transfer). I have had the difficulty that I couldn't use the R CMD tools on files with Umlauts in the path (and solved it by having a dedicated directory without umlaut in the path for that purpose), but so far (Windows XP and earlier R versions) sourcing from within R worked fine. The issue is that the o-Umlaut (ö) is always replaced by a capital A with tilde above together with a paragraph symbol (ö). Apparently, the c3b6 used for the o-Umlaut in some encoding is translated back to the ö. Can I somehow fix this? Or is it a bug? Can you change directory, and then source without the Grömping in the path? Duncan Murdoch __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Controlling the number of interactions of a lme
cleberchaves cleberchaves at gmail.com writes: [snip] My model have many response variables and when i run the anova, the number of interactions (up to six) is great and the p-values of all variables not appear. I wanted to know if i could to control the number of interactions of the [snip] v.is-lme(is~direction*envir*region*hour*estom*esl, random=~1|ind/dir/reg, tabela) anova(v.is,test=F) You probably want something like is ~ (direction+envir+region+hour+estom+esl)^2 for example, which would include the main effects and all two-way interactions. See the Details section of ?formula for a (terse) description. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] FW: Select a random subset of rows out of matrix
HI, Your question is not very clear to me. dat1-data.frame(x=c(1,1,2,2,2,3,4,4),y=c(23,45,87,46,78,12,87,79)) If I select randomly 80% of data: dat1[sample(nrow(dat1),0.8*nrow(dat1)),] # x y #4 2 46 #6 3 12 #7 4 87 #3 2 87 #2 1 45 #8 4 79 In this case, it is a mix of all the records that was in the original data. So, if I understand correctly, then you want to get the original data, instead of the 80% data (as you want all the records). But, suppose if the sample is: set.seed(244) dat2-dat1[sample(nrow(dat1),0.8*nrow(dat1)),] dat2 # x y #2 1 45 #7 4 87 #8 4 79 #1 1 23 #5 2 78 #4 2 46 You wanted to eliminate the records 3 from the original dataset. Is that what you meant? If that is the case: dat1[dat1$x%in%dat2$x,] # x y #1 1 23 #2 1 45 #3 2 87 #4 2 46 #5 2 78 #7 4 87 #8 4 79 A.K. - Original Message - From: Madhu Ganganapalli mganganapa...@upstreamsoftware.com To: r-help@r-project.org r-help@r-project.org Cc: Sent: Wednesday, November 21, 2012 4:10 AM Subject: Re: [R] FW: Select a random subset of rows out of matrix Hi, This is Madhu and I have a following doubt please give a solution... **i have the following data frame from this i want to select a 80% of data randomly in such a way that if the selected records are 1 and then we have to get the all records corresponding to 1 similarly for 2 also and soon. help me data-data.frame(x=c(1,1,2,2,2,3,4,4,4),y=c(23,45,87,46,78,12,87,79));** Regards, Madhu. [[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] FW: Select a random subset of rows out of matrix
Hello, It's not, in general, possible to fullfill the two constraints, to both select 80% of the rows and to select all x %in% sampled x. Maybe the following is a way close enough. set.seed(244) s - sample(unique(dat$x), length(unique(dat$x))*0.8, prob = table(dat$x)) dat[dat$x %in% s,] Hope this helps, Rui Barradas Em 21-11-2012 13:25, arun escreveu: HI, Your question is not very clear to me. dat1-data.frame(x=c(1,1,2,2,2,3,4,4),y=c(23,45,87,46,78,12,87,79)) If I select randomly 80% of data: dat1[sample(nrow(dat1),0.8*nrow(dat1)),] # x y #4 2 46 #6 3 12 #7 4 87 #3 2 87 #2 1 45 #8 4 79 In this case, it is a mix of all the records that was in the original data. So, if I understand correctly, then you want to get the original data, instead of the 80% data (as you want all the records). But, suppose if the sample is: set.seed(244) dat2-dat1[sample(nrow(dat1),0.8*nrow(dat1)),] dat2 # x y #2 1 45 #7 4 87 #8 4 79 #1 1 23 #5 2 78 #4 2 46 You wanted to eliminate the records 3 from the original dataset. Is that what you meant? If that is the case: dat1[dat1$x%in%dat2$x,] # x y #1 1 23 #2 1 45 #3 2 87 #4 2 46 #5 2 78 #7 4 87 #8 4 79 A.K. - Original Message - From: Madhu Ganganapalli mganganapa...@upstreamsoftware.com To: r-help@r-project.org r-help@r-project.org Cc: Sent: Wednesday, November 21, 2012 4:10 AM Subject: Re: [R] FW: Select a random subset of rows out of matrix Hi, This is Madhu and I have a following doubt please give a solution... **i have the following data frame from this i want to select a 80% of data randomly in such a way that if the selected records are 1 and then we have to get the all records corresponding to 1 similarly for 2 also and soon. help me data-data.frame(x=c(1,1,2,2,2,3,4,4,4),y=c(23,45,87,46,78,12,87,79));** Regards, Madhu. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Sourcing files with Umlaut in path no longer works
On Nov 21, 2012, at 12:49 , Ulrike Grömping wrote: Dear helpeRs, on my new machine - Windows 7 64Bit, R 2.15-2, I can no longer source files for which the path contains the o-Umlaut (ö). As a historical burden, my username is Grömping and contains that Umlaut (I wouldn't have chosen it now, but decided to keep it for easy transfer). I have had the difficulty that I couldn't use the R CMD tools on files with Umlauts in the path (and solved it by having a dedicated directory without umlaut in the path for that purpose), but so far (Windows XP and earlier R versions) sourcing from within R worked fine. The issue is that the o-Umlaut (ö) is always replaced by a capital A with tilde above together with a paragraph symbol (ö). Apparently, the c3b6 used for the o-Umlaut in some encoding is translated back to the ö. Can I somehow fix this? Or is it a bug? Without a reproducible example, it is hard to tell where things are going wrong, but the symptoms are those of utf-8 codes being sent to something that expects latin1 (or one of the 8th bit ASCII variations, anyway). Best regards, Ulrike __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Sourcing files with Umlaut in path no longer works
On 21/11/2012 6:49 AM, Ulrike Grömping wrote: Dear helpeRs, on my new machine - Windows 7 64Bit, R 2.15-2, I can no longer source files for which the path contains the o-Umlaut (ö). As a historical burden, my username is Grömping and contains that Umlaut (I wouldn't have chosen it now, but decided to keep it for easy transfer). I have had the difficulty that I couldn't use the R CMD tools on files with Umlauts in the path (and solved it by having a dedicated directory without umlaut in the path for that purpose), but so far (Windows XP and earlier R versions) sourcing from within R worked fine. The issue is that the o-Umlaut (ö) is always replaced by a capital A with tilde above together with a paragraph symbol (ö). Apparently, the c3b6 used for the o-Umlaut in some encoding is translated back to the ö. Can I somehow fix this? Or is it a bug? I can't reproduce this. The file d:/temp/Grömping/test.R contains cat(it worked!\n) I am on Windows 7 64bit, and I see the following in both 32 and 64 bit R: source(d:/temp/Grömping/test.R) it worked! If I look at Encoding(d:/temp/Grömping/test.R) I get latin1. If I run iconv(d:/temp/Grömping/test.R, latin1, UTF-8) I get a proper UTF-8 string, but if I run iconv(d:/temp/Grömping/test.R, latin1, utf8) I get a string with encoding marked as unknown, and displayed as [1] d:/temp/Grömping/test.R So perhaps you or we have used an unofficial name of the UTF-8 encoding in some conversion. We need to know exactly what you did to pursue this. Duncan Murdoch Duncan Murdoch __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Create BATCH file
Hi, I have a .R file written many functions into that. My requirement what is, i need to create a batch file for this. No idea, how to create it. Tried it many other ways, but no result !. Could anyone please help me out ? Thanks. Antony. -- View this message in context: http://r.789695.n4.nabble.com/Create-BATCH-file-tp4650277.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Statistical significance in robust estimation rlm()
Hi there, I used the rlm() function for doing a robust estimation based on M-estimates. Obviously, you only get the estimate, standard error and t- value by implementing this rlm() function. So, how can I say if a coefficient is statistical significant without the presence of a p-value? Thanks in advance! -- View this message in context: http://r.789695.n4.nabble.com/Statistical-significance-in-robust-estimation-rlm-tp4650275.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] [lattice] print only legend
Is it possible to plot (and save) only the legend of a lattice plot? Of course I could make the axes and axis labels transparent and use an empty panel function, but additionally to being a very dirty solution, there would be still a lot of free space on the plot, while I would like to save only the legend as a separate plot without any white space around it. Is there a (nice) way to do this? -- View this message in context: http://r.789695.n4.nabble.com/lattice-print-only-legend-tp4650269.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] lattice density plot: add vertical lines at groupwise medians for all panels
Dear José Thanks for your reply. I've tried out your suggestion, but this code plots the overall median for each group rather than plotting the medians for the individual panels. What I am looking for is a way to calculate the medians per group for each panel. Sorry if I didn't state it clearly before. Best wishes Anja 2012/11/21 Jose Iparraguirre jose.iparragui...@ageuk.org.uk Dear AnjaM There may be better ways of dealing with this, but the following works: densityplot(~gcsescore | factor(score), groups=gender, data=Chem97, auto.key=TRUE, plot.points=FALSE, ref=TRUE, panel=function(x,...){ panel.densityplot(x,...) median.values - tapply(Chem97$gcsescore, Chem97$gender, median) panel.abline(v=median.values, col=c(blue,red)) panel.grid(v=2)} ) Regards, José Iparraguirre Chief Economist Age UK -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of AnjaM Sent: 20 November 2012 14:13 To: r-help@r-project.org Subject: [R] lattice density plot: add vertical lines at groupwise medians for all panels Suppose you have the following code: ## Start code## data(Chem97, package=mlmRev) densityplot(~gcsescore | factor(score), groups=gender, data=Chem97, auto.key=TRUE, plot.points=FALSE, ref=TRUE, panel=function(x,...){ panel.densityplot(x,...) median.values - median(x) panel.abline(v=median.values)} ) ## End code## For some reason I don't understand, this adds only the median for one group (in this case for gender == M) into each panel. How do I calculate and add the medians for both groups in the right group colour? This is what I tried: ## Start code## densityplot(~gcsescore | factor(score), groups=gender, data=Chem97, auto.key=TRUE, plot.points=FALSE, ref=TRUE, panel=function(x,..., groups){ panel.densityplot(x,..., groups) median.values - tapply(x, groups, median) panel.abline(v=median.values)} ) ## End code## However, this gives an error. What's going wrong and how can I solve this problem? -- View this message in context: http://r.789695.n4.nabble.com/lattice-density-plot-add-vertical-lines-at-groupwise-medians-for-all-panels-tp4650163.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. Wrap Up Run 10k next March to raise vital funds for Age UK Six exciting new 10k races are taking place throughout the country and we want you to join in the fun! Whether you're a runner or not, these are events are for everyone ~ from walking groups to serious athletes. The Age UK Events Team will provide you with a training plan to suit your level and lots of tips to make this your first successful challenge of 2012. Beat the January blues and raise some vital funds to help us prevent avoidable deaths amongst older people this winter. Sign up now! www.ageuk.org.uk/10k Coming to; London Crystal Palace, Southport, Tatton Park, Cheshire Harewood House, Leeds,Coventry, Exeter Age UK Improving later life www.ageuk.org.uk --- Age UK is a registered charity and company limited by guarantee, (registered charity number 1128267, registered company number 6825798). Registered office: Tavis House, 1-6 Tavistock Square, London WC1H 9NA. For the purposes of promoting Age UK Insurance, Age UK is an Appointed Representative of Age UK Enterprises Limited, Age UK is an Introducer Appointed Representative of JLT Benefit Solutions Limited and Simplyhealth Access for the purposes of introducing potential annuity and health cash plans customers respectively. Age UK Enterprises Limited, JLT Benefit Solutions Limited and Simplyhealth Access are all authorised and regulated by the Financial Services Authority. -- This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you receive a message in error, please advise the sender and delete immediately. Except where this email is sent in the usual course of our business, any opinions expressed in this email are those of the author and do not necessarily reflect the opinions of Age UK or its subsidiaries and associated companies. Age UK monitors all e-mail transmissions passing through its network and may block or modify mails which are deemed to be unsuitable. Age Concern England (charity number 261794) and
[R] dúvidas com matriz de correlação e covariancia
Bom dia eu chamo-me Ana, estou a tentar fazer matriz de correlação e covariancia para comparar 4 variaveis e saber quais são as mehores... fiz o segundo codigo mas devo tar a fazer alguma confusão para nao me aparecer o output correcto: cor(dados[,2:5],method=c(pearson)) cor_with_p_test(dados[2:5]) ct - cor.test(dados[,2:5]) ct$p ct$v #matriz de covariancias cov(dados[,2:5], na.rm=TRUE) mando o arquivo de dados em anexo. Aguardando uma resposta, desde já agradeço. eSubescrevo-m Ana Rocha __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] creat an interactive graph
Hello! Does anyone get any idea how to generate a following graph by using R? http://www.fastcodesign.com/multisite_files/codesign/imagecache/inline-large/post-inline/inline-north-carolina-gay-rights.jpg Any information or hint will be highly appreciated. Kind regards, Henry [[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] Stepwise analysis with fixed variables
These are my questions: 1. For example, if this is my code: RegModel = lm(glucose~sex+BMI+height+weight+education+ses,weight=w_without_non_response) summary(RegModel) step(RegModel, direction =backward,scope=list(lower=?,upper=?)) and I want the sex and height variables to be fixed, but the rest of the variables to go into the backward analysis, how should I write the scope function? 2.How can I add an alpha level to the step function as a criterion for the backward regression analysis? Thank you :) -- View this message in context: http://r.789695.n4.nabble.com/Stepwise-analysis-with-fixed-variables-tp4650015p4650283.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] size of the side panel in gvisMotionChart
Hello, Is there an option parameter to increase the size of the bottom right side panel in gvisMotionChart? My data labels are too long for this panel (for example Call butterfly spread @ 2400/2600/2800) and the names are always cut even if I increase the width and height. Regards Xavier [[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] Creating a frequency table for binomial varaible
Hello, I have simulated 30 observations from a binomial(5,0.1) distribution. Now I need to make frequency table( that means I need to tally how many 0's , 1's 2's... 5's) I know that the simple R function table() will do this, but I am afraid that some times I may get zero frequency for some particular values (for example in the above there are 5-0's 10-1's , 14-2's, 10-3's , 11-4's but no any 5's ) So I want to make by frequecy table ( as a date frame) as value freq 0 5 1 10 2 14 3 10 4 11 5 0 How can I create such a table? Forgive me if this is a very basic question. I am new to R. Thank you very much. -- View this message in context: http://r.789695.n4.nabble.com/Creating-a-frequency-table-for-binomial-varaible-tp4650286.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] Stepwise analysis with fixed variables
These are my questions: 1. For example, if this is my code: RegModel = lm(glucose~sex+BMI+height+weight+education+ses,weight=w_without_non_response) summary(RegModel) step(RegModel, direction =backward,scope=list(lower=?,upper=?)) and I want the sex and height variables to be fixed, but the rest of the variables to go into the backward analysis, how should I write the scope function? 2.How can I add an alpha level to the step function as a criterion for the backward regression analysis? Thank you :) -- View this message in context: http://r.789695.n4.nabble.com/Stepwise-analysis-with-fixed-variables-tp4650015p4650280.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] Ben Bolker's '‘emdbook’ Package , rbetabinom
I understood that from the source code. Currently I am referring the suggested articles. Thank you very much for the off-list answer and this reply. -- View this message in context: http://r.789695.n4.nabble.com/Ben-Bolker-s-emdbook-Package-rbetabinom-tp4650056p4650287.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] Controlling the number of interactions of a lme
Is it, bbolker! Thank you very, very much! -- View this message in context: http://r.789695.n4.nabble.com/Controlling-the-number-of-interactions-of-a-lme-tp4650183p4650290.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] Weighted least squares
Hi everyone, I admit I am a bit of an R novice, and I was hoping someone could help me with this error message: Warning message: In lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) : extra arguments weigths are just disregarded. My equation is: lm( Y ~ X1 + X2 + X3, weigths = seq(0.1, 1, by = 0.1)) -- View this message in context: http://r.789695.n4.nabble.com/Weighted-least-squares-tp4650292.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] Creating a frequency table for binomial varaible
As I have to to this in a simulation study for 1000 such binomial variables, I have created a R function as below.. Am I doing in the correct way? or is there any other simplest ways? #using a user defined function to create a frequency distribution create.freq.table- function(x){ values-seq(0,5,by=1) level-seq(0,6,by=1) freq.cut-cut(x,breaks=level,right=FALSE) int.freq.table-table(freq.cut) int.dataframe-data.frame(int.freq.table) final.freq.table-data.frame(cbind(values, Freq=int.dataframe[,2])) return(final.freq.table) } -- View this message in context: http://r.789695.n4.nabble.com/Creating-a-frequency-table-for-binomial-varaible-tp4650286p4650295.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] Creating a frequency table for binomial varaible
Hello, Try table(x) # or table(dat$value) Hope this helps, Rui Barradas Em 21-11-2012 13:19, arun4 escreveu: Hello, I have simulated 30 observations from a binomial(5,0.1) distribution. Now I need to make frequency table( that means I need to tally how many 0's , 1's 2's... 5's) I know that the simple R function table() will do this, but I am afraid that some times I may get zero frequency for some particular values (for example in the above there are 5-0's 10-1's , 14-2's, 10-3's , 11-4's but no any 5's ) So I want to make by frequecy table ( as a date frame) as value freq 0 5 1 10 2 14 3 10 4 11 5 0 How can I create such a table? Forgive me if this is a very basic question. I am new to R. Thank you very much. -- View this message in context: http://r.789695.n4.nabble.com/Creating-a-frequency-table-for-binomial-varaible-tp4650286.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] dúvidas com matriz de correlação e covariancia
Olá É melhor escreveres em inglês, esta lista é anglófona. As for your file, r-help doesn't like attachments, use ?dput instead: dput( head(dados, 30) ) # paste the output of this in a post Hope this helps, Rui Barradas Em 21-11-2012 11:03, alanaro...@sapo.pt escreveu: Bom dia eu chamo-me Ana, estou a tentar fazer matriz de correlação e covariancia para comparar 4 variaveis e saber quais são as mehores... fiz o segundo codigo mas devo tar a fazer alguma confusão para nao me aparecer o output correcto: cor(dados[,2:5],method=c(pearson)) cor_with_p_test(dados[2:5]) ct - cor.test(dados[,2:5]) ct$p ct$v #matriz de covariancias cov(dados[,2:5], na.rm=TRUE) mando o arquivo de dados em anexo. Aguardando uma resposta, desde já agradeço. eSubescrevo-m Ana Rocha __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Weighted least squares
Hi, That message usually means that an unknown argument has been supplied to the function. In this case you have spelt weights incorrectly. Best wishes Martyn -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of rbowman16 Sent: 21 November 2012 14:34 To: r-help@r-project.org Subject: [R] Weighted least squares Hi everyone, I admit I am a bit of an R novice, and I was hoping someone could help me with this error message: Warning message: In lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) : extra arguments weigths are just disregarded. My equation is: lm( Y ~ X1 + X2 + X3, weigths = seq(0.1, 1, by = 0.1)) -- View this message in context: http://r.789695.n4.nabble.com/Weighted-least-squares-tp4650292.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. This e-mail has been scanned for all viruses by Star.\ _...{{dropped:12}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Creating a frequency table for binomial varaible
I know that the simple R function table() will do this, but I am afraid that some times I may get zero frequency for some particular values Make a factor out of your data, specifying all the levels you want counts for, and pass that factor to table(). E.g., x - rep(0:6, c(5,2,0,3,0,4,0)) table(x) x 0 1 3 5 5 2 3 4 table(factor(x, levels=0:10)) 0 1 2 3 4 5 6 7 8 9 10 5 2 0 3 0 4 0 0 0 0 0 Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of arun4 Sent: Wednesday, November 21, 2012 5:20 AM To: r-help@r-project.org Subject: [R] Creating a frequency table for binomial varaible Hello, I have simulated 30 observations from a binomial(5,0.1) distribution. Now I need to make frequency table( that means I need to tally how many 0's , 1's 2's... 5's) I know that the simple R function table() will do this, but I am afraid that some times I may get zero frequency for some particular values (for example in the above there are 5-0's 10-1's , 14-2's, 10-3's , 11-4's but no any 5's ) So I want to make by frequecy table ( as a date frame) as value freq 0 5 1 10 2 14 3 10 4 11 5 0 How can I create such a table? Forgive me if this is a very basic question. I am new to R. Thank you very much. -- View this message in context: http://r.789695.n4.nabble.com/Creating-a-frequency- table-for-binomial-varaible-tp4650286.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] Stepwise analysis with fixed variables
On Nov 21, 2012, at 6:41 AM, Einat einatgra...@gmail.com wrote: These are my questions: 1. For example, if this is my code: RegModel = lm(glucose~sex+BMI+height+weight+education+ses,weight=w_without_non_response) summary(RegModel) step(RegModel, direction =backward,scope=list(lower=?,upper=?)) and I want the sex and height variables to be fixed, but the rest of the variables to go into the backward analysis, how should I write the scope function? 2.How can I add an alpha level to the step function as a criterion for the backward regression analysis? Thank you :) First, I strongly suggest that you search on the problems associated with using stepwise regression and alternative approaches. This subject has been discussed ad infinitum on this list and is not a reasonable approach to covariate selection. To your first question, which Uwe replied to and which I thought was pretty clear: scope = list(upper = ~ sex + BMI + height + weight + education + ses, lower = ~ sex + height) It is described in the Details section of ?step and there is an example of this in ?stepAIC in VR's MASS package, which is a default part of R and is linked in the See Also section of ?step. To your second question, you can't. It uses AIC and this has also been discussed frequently on this list. You might look at Frank's fastbw() function in his 'rms' package on CRAN. Regards, Marc Schwartz __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Stepwise analysis with fixed variables
Hi I am not at all an expert in step. From the help page I inferred that step(lm1, scope=list(lower=~Catholic)) keeps Catholic in model. So something like step(RegModel, direction =backward,scope=list(lower=~sex+height)) shall leave those two in a model. AFAIK there is no parameter alpha in a step function. Regards Petr -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of Einat Sent: Wednesday, November 21, 2012 1:41 PM To: r-help@r-project.org Subject: Re: [R] Stepwise analysis with fixed variables These are my questions: 1. For example, if this is my code: RegModel = lm(glucose~sex+BMI+height+weight+education+ses,weight=w_without_non_res ponse) summary(RegModel) step(RegModel, direction =backward,scope=list(lower=?,upper=?)) and I want the sex and height variables to be fixed, but the rest of the variables to go into the backward analysis, how should I write the scope function? 2.How can I add an alpha level to the step function as a criterion for the backward regression analysis? Thank you :) -- View this message in context: http://r.789695.n4.nabble.com/Stepwise- analysis-with-fixed-variables-tp4650015p4650283.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] creat an interactive graph
I'd use ggplot2 and combine geom_bar() and coord_polar() Google the LearningR blog and find the consultant's chart entry. Michael On Wednesday, November 21, 2012, Henry Smith wrote: Hello! Does anyone get any idea how to generate a following graph by using R? http://www.fastcodesign.com/multisite_files/codesign/imagecache/inline-large/post-inline/inline-north-carolina-gay-rights.jpg Any information or hint will be highly appreciated. Kind regards, Henry [[alternative HTML version deleted]] __ R-help@r-project.org javascript:; mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] lists as matrix cells ?
Dear R experts, since more or less half a year I am using R. In many of my computations I construct huge matrices. Often I do so using 'cbind' on named lists: do.call( 'cbind', list( Column_A=list(Row_one=1.0, Row_two=2.0, Row_three=3.0), Column_B=list(Row_one=4.0, Row_two=5.0, Row_three=6.0) ) ) # Returns: Column_A Column_B Row_one 14 Row_two 25 Row_three 36 In some cases I even construct matrices with lists as cell content: do.call( 'cbind', list( Column_A=list(Row_one=list(1.0, 2.0), Row_two=list(2.0, 3.0), Row_three=list(3.0, 4.0)), Column_B=list(Row_one=list(4.0, 5.0), Row_two=list(5.0, 6.0), Row_three=list(6.0, 7.0)) ) ) # Returns: Column_A Column_B Row_one List,2 List,2 Row_two List,2 List,2 Row_three List,2 List,2 Interestingly I seem not to be able to initialize a 3*2 matrix and subsequently fill its cells with lists in order to produce the latter example: m - matrix( nrow=3, ncol=2, dimnames=list( c(Row_one, Row_two, Row_three), c(Column_A, Column_B) ) ) # Returns: Column_A Column_B Row_one NA NA Row_two NA NA Row_three NA NA # The following expressions produce the same error: m[ Row_one, Column_A ] - list(1.0, 2.0) m[[ Row_one, Column_A ]] - list(1.0, 2.0) m[ 1,1 ] - list(1.0, 2.0) m[[ 1,1 ]] - list(1.0, 2.0) # Error returned by each of the above expressions: *number of items to replace is not a multiple of replacement length* *So, now my questions:* *1)* What am I doing wrong? How to get the above to work? *2)* Or am I misusing matrices in R? Is it just by coincidence ( bug ) that my 'cbind' or 'rbind' calls can generate matrices with lists as cell content, while I seem not to be able to do so by direct assignment (as in above example expressions)? Any ideas, comments and help will be much appreciated! Kind regards! Josef [[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] Scaling values 0-255 - -1 , 1 - how can this be done?
I have a dataframe in which I have values 0-255, I wish to transpose them such that: if value 127.5 value = 1 if value 127.5 value = -1 I did something similar using the binarize function of the biclust package, this transforms my dataframe to 0 and 1 values, but I wish to use -1 and 1 and looking for a way in R to do this. Brian __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Creating a frequency table for binomial varaible
Thank you A.K Btw in which package count() is available? -- View this message in context: http://r.789695.n4.nabble.com/Creating-a-frequency-table-for-binomial-varaible-tp4650286p4650305.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] installing Rmpi on centos 6 with mpich
Hello everyone im trying to install Rmpi library on centos 6. I have already installed mpich2 1.4 [root@localhost ~]# R --version R version 2.15.1 (2012-06-22) -- Roasted Marshmallows Copyright (C) 2012 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: x86_64-redhat-linux-gnu (64-bit) [root@localhost ~]# mpich2version MPICH2 Version: 1.4.1p1 MPICH2 Release date: Thu Sep 1 13:53:02 CDT 2011 MPICH2 Device: ch3:nemesis MPICH2 configure: MPICH2 CC: gcc-O2 MPICH2 CXX: c++ -O2 MPICH2 F77: gfortran -O2 MPICH2 FC: f95 -O2 when i issue the install order i get this output: install.packages(Rmpi) Installing package(s) into /usr/lib64/R/library (as lib is unspecified) trying URL 'http://cran.rstudio.com/src/contrib/Rmpi_0.6-1.tar.gz' Content type 'application/x-gzip' length 92977 bytes (90 Kb) opened URL == downloaded 90 Kb * installing *source* package Rmpi ... ** package Rmpi successfully unpacked and MD5 sums checked checking for gcc... gcc -m64 -std=gnu99 checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc -m64 -std=gnu99 accepts -g... yes checking for gcc -m64 -std=gnu99 option to accept ISO C89... none needed I am here /usr/local and it is OpenMPI Trying to find mpi.h ... Found in /usr/local/include Trying to find libmpi.so or libmpich.a ... checking for main in -lmpi... no libmpi not found. exiting... ERROR: configuration failed for package Rmpi * removing /usr/lib64/R/library/Rmpi The downloaded source packages are in /tmp/RtmpBvTTqc/downloaded_packages Updating HTML index of packages in '.Library' Making packages.html ... done Warning message: In install.packages(Rmpi) : installation of package Rmpi had non-zero exit status I have tried with different configure.args but the result is the same, i cant seem to install it... Is there someone who has been through the same problem? or that knows a guide i can follow or something? Thanks in advance Ricardo [[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] Creating a frequency table for binomial varaible
Thank you Bill Dunlap . This seems very simple. -- View this message in context: http://r.789695.n4.nabble.com/Creating-a-frequency-table-for-binomial-varaible-tp4650286p4650312.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 with loop
Hi, I have used R for some time, but managed to avoid writing loops. But this time I am afraid there is no way around it. I have a dataframe with time and salinity (see below). I would like to extract the time intervals where salinity changes by less than 0.05. So using the values below this would mean that a subset was made from 2003-07-19 to 2003-07-24, where the change in salinity exceeded 0.05, and then stating again from 2003-07-24. In other words, I want to make subset of the time intervals where the one variable stays stabile within a certain set range. head (D, 10) Salt time 1 35.65114 2003-07-19 2 35.64226 2003-07-20 3 35.62411 2003-07-21 4 35.62473 2003-07-22 5 35.65893 2003-07-23 6 35.70140 2003-07-24 7 35.62157 2003-07-25 8 35.64122 2003-07-26 9 35.63515 2003-07-27 10 35.63798 2003-07-28 Is this possible? Can some please help with how I need to write the loop to achieve this? Many thanks, Helen -- View this message in context: http://r.789695.n4.nabble.com/Help-with-loop-tp4650313.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] installing Rmpi on centos 6 with mpich
Hello everyone im trying to install Rmpi library on centos 6. I have already installed mpich2 1.4 [root@localhost ~]# R --version R version 2.15.1 (2012-06-22) -- Roasted Marshmallows Copyright (C) 2012 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: x86_64-redhat-linux-gnu (64-bit) [root@localhost ~]# mpich2version MPICH2 Version: 1.4.1p1 MPICH2 Release date: Thu Sep 1 13:53:02 CDT 2011 MPICH2 Device: ch3:nemesis MPICH2 configure: MPICH2 CC: gcc-O2 MPICH2 CXX: c++ -O2 MPICH2 F77: gfortran -O2 MPICH2 FC: f95 -O2 when i issue the install order i get this output: install.packages(Rmpi) Installing package(s) into /usr/lib64/R/library (as lib is unspecified) trying URL 'http://cran.rstudio.com/src/contrib/Rmpi_0.6-1.tar.gz' Content type 'application/x-gzip' length 92977 bytes (90 Kb) opened URL == downloaded 90 Kb * installing *source* package Rmpi ... ** package Rmpi successfully unpacked and MD5 sums checked checking for gcc... gcc -m64 -std=gnu99 checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc -m64 -std=gnu99 accepts -g... yes checking for gcc -m64 -std=gnu99 option to accept ISO C89... none needed I am here /usr/local and it is OpenMPI Trying to find mpi.h ... Found in /usr/local/include Trying to find libmpi.so or libmpich.a ... checking for main in -lmpi... no libmpi not found. exiting... ERROR: configuration failed for package Rmpi * removing /usr/lib64/R/library/Rmpi The downloaded source packages are in /tmp/RtmpBvTTqc/downloaded_packages Updating HTML index of packages in '.Library' Making packages.html ... done Warning message: In install.packages(Rmpi) : installation of package Rmpi had non-zero exit status I have tried with different configure.args but the result is the same, i cant seem to install it... Is there someone who has been through the same problem? or that knows a guide i can follow or something? Thanks in advance Ricardo [[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 with if statement
Hi all, I had a dataset A like: TIME DV 0 0 1 10 520 24 30 36 80 48 60 72 15 I would like to add 24 to those values higher than 24 in the TIME column. I did the following: If (A$TIME=24) { A$TIME - A$TIME+24} It did not work. How should I do it? Thanks, -- View this message in context: http://r.789695.n4.nabble.com/help-with-if-statement-tp4650315.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] Finding a max
My data looks like this: X Y1(X) Y2(X) i want to find the values of x that maximize Y1 and Y2. Right now I'm getting the answer but I would like to know if there is a more efficient/elegant way of doing this. This code reproduces what I'm doing: [code] prop3-structure(list(effort = c(0, 0.008989899, 0.017979798, 0.026969697, 0.035959596, 0.044949495, 0.053939394, 0.062929293, 0.071919192, 0.080909091, 0.08989899, 0.09889, 0.107878788, 0.116868687, 0.125858586, 0.134848485, 0.143838384, 0.152828283, 0.161818182, 0.170808081, 0.17979798, 0.188787879, 0.19778, 0.206767677, 0.215757576, 0.224747475, 0.233737374, 0.242727273, 0.251717172, 0.260707071, 0.26969697, 0.278686869, 0.287676768, 0.29667, 0.305656566, 0.314646465, 0.323636364, 0.332626263, 0.341616162, 0.350606061, 0.35959596, 0.368585859, 0.377575758, 0.386565657, 0.39556, 0.404545455, 0.413535354, 0.422525253, 0.431515152, 0.440505051, 0.44949495, 0.458484849, 0.467474748, 0.476464647, 0.485454546, 0.49445, 0.503434344, 0.512424243, 0.521414142, 0.530404041, 0.53939394, 0.548383839, 0.557373738, 0.566363637, 0.575353536, 0.584343435, 0.59334, 0.602323233, 0.611313132, 0.620303031, 0.62929293, 0.638282829, 0.647272728, 0.656262627, 0.665252526, 0.674242425, 0.683232324, 0.69223, 0.701212122, 0.710202021, 0.71919192, 0.728181819, 0.737171718, 0.746161617, 0.755151516, 0.764141415, 0.773131314, 0.782121213, 0.79112, 0.800101011, 0.80909091, 0.818080809, 0.827070708, 0.836060607, 0.845050506, 0.854040405, 0.863030304, 0.872020203, 0.881010102, 0.89001), Low = c(7118.22889879, 7198.74588723, 7202.19756567, 7205.63654441, 7209.06211889, 7212.47354473, 7215.87003521, 7219.25075859, 7222.61483517, 7225.96133418, 7229.28927041, 7232.59760064, 7235.88521975, 7239.15095652, 7242.39356918, 7245.61174055, 7248.8040728, 7251.96908185, 7255.10519126, 7258.21072566, 7261.28390362, 7264.32282997, 7267.32548746, 7270.28972767, 7273.21326125, 7276.0936472, 7278.92828132, 7281.7143836, 7284.44898447, 7287.12890981, 7289.75076469, 7292.31091545, 7294.80547025, 7297.23025772, 7299.5808036, 7301.85230504, 7304.03960253, 7306.13714891, 7308.13897531, 7310.03865366, 7311.82925527, 7313.50330516, 7315.05273141, 7316.46880922, 7317.74209876, 7318.86237619, 7319.81855692, 7320.59861012, 7321.18946333, 7321.57689588, 7321.74541961, 7321.678145, 7321.35663099, 7320.76071577, 7319.86832617, 7318.65526223, 7317.09495336, 7315.15818179, 7312.81276812, 7310.02321309, 7306.7502885, 7302.95056882, 7298.57589369, 7293.57274947, 7287.8817, 7281.43583878, 7274.16127505, 7265.97457404, 7256.78217653, 7246.47872816, 7234.94528475, 7222.04719437, 7207.63158811, 7191.52439555, 7173.52677949, 7153.41085818, 7130.91454853, 7105.73531868, 7077.52257998, 7045.86837049, 7010.29587987, 6970.24522727, 6925.05571843, 6873.94355449, 6815.97361626, 6750.02346243, 6674.73699741, 6588.46429282, 6489.18264441, 6374.39189638, 6240.97402156, 6085.00235313, 5901.47881048, 5683.96641688, 5424.06674216, 5110.66298423, 4728.80081891, 4257.99514316, 3669.60082983, 2922.6078062), High = c(7118.22889879, 7198.73069287, 7202.13567036, 7205.49469474, 7208.80521654, 7212.06454229, 7215.26982532, 7218.41805599, 7221.50605116, 7224.53044288, 7227.48766626, 7230.37394647, 7233.18528464, 7235.91744284, 7238.56592778, 7241.12597328, 7243.59252142, 7245.96020213, 7248.22331114, 7250.3757862, 7252.41118136, 7254.32263905, 7256.1028599, 7257.74407005, 7259.23798555,
Re: [R] Scaling values 0-255 - -1 , 1 - how can this be done?
On Nov 21, 2012, at 9:32 AM, Brian Feeny bfe...@me.com wrote: I have a dataframe in which I have values 0-255, I wish to transpose them such that: if value 127.5 value = 1 if value 127.5 value = -1 I did something similar using the binarize function of the biclust package, this transforms my dataframe to 0 and 1 values, but I wish to use -1 and 1 and looking for a way in R to do this. Brian See ?ifelse ifelse(value 127.5, 1, -1) You might want to think about what happens when value == 127.5 ... Regards, Marc Schwartz __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Scaling values 0-255 - -1 , 1 - how can this be done?
fakedata - data.frame(matrix(sample(1:255, 50, replace=TRUE), ncol=5)) ifelse(fakedata 127.5, 1, -1) Sarah On Wed, Nov 21, 2012 at 10:32 AM, Brian Feeny bfe...@me.com wrote: I have a dataframe in which I have values 0-255, I wish to transpose them such that: if value 127.5 value = 1 if value 127.5 value = -1 I did something similar using the binarize function of the biclust package, this transforms my dataframe to 0 and 1 values, but I wish to use -1 and 1 and looking for a way in R to do this. Brian -- 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] lists as matrix cells ?
A matrix may only contain one data type. By not specifying when you created m, it was filled with logical values of NA. A logical value can't hold a list. You can see that with str(m) which returns: str(m) logi [1:3, 1:2] NA NA NA NA NA NA - attr(*, dimnames)=List of 2 ..$ : chr [1:3] Row_one Row_two Row_three ..$ : chr [1:2] Column_A Column_B If you were to instead specify that the elements of m should be list objects: m - matrix(list(), nrow=3, ncol=2, dimnames=list( c(Row_one, Row_two, Row_three), c(Column_A, Column_B) ) ) (and check with str(m) again) then you can replace those list objects with other list objects m[[ 1,1 ]] - list(1.0, 2.0) Please also note that [ and [[ are not the same thing. I'm not sure this is the most efficient solution for your problem, but since I'm not really sure what your problem is I solved the question asked rather than the underlying problem. Sarah On Wed, Nov 21, 2012 at 11:11 AM, Asis Hallab asis.hal...@gmail.com wrote: Dear R experts, since more or less half a year I am using R. In many of my computations I construct huge matrices. Often I do so using 'cbind' on named lists: do.call( 'cbind', list( Column_A=list(Row_one=1.0, Row_two=2.0, Row_three=3.0), Column_B=list(Row_one=4.0, Row_two=5.0, Row_three=6.0) ) ) # Returns: Column_A Column_B Row_one 14 Row_two 25 Row_three 36 In some cases I even construct matrices with lists as cell content: do.call( 'cbind', list( Column_A=list(Row_one=list(1.0, 2.0), Row_two=list(2.0, 3.0), Row_three=list(3.0, 4.0)), Column_B=list(Row_one=list(4.0, 5.0), Row_two=list(5.0, 6.0), Row_three=list(6.0, 7.0)) ) ) # Returns: Column_A Column_B Row_one List,2 List,2 Row_two List,2 List,2 Row_three List,2 List,2 Interestingly I seem not to be able to initialize a 3*2 matrix and subsequently fill its cells with lists in order to produce the latter example: m - matrix( nrow=3, ncol=2, dimnames=list( c(Row_one, Row_two, Row_three), c(Column_A, Column_B) ) ) # Returns: Column_A Column_B Row_one NA NA Row_two NA NA Row_three NA NA # The following expressions produce the same error: m[ Row_one, Column_A ] - list(1.0, 2.0) m[[ Row_one, Column_A ]] - list(1.0, 2.0) m[ 1,1 ] - list(1.0, 2.0) m[[ 1,1 ]] - list(1.0, 2.0) # Error returned by each of the above expressions: *number of items to replace is not a multiple of replacement length* *So, now my questions:* *1)* What am I doing wrong? How to get the above to work? *2)* Or am I misusing matrices in R? Is it just by coincidence ( bug ) that my 'cbind' or 'rbind' calls can generate matrices with lists as cell content, while I seem not to be able to do so by direct assignment (as in above example expressions)? Any ideas, comments and help will be much appreciated! Kind regards! Josef -- 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] help with if statement
Use ifelse(). ifelse(A$TIME = 24, A$TIME + 24, A$TIME) Please in the future use dput() to provide your data, and explain what did not work means. Sarah On Wed, Nov 21, 2012 at 12:05 PM, york8866 yu_y...@hotmail.com wrote: Hi all, I had a dataset A like: TIME DV 0 0 1 10 520 24 30 36 80 48 60 72 15 I would like to add 24 to those values higher than 24 in the TIME column. I did the following: If (A$TIME=24) { A$TIME - A$TIME+24} It did not work. How should I do it? Thanks, -- 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] Create BATCH file
Try this: http://stat.ethz.ch/R-manual/R-patched/library/utils/html/BATCH.html On Wed, Nov 21, 2012 at 11:58 AM, R_Antony antony.akk...@ge.com wrote: Hi, I have a .R file written many functions into that. My requirement what is, i need to create a batch file for this. No idea, how to create it. Tried it many other ways, but no result !. Could anyone please help me out ? Thanks. Antony. -- View this message in context: http://r.789695.n4.nabble.com/Create-BATCH-file-tp4650277.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] help with if statement
Does A$TIME - ifelse( A$TIME = 24, A$TIME + 24, A$TIME ) what you want? Rgds, Rainer On Wednesday 21 November 2012 09:05:39 york8866 wrote: Hi all, I had a dataset A like: TIME DV 0 0 1 10 520 24 30 36 80 48 60 72 15 I would like to add 24 to those values higher than 24 in the TIME column. I did the following: If (A$TIME=24) { A$TIME - A$TIME+24} It did not work. How should I do it? Thanks, -- View this message in context: http://r.789695.n4.nabble.com/help-with-if-statement-tp4650315.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] installing Rmpi on centos 6 with mpich
On Nov 21, 2012, at 10:40 AM, Ricardo Román Brenes rro...@cenat.ac.cr wrote: Hello everyone im trying to install Rmpi library on centos 6. I have already installed mpich2 1.4 [root@localhost ~]# R --version R version 2.15.1 (2012-06-22) -- Roasted Marshmallows Copyright (C) 2012 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: x86_64-redhat-linux-gnu (64-bit) [root@localhost ~]# mpich2version MPICH2 Version: 1.4.1p1 MPICH2 Release date: Thu Sep 1 13:53:02 CDT 2011 MPICH2 Device: ch3:nemesis MPICH2 configure: MPICH2 CC: gcc-O2 MPICH2 CXX: c++ -O2 MPICH2 F77: gfortran -O2 MPICH2 FC: f95 -O2 when i issue the install order i get this output: install.packages(Rmpi) Installing package(s) into ‘/usr/lib64/R/library’ (as ‘lib’ is unspecified) trying URL 'http://cran.rstudio.com/src/contrib/Rmpi_0.6-1.tar.gz' Content type 'application/x-gzip' length 92977 bytes (90 Kb) opened URL == downloaded 90 Kb * installing *source* package ‘Rmpi’ ... ** package ‘Rmpi’ successfully unpacked and MD5 sums checked checking for gcc... gcc -m64 -std=gnu99 checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc -m64 -std=gnu99 accepts -g... yes checking for gcc -m64 -std=gnu99 option to accept ISO C89... none needed I am here /usr/local and it is OpenMPI Trying to find mpi.h ... Found in /usr/local/include Trying to find libmpi.so or libmpich.a ... checking for main in -lmpi... no libmpi not found. exiting... ERROR: configuration failed for package ‘Rmpi’ * removing ‘/usr/lib64/R/library/Rmpi’ The downloaded source packages are in ‘/tmp/RtmpBvTTqc/downloaded_packages’ Updating HTML index of packages in '.Library' Making packages.html ... done Warning message: In install.packages(Rmpi) : installation of package ‘Rmpi’ had non-zero exit status I have tried with different configure.args but the result is the same, i cant seem to install it... Is there someone who has been through the same problem? or that knows a guide i can follow or something? Thanks in advance Ricardo There is a page here: http://www.stats.uwo.ca/faculty/yu/Rmpi/ which is linked from the CRAN page for the package. On the above page, there is an Installation for Linux link, which is likely to be helpful. Regards, Marc Schwartz __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] installing Rmpi on centos 6 with mpich
i've followed that guide already to no success On Wed, Nov 21, 2012 at 11:34 AM, Marc Schwartz marc_schwa...@me.comwrote: On Nov 21, 2012, at 10:40 AM, Ricardo Román Brenes rro...@cenat.ac.cr wrote: Hello everyone im trying to install Rmpi library on centos 6. I have already installed mpich2 1.4 [root@localhost ~]# R --version R version 2.15.1 (2012-06-22) -- Roasted Marshmallows Copyright (C) 2012 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: x86_64-redhat-linux-gnu (64-bit) [root@localhost ~]# mpich2version MPICH2 Version: 1.4.1p1 MPICH2 Release date: Thu Sep 1 13:53:02 CDT 2011 MPICH2 Device: ch3:nemesis MPICH2 configure: MPICH2 CC: gcc-O2 MPICH2 CXX: c++ -O2 MPICH2 F77: gfortran -O2 MPICH2 FC: f95 -O2 when i issue the install order i get this output: install.packages(Rmpi) Installing package(s) into /usr/lib64/R/library (as lib is unspecified) trying URL 'http://cran.rstudio.com/src/contrib/Rmpi_0.6-1.tar.gz' Content type 'application/x-gzip' length 92977 bytes (90 Kb) opened URL == downloaded 90 Kb * installing *source* package Rmpi ... ** package Rmpi successfully unpacked and MD5 sums checked checking for gcc... gcc -m64 -std=gnu99 checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc -m64 -std=gnu99 accepts -g... yes checking for gcc -m64 -std=gnu99 option to accept ISO C89... none needed I am here /usr/local and it is OpenMPI Trying to find mpi.h ... Found in /usr/local/include Trying to find libmpi.so or libmpich.a ... checking for main in -lmpi... no libmpi not found. exiting... ERROR: configuration failed for package Rmpi * removing /usr/lib64/R/library/Rmpi The downloaded source packages are in /tmp/RtmpBvTTqc/downloaded_packages Updating HTML index of packages in '.Library' Making packages.html ... done Warning message: In install.packages(Rmpi) : installation of package Rmpi had non-zero exit status I have tried with different configure.args but the result is the same, i cant seem to install it... Is there someone who has been through the same problem? or that knows a guide i can follow or something? Thanks in advance Ricardo There is a page here: http://www.stats.uwo.ca/faculty/yu/Rmpi/ which is linked from the CRAN page for the package. On the above page, there is an Installation for Linux link, which is likely to be helpful. Regards, Marc Schwartz [[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 loop
Hello, If I understand it well, this might avoid a loop. dat - read.table(text= Salt time 1 35.65114 2003-07-19 2 35.64226 2003-07-20 3 35.62411 2003-07-21 4 35.62473 2003-07-22 5 35.65893 2003-07-23 6 35.70140 2003-07-24 7 35.62157 2003-07-25 8 35.64122 2003-07-26 9 35.63515 2003-07-27 10 35.63798 2003-07-28 , header = TRUE, stringsAsFactors = FALSE) dat$time - as.Date(dat$time) change - cumsum(c(FALSE, abs(diff(dat$Salt)) 0.05)) split(dat, change) Hope this helps, Rui Barradas Em 21-11-2012 16:39, Hefri escreveu: Hi, I have used R for some time, but managed to avoid writing loops. But this time I am afraid there is no way around it. I have a dataframe with time and salinity (see below). I would like to extract the time intervals where salinity changes by less than 0.05. So using the values below this would mean that a subset was made from 2003-07-19 to 2003-07-24, where the change in salinity exceeded 0.05, and then stating again from 2003-07-24. In other words, I want to make subset of the time intervals where the one variable stays stabile within a certain set range. head (D, 10) Salt time 1 35.65114 2003-07-19 2 35.64226 2003-07-20 3 35.62411 2003-07-21 4 35.62473 2003-07-22 5 35.65893 2003-07-23 6 35.70140 2003-07-24 7 35.62157 2003-07-25 8 35.64122 2003-07-26 9 35.63515 2003-07-27 10 35.63798 2003-07-28 Is this possible? Can some please help with how I need to write the loop to achieve this? Many thanks, Helen -- View this message in context: http://r.789695.n4.nabble.com/Help-with-loop-tp4650313.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] installing Rmpi on centos 6 with mpich
On Nov 21, 2012, at 11:36 AM, Ricardo Román Brenes rro...@cenat.ac.cr wrote: i've followed that guide already to no success That installation guide shows the installation taking place from the CLI outside of R, using R CMD INSTALL ..., not using install.packages() from within an R session, which is what you are showing below. If you have tried that and failed, then I would recommend contacting the package maintainer for assistance or perhaps posting to R-SIG-HPC: https://stat.ethz.ch/mailman/listinfo/r-sig-hpc Marc On Wed, Nov 21, 2012 at 11:34 AM, Marc Schwartz marc_schwa...@me.com wrote: On Nov 21, 2012, at 10:40 AM, Ricardo Román Brenes rro...@cenat.ac.cr wrote: Hello everyone im trying to install Rmpi library on centos 6. I have already installed mpich2 1.4 [root@localhost ~]# R --version R version 2.15.1 (2012-06-22) -- Roasted Marshmallows Copyright (C) 2012 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: x86_64-redhat-linux-gnu (64-bit) [root@localhost ~]# mpich2version MPICH2 Version: 1.4.1p1 MPICH2 Release date: Thu Sep 1 13:53:02 CDT 2011 MPICH2 Device: ch3:nemesis MPICH2 configure: MPICH2 CC: gcc-O2 MPICH2 CXX: c++ -O2 MPICH2 F77: gfortran -O2 MPICH2 FC: f95 -O2 when i issue the install order i get this output: install.packages(Rmpi) Installing package(s) into /usr/lib64/R/library (as lib is unspecified) trying URL 'http://cran.rstudio.com/src/contrib/Rmpi_0.6-1.tar.gz' Content type 'application/x-gzip' length 92977 bytes (90 Kb) opened URL == downloaded 90 Kb * installing *source* package Rmpi ... ** package Rmpi successfully unpacked and MD5 sums checked checking for gcc... gcc -m64 -std=gnu99 checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc -m64 -std=gnu99 accepts -g... yes checking for gcc -m64 -std=gnu99 option to accept ISO C89... none needed I am here /usr/local and it is OpenMPI Trying to find mpi.h ... Found in /usr/local/include Trying to find libmpi.so or libmpich.a ... checking for main in -lmpi... no libmpi not found. exiting... ERROR: configuration failed for package Rmpi * removing /usr/lib64/R/library/Rmpi The downloaded source packages are in /tmp/RtmpBvTTqc/downloaded_packages Updating HTML index of packages in '.Library' Making packages.html ... done Warning message: In install.packages(Rmpi) : installation of package Rmpi had non-zero exit status I have tried with different configure.args but the result is the same, i cant seem to install it... Is there someone who has been through the same problem? or that knows a guide i can follow or something? Thanks in advance Ricardo There is a page here: http://www.stats.uwo.ca/faculty/yu/Rmpi/ which is linked from the CRAN page for the package. On the above page, there is an Installation for Linux link, which is likely to be helpful. Regards, Marc Schwartz [[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] Scaling values 0-255 - -1 , 1 - how can this be done?
x - as.data.frame( matrix( 0:255, nrow = 16 ) ) ifelse( x 127.5, 1, -1 ) Is that what you want? Rgds, Rainer On Wednesday 21 November 2012 10:32:49 Brian Feeny wrote: I have a dataframe in which I have values 0-255, I wish to transpose them such that: if value 127.5 value = 1 if value 127.5 value = -1 I did something similar using the binarize function of the biclust package, this transforms my dataframe to 0 and 1 values, but I wish to use -1 and 1 and looking for a way in R to do this. Brian __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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: is there a R Package for L1-regression (not regression with L1-penalty)
Dear All, Is there a R package for L1-regression (meaning, optimize the sum of absolute deviations, NOT TO BE UNDERSTOOD as regression with L1-penalty) ? Any information will be appreciated. Regards, Chee [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Finding a max
Hello, You're complicating what is simple: prop3$effort[which.max(prop3$Low)] # First maximum of Low prop3$effort[which.max(prop3$High)] # Ditto, of High which.max(prop3$Low) # Row number that maximizes Low which.max(prop3$High) # Row number that maximizes High Hope this helps, Rui Barradas Em 21-11-2012 17:10, Ignacio Martinez escreveu: My data looks like this: X Y1(X) Y2(X) i want to find the values of x that maximize Y1 and Y2. Right now I'm getting the answer but I would like to know if there is a more efficient/elegant way of doing this. This code reproduces what I'm doing: [code] prop3-structure(list(effort = c(0, 0.008989899, 0.017979798, 0.026969697, 0.035959596, 0.044949495, 0.053939394, 0.062929293, 0.071919192, 0.080909091, 0.08989899, 0.09889, 0.107878788, 0.116868687, 0.125858586, 0.134848485, 0.143838384, 0.152828283, 0.161818182, 0.170808081, 0.17979798, 0.188787879, 0.19778, 0.206767677, 0.215757576, 0.224747475, 0.233737374, 0.242727273, 0.251717172, 0.260707071, 0.26969697, 0.278686869, 0.287676768, 0.29667, 0.305656566, 0.314646465, 0.323636364, 0.332626263, 0.341616162, 0.350606061, 0.35959596, 0.368585859, 0.377575758, 0.386565657, 0.39556, 0.404545455, 0.413535354, 0.422525253, 0.431515152, 0.440505051, 0.44949495, 0.458484849, 0.467474748, 0.476464647, 0.485454546, 0.49445, 0.503434344, 0.512424243, 0.521414142, 0.530404041, 0.53939394, 0.548383839, 0.557373738, 0.566363637, 0.575353536, 0.584343435, 0.59334, 0.602323233, 0.611313132, 0.620303031, 0.62929293, 0.638282829, 0.647272728, 0.656262627, 0.665252526, 0.674242425, 0.683232324, 0.69223, 0.701212122, 0.710202021, 0.71919192, 0.728181819, 0.737171718, 0.746161617, 0.755151516, 0.764141415, 0.773131314, 0.782121213, 0.79112, 0.800101011, 0.80909091, 0.818080809, 0.827070708, 0.836060607, 0.845050506, 0.854040405, 0.863030304, 0.872020203, 0.881010102, 0.89001), Low = c(7118.22889879, 7198.74588723, 7202.19756567, 7205.63654441, 7209.06211889, 7212.47354473, 7215.87003521, 7219.25075859, 7222.61483517, 7225.96133418, 7229.28927041, 7232.59760064, 7235.88521975, 7239.15095652, 7242.39356918, 7245.61174055, 7248.8040728, 7251.96908185, 7255.10519126, 7258.21072566, 7261.28390362, 7264.32282997, 7267.32548746, 7270.28972767, 7273.21326125, 7276.0936472, 7278.92828132, 7281.7143836, 7284.44898447, 7287.12890981, 7289.75076469, 7292.31091545, 7294.80547025, 7297.23025772, 7299.5808036, 7301.85230504, 7304.03960253, 7306.13714891, 7308.13897531, 7310.03865366, 7311.82925527, 7313.50330516, 7315.05273141, 7316.46880922, 7317.74209876, 7318.86237619, 7319.81855692, 7320.59861012, 7321.18946333, 7321.57689588, 7321.74541961, 7321.678145, 7321.35663099, 7320.76071577, 7319.86832617, 7318.65526223, 7317.09495336, 7315.15818179, 7312.81276812, 7310.02321309, 7306.7502885, 7302.95056882, 7298.57589369, 7293.57274947, 7287.8817, 7281.43583878, 7274.16127505, 7265.97457404, 7256.78217653, 7246.47872816, 7234.94528475, 7222.04719437, 7207.63158811, 7191.52439555, 7173.52677949, 7153.41085818, 7130.91454853, 7105.73531868, 7077.52257998, 7045.86837049, 7010.29587987, 6970.24522727, 6925.05571843, 6873.94355449, 6815.97361626, 6750.02346243, 6674.73699741, 6588.46429282, 6489.18264441, 6374.39189638, 6240.97402156, 6085.00235313, 5901.47881048, 5683.96641688, 5424.06674216, 5110.66298423, 4728.80081891, 4257.99514316, 3669.60082983, 2922.6078062), High = c(7118.22889879, 7198.73069287,
Re: [R] Finding a max
On Wed, Nov 21, 2012 at 9:51 AM, Rui Barradas ruipbarra...@sapo.pt wrote: Hello, You're complicating what is simple: Fortune? (Well, it's a profound truism that we all should live by -- but I leave it to others to judge whether it meets Fortunes criteria). -- Bert prop3$effort[which.max(prop3$Low)] # First maximum of Low prop3$effort[which.max(prop3$High)] # Ditto, of High which.max(prop3$Low) # Row number that maximizes Low which.max(prop3$High) # Row number that maximizes High Hope this helps, Rui Barradas Em 21-11-2012 17:10, Ignacio Martinez escreveu: My data looks like this: X Y1(X) Y2(X) i want to find the values of x that maximize Y1 and Y2. Right now I'm getting the answer but I would like to know if there is a more efficient/elegant way of doing this. This code reproduces what I'm doing: [code] prop3-structure(list(effort = c(0, 0.008989899, 0.017979798, 0.026969697, 0.035959596, 0.044949495, 0.053939394, 0.062929293, 0.071919192, 0.080909091, 0.08989899, 0.09889, 0.107878788, 0.116868687, 0.125858586, 0.134848485, 0.143838384, 0.152828283, 0.161818182, 0.170808081, 0.17979798, 0.188787879, 0.19778, 0.206767677, 0.215757576, 0.224747475, 0.233737374, 0.242727273, 0.251717172, 0.260707071, 0.26969697, 0.278686869, 0.287676768, 0.29667, 0.305656566, 0.314646465, 0.323636364, 0.332626263, 0.341616162, 0.350606061, 0.35959596, 0.368585859, 0.377575758, 0.386565657, 0.39556, 0.404545455, 0.413535354, 0.422525253, 0.431515152, 0.440505051, 0.44949495, 0.458484849, 0.467474748, 0.476464647, 0.485454546, 0.49445, 0.503434344, 0.512424243, 0.521414142, 0.530404041, 0.53939394, 0.548383839, 0.557373738, 0.566363637, 0.575353536, 0.584343435, 0.59334, 0.602323233, 0.611313132, 0.620303031, 0.62929293, 0.638282829, 0.647272728, 0.656262627, 0.665252526, 0.674242425, 0.683232324, 0.69223, 0.701212122, 0.710202021, 0.71919192, 0.728181819, 0.737171718, 0.746161617, 0.755151516, 0.764141415, 0.773131314, 0.782121213, 0.79112, 0.800101011, 0.80909091, 0.818080809, 0.827070708, 0.836060607, 0.845050506, 0.854040405, 0.863030304, 0.872020203, 0.881010102, 0.89001), Low = c(7118.22889879, 7198.74588723, 7202.19756567, 7205.63654441, 7209.06211889, 7212.47354473, 7215.87003521, 7219.25075859, 7222.61483517, 7225.96133418, 7229.28927041, 7232.59760064, 7235.88521975, 7239.15095652, 7242.39356918, 7245.61174055, 7248.8040728, 7251.96908185, 7255.10519126, 7258.21072566, 7261.28390362, 7264.32282997, 7267.32548746, 7270.28972767, 7273.21326125, 7276.0936472, 7278.92828132, 7281.7143836, 7284.44898447, 7287.12890981, 7289.75076469, 7292.31091545, 7294.80547025, 7297.23025772, 7299.5808036, 7301.85230504, 7304.03960253, 7306.13714891, 7308.13897531, 7310.03865366, 7311.82925527, 7313.50330516, 7315.05273141, 7316.46880922, 7317.74209876, 7318.86237619, 7319.81855692, 7320.59861012, 7321.18946333, 7321.57689588, 7321.74541961, 7321.678145, 7321.35663099, 7320.76071577, 7319.86832617, 7318.65526223, 7317.09495336, 7315.15818179, 7312.81276812, 7310.02321309, 7306.7502885, 7302.95056882, 7298.57589369, 7293.57274947, 7287.8817, 7281.43583878, 7274.16127505, 7265.97457404, 7256.78217653, 7246.47872816, 7234.94528475, 7222.04719437, 7207.63158811, 7191.52439555, 7173.52677949, 7153.41085818, 7130.91454853, 7105.73531868, 7077.52257998, 7045.86837049, 7010.29587987, 6970.24522727, 6925.05571843, 6873.94355449, 6815.97361626, 6750.02346243, 6674.73699741, 6588.46429282, 6489.18264441,
Re: [R] Scaling values 0-255 - -1 , 1 - how can this be done?
HI, You could also use: set.seed(5) x1-data.frame(matrix(sample(0:255,80,replace=TRUE),ncol=10)) library(car) do.call(cbind,lapply(x1,function(x) x-recode(x,0:127.5=-1;127.6:255=1))) # X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 #[1,] -1 1 -1 -1 -1 1 1 -1 1 -1 #[2,] 1 -1 1 -1 -1 -1 1 -1 1 1 #[3,] 1 -1 1 -1 -1 1 -1 -1 1 -1 #[4,] -1 -1 1 1 -1 1 1 -1 -1 1 #[5,] -1 -1 1 -1 1 1 1 1 1 -1 #[6,] 1 1 1 1 1 1 1 -1 1 1 #[7,] 1 -1 -1 -1 -1 1 1 1 1 -1 #[8,] 1 -1 -1 -1 -1 -1 -1 1 1 -1 A.K. - Original Message - From: Brian Feeny bfe...@me.com To: r-help@r-project.org Cc: Sent: Wednesday, November 21, 2012 10:32 AM Subject: [R] Scaling values 0-255 - -1 , 1 - how can this be done? I have a dataframe in which I have values 0-255, I wish to transpose them such that: if value 127.5 value = 1 if value 127.5 value = -1 I did something similar using the binarize function of the biclust package, this transforms my dataframe to 0 and 1 values, but I wish to use -1 and 1 and looking for a way in R to do this. Brian __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Create BATCH file
C:\Program Files\R\R-2.15.1\bin\x64\R.exe CMD BATCH C:\Users\Frank\Documents\R\Projects\Current_Yield\Divs.txt C:\Users\Frank\Documents\R\Projects\Current_Yield\Divs.out Divs.txt contains my R code and the output goes to Divs.out. I always check Divs.out first. If you want to write objects to divs.out, I seem to need to use the print command, not just have the object name: ndivs-nrow(Divs) print(ndivs) Divs_Per_Year-4 print(Divs_Per_Year) Let me know if you have any questions. Thanks, Frank Date: Wed, 21 Nov 2012 02:58:53 -0800 From: antony.akk...@ge.com To: r-help@r-project.org Subject: [R] Create BATCH file Hi, I have a .R file written many functions into that. My requirement what is, i need to create a batch file for this. No idea, how to create it. Tried it many other ways, but no result !. Could anyone please help me out ? Thanks. Antony. -- View this message in context: http://r.789695.n4.nabble.com/Create-BATCH-file-tp4650277.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Sourcing files with Umlaut in path no longer works
Duncan and Peter, thank you very much! Actually, I made a mistake with the path, due to my inexperience with Windows 7 (user instead of users). The R warning then confused me, because I was told that 'C:/user/grömping/documents/publicat/...' wasn't found. In fact, once the path was correct, source worked without problems. Thus, only the warning message did not properly handle the encoding. Best regards, Ulrike Grömping Am 21.11.2012 15:59, schrieb Duncan Murdoch: On 21/11/2012 6:49 AM, Ulrike Grömping wrote: Dear helpeRs, on my new machine - Windows 7 64Bit, R 2.15-2, I can no longer source files for which the path contains the o-Umlaut (ö). As a historical burden, my username is Grömping and contains that Umlaut (I wouldn't have chosen it now, but decided to keep it for easy transfer). I have had the difficulty that I couldn't use the R CMD tools on files with Umlauts in the path (and solved it by having a dedicated directory without umlaut in the path for that purpose), but so far (Windows XP and earlier R versions) sourcing from within R worked fine. The issue is that the o-Umlaut (ö) is always replaced by a capital A with tilde above together with a paragraph symbol (ö). Apparently, the c3b6 used for the o-Umlaut in some encoding is translated back to the ö. Can I somehow fix this? Or is it a bug? I can't reproduce this. The file d:/temp/Grömping/test.R contains cat(it worked!\n) I am on Windows 7 64bit, and I see the following in both 32 and 64 bit R: source(d:/temp/Grömping/test.R) it worked! If I look at Encoding(d:/temp/Grömping/test.R) I get latin1. If I run iconv(d:/temp/Grömping/test.R, latin1, UTF-8) I get a proper UTF-8 string, but if I run iconv(d:/temp/Grömping/test.R, latin1, utf8) I get a string with encoding marked as unknown, and displayed as [1] d:/temp/Grömping/test.R So perhaps you or we have used an unofficial name of the UTF-8 encoding in some conversion. We need to know exactly what you did to pursue this. Duncan Murdoch Duncan Murdoch __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] GEE - order of data?
Hi Anna, In the geeglm help file, it states Data are assumed to be sorted so that observations on a cluster are contiguous rows for all entities in the formula. I'm not sure if you are asking how to sort data, or how your data should be sorted. If your data come from a data frame called dat, it could be done in this way: dat - dat[order(dat$Route), ] geeglm(Pass~Distance, id=Route, corstr=ar1) I think you only need to sort by the id variable. If you need to sort by two variables, you can add them to the order function: dat[order(dat$Var1, dat$Var2), ] I would think you may want to include the day or time as model covariates, but it would depend on the nature of the problem. Hope this is helpful, JoAnn -- View this message in context: http://r.789695.n4.nabble.com/GEE-order-of-data-tp3248588p4650343.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] Remove Column from matrix
Hi frespider, I think the problem is first that you are referring to column names that you haven't yet defined. To add the column names you can use the dimnames argument of the matrix function. Asse - matrix(0,nrow=5,ncol=length(namVar), dimnames = list(NULL, namVar)) JoAnn -- View this message in context: http://r.789695.n4.nabble.com/Remove-Column-from-matrix-tp4650334p4650344.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] help with if statement
On Nov 21, 2012, at 9:05 AM, york8866 wrote: Hi all, I had a dataset A like: TIME DV 0 0 1 10 520 24 30 36 80 48 60 72 15 I would like to add 24 to those values higher than 24 in the TIME column. I did the following: If (A$TIME=24) { A$TIME - A$TIME+24} It did not work. How should I do it? You should study the help pages for if and ifelse: ?if ?ifelse -- David Winsemius, MD Alameda, CA, USA __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Spider Graph
Hi, Is the stars command in the base package or do I need to download? I am looking to make star/radar/spider charts. Thanks! Britt Britt Aronovich Marketing Analyst BAM (Brooklyn Academy of Music) ... Peter Jay Sharp Building 30 Lafayette Ave. Brooklyn, NY 11217-01486 ... P: 718.724.8038 E: baronov...@bam.orgmailto:baronov...@bam.org BAM.org Facebook.com/BAMstage Twitter.com/BAM_Brooklyn [[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] Modify Y axis
How you can change the Y-axis intervals in a graph? Use and ylim command but this command only changes the minimum and maximum values of the axis, I want to do is take the axis values from 10 to 10 for example How I can do? thanks -- View this message in context: http://r.789695.n4.nabble.com/Modify-Y-axis-tp4650329.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] Remove Column from matrix
Hi,, Can I get help with this. I need to remove a column form the matrix if that specific column has his all entry zero, here the code I wrote but it is not working can you help me please namVar - c(TrlgWSST,TrlgWSSE,TrlgWSSR,SSdiff,TrlgWMSE,TrlgWR2,TrlgWR2adj,TrlgSSE,TrlgMSE,TrlgR2,TrlgR2adj,TrSSE,TrMSE,TrR2,TrR2adj,rdf2, TelgSSE,TelgMSE,TelgR2,TelgR2adj,TelgWSSE,TelgWMSE ,TelgWR2,TelgWR2adj,TeSSE,TeMSE,TeR2,TeR2adj,edf2,Runtime) Asse - matrix(0,nrow=5,ncol=length(namVar)) Asse[,1:3]-2 Asse[2,4] -2000 Asse[,5:10]-3 Asse[,11:20]-5 Asse[,21:30]-12 if(all(Asse[,SSdiff]==0)==TRUE){ Asse - Asse[,-which(colnames(Asse)%in%SSdiff)]} -- View this message in context: http://r.789695.n4.nabble.com/Remove-Column-from-matrix-tp4650334.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] histogram help
Hi, I want to generate an histogram and plot on the y axis the percentage of a categorical variable and on the x axis a nominal variable. I want to move the origin to have 2 categories below 0. Hope somebody could help me. Thanks. Best, -- Rosario Ivano Scandurra [[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] Bayesian cluster analysis - R functions
I want to try Bayesian cluster analysis. Someone suggested using package mcclust. Is there a website that says how to install mcclust or another appropriate Bayesian package? Including the appropriate R functions that I can follow? I am trying to get probability of membership for each individual I am trying to cluster Thank you! -- View this message in context: http://r.789695.n4.nabble.com/Bayesian-cluster-analysis-R-functions-tp4650337.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 1000 simulations, error message: plot.new has not been called yet
Hi, I know this is not a mailing list for r, but I posted my question on several help pages and did not get any help. I really don't know how to solve my problem, maybe you could help me? want to simulate stock paths. I have simulated 1000 paths with 22 trading days (1 starting value). Now I want to include it into my presentation, but animated, so I need the png files. I want to create 1000 png files, starting with the first stock path, then the second and so on. So I start with the first path, add a second to the plot, add the third and so on, so at the end I have a plot with 1000 simulations, here is my code: for(i in 1:1000){ #jpeg(paste(1000s,i,.png,sep=)) plot(c(1:23),matrix[,1],type=l,ylim=c(17,24)) lines(c(1:23),matrix[,i],type=l,col=i) #dev.off() } Here is the problem, that each additional part disappears when the loop gets to the next value, so I tried: plot(0,0 , xlim=c(1,23),ylim=c(17,24),xlab=,ylab=) for(i in 1:1000){ jpeg(paste(1000s,i,.png,sep=)) lines(c(1:23),matrix[,i],type=l,col=i) dev.off() } (I know this is not a working example, but my problem is just a logical one with the loop) I get the following error message when I the last code: plot.new has not been called yet. The matrix has 1000 columns and 23 row entries, this should be 1000 simulations of stock pathes for 22 trading days. How can I change that the error does not appear anymore? 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] cluster analysis in R
Thank you for replying! I made a new post asking if there are any websites or files on how to download package mclust (or other Bayesian cluster analysis packages) and the appropriate R functions? Sorry I don't know how this forum works yet -- View this message in context: http://r.789695.n4.nabble.com/cluster-analysis-in-R-tp4649635p4650341.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] printing difftime summary
Hi, I have a vector of difftime objects and I want to see its summary. Alas: --8---cut here---start-8--- summary(infl$delay) LengthClass Mode 9008386 difftime numeric --8---cut here---end---8--- this is almost completely useless. I can use as.numeric: --8---cut here---start-8--- s - summary(as.numeric(infl$delay)) dput(s) structure(c(0.5, 1027, 5969, 29870, 28970, 603100), .Names = c(Min., 1st Qu., Median, Mean, 3rd Qu., Max.), class = c(summaryDefault, table)) s Min. 1st Qu. Median Mean 3rd Qu. Max. 0.5 1027.0 5969.0 29870.0 28970.0 603100.0 --8---cut here---end---8--- but the printed representation is very unreadable: the fact that 603100.0 is almost exactly 7 days is not obvious. Okay, maybe as.difftime will help? --8---cut here---start-8--- as.difftime(s,units=secs) Time differences in secs Min. 1st Qu. Median Mean 3rd Qu. Max. 0.5 1027.0 5969.0 29870.0 28970.0 603100.0 as.difftime(s/3600,units=hours) Time differences in hours Min. 1st Qu. Median Mean 3rd Qu. Max. 1.39e-04 2.852778e-01 1.658056e+00 8.297222e+00 8.047222e+00 1.675278e+02 --8---cut here---end---8--- nope; still unreadable. What I really want to see _printed_ is something likes this: --8---cut here---start-8--- sapply(s,difftime2string) Min. 1st Qu. MedianMean 3rd Qu.Max. 500.00 ms 17.12 min 99.48 min 8.30 hrs 8.05 hrs 6.98 days --8---cut here---end---8--- except that the quotes are not needed in the printed output. Here I wrote: --8---cut here---start-8--- difftime2string - function (x) { if (x 1) return(sprintf(%.2f ms,x*1000)) if (x 100) return(sprintf(%.2f sec,x)) if (x 6000) return(sprintf(%.2f min,x/60)) if (x 108000) return(sprintf(%.2f hrs,x/3600)) if (x 400*24*3600) return(sprintf(%.2f days,x/(24*3600))) sprintf(%.2f years,x/(365.25*24*3600)) } --8---cut here---end---8--- So, what is The Right R Way to print a summary of difftime objects? Thanks! -- Sam Steingold (http://sds.podval.org/) on Ubuntu 12.04 (precise) X 11.0.11103000 http://www.childpsy.net/ http://openvotingconsortium.org http://memri.org http://camera.org http://mideasttruth.com http://pmw.org.il MS Windows: error: the operation completed successfully. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] side by side boxplots
Hi Charlie, I'm not sure what you mean by opposite direction. It would be helpful if you include a simple, self-contained dataset here to illustrate your problem. For side-by-side boxplots, you can use tplot. JoAnn -- View this message in context: http://r.789695.n4.nabble.com/Re-side-by-side-boxplots-tp4650052p4650345.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] remote connection to an Oracle database - using RODBC - RMySQL..?
Dear users, I can access an database oracle database using sql developer. This was done by importing an xml file that contains the login details - username, password and specifies that it uses the KERBEROS_AUTHENTICATION. I'm trying to connect R - so that it can access this database - do sql queries and convert the resulting tables into dataframes. I am a novice in SQL and database access - but a friend provided me with the following approach: library(DBI) library(RMySQL) drvr-dbDriver(MySQL) #Or another driver, say from the RODBC package? acon-dbConnect(drvr, user=ENTER_USERID, dbname=ENTER_NAME, host=ENTER_HOST, port=1521,password=NULL) #password maybe non-null? cmds-dbSendQuery(acon,statement=YOUR SQL QUERY HERE) yourdata-fetch(cmds, n=-1) #Collects all rows and columns of data requested query. I have provided this info changing the relevant info in the dbConnect command and provided the password. However this doesn't work. I suspect because in this command there is not specification of the encryption of the password (i.e., KERBEROS_AUTHENTICATION) When I look at the details of the connection in SQL developer - what is specified is the follow: connection name, username, password (that I cannot see), hostname, port and the SID. Note that although the password here cannot be seen - I believe it is computed by the longer password displaced the the xml file I use to set up the connection with sql developer using the KERBEROS_AUTHENTICATION. Any ideas on how to proceed. Please help. Thank you. Raff. [[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] Scaling values 0-255 - -1 , 1 - how can this be done?
On Nov 21, 2012, at 7:32 AM, Brian Feeny wrote: I have a dataframe in which I have values 0-255, I wish to transpose them such that: if value 127.5 value = 1 if value 127.5 value = -1 c(-1, 1)[ 1+(value 127.5) ] I suspect most will find this less intuitive than `ifelse`, but I find it useful when picking colors or other values from a vector, expecially when the argument is built with findInterval, e.g. c(-1, 1)[ findInterval(value, c(0, 127.5, 255) ) ] Which generalizes much more compactly to multiple intervals than does ifelse. I did something similar using the binarize function of the biclust package, this transforms my dataframe to 0 and 1 values, but I wish to use -1 and 1 and looking for a way in R to do this. -- David Winsemius, MD Alameda, CA, USA __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] histogram help
i think we need some sample data. I would not have thought that you could calculate the percentage of a categorical data so perhaps a simple example of what you are doing would help. John Kane Kingston ON Canada -Original Message- From: rosario.scandu...@gmail.com Sent: Wed, 21 Nov 2012 19:15:53 +0100 To: r-help@r-project.org Subject: [R] histogram help Hi, I want to generate an histogram and plot on the y axis the percentage of a categorical variable and on the x axis a nominal variable. I want to move the origin to have 2 categories below 0. Hope somebody could help me. Thanks. Best, -- Rosario Ivano Scandurra [[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. FREE ONLINE PHOTOSHARING - Share your photos online with your friends and family! Visit http://www.inbox.com/photosharing to find out more! __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help 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 Y axis
?axis On Wed, Nov 21, 2012 at 12:44 PM, Elli ellilti_...@hotmail.com wrote: How you can change the Y-axis intervals in a graph? Use and ylim command but this command only changes the minimum and maximum values of the axis, I want to do is take the axis values from 10 to 10 for example How I can do? thanks -- View this message in context: http://r.789695.n4.nabble.com/Modify-Y-axis-tp4650329.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. -- Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Spider Graph
On Nov 21, 2012, at 9:09 AM, Britt Aronovich wrote: Hi, Is the stars command in the base package No. or do I need to download? No I am looking to make star/radar/spider charts. The `stars` function is in the graphics package which is loaded by default. You should ahve been able to determine this from the console by typing: ?stars -- David Winsemius, MD Alameda, CA, USA __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Modify Y axis
On Nov 21, 2012, at 9:44 AM, Elli wrote: How you can change the Y-axis intervals in a graph? Use and ylim command but this command only changes the minimum and maximum values of the axis, I want to do is take the axis values from 10 to 10 for example How I can do? ?axis You will probably need to suppress the default axis annotation. In base graphics this is done with yaxt=n, which should be remembered as y-axis type is 'none'. -- David Winsemius, MD Alameda, CA, USA __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Spider Graph
is this link of any use? http://www.inside-r.org/packages/cran/fmsb/docs/radarchart John Kane Kingston ON Canada -Original Message- From: baronov...@bam.org Sent: Wed, 21 Nov 2012 12:09:38 -0500 To: r-help@r-project.org Subject: Re: [R] Spider Graph Hi, Is the stars command in the base package or do I need to download? I am looking to make star/radar/spider charts. Thanks! Britt Britt Aronovich Marketing Analyst BAM (Brooklyn Academy of Music) ... Peter Jay Sharp Building 30 Lafayette Ave. Brooklyn, NY 11217-01486 ... P: 718.724.8038 E: baronov...@bam.orgmailto:baronov...@bam.org BAM.org Facebook.com/BAMstage Twitter.com/BAM_Brooklyn [[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. GET FREE SMILEYS FOR YOUR IM EMAIL - Learn more at http://www.inbox.com/smileys Works with AIM®, MSN® Messenger, Yahoo!® Messenger, ICQ®, Google Talk™ and most webmails __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Scaling values 0-255 - -1 , 1 - how can this be done?
Subject: Re: [R] Scaling values 0-255 - -1 , 1 - how can this be done? #Also by taking advantage of numerical interpretation of booleans: x- sample(255) #toy data 2*( x 127.5 ) - 1 #S Ellison *** This email and any attachments are confidential. Any use...{{dropped:8}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] cluster analysis in R
http://cran.r-project.org/web/views/Cluster.html might be a good start Brian On Nov 21, 2012, at 1:36 PM, KitKat wrote: Thank you for replying! I made a new post asking if there are any websites or files on how to download package mclust (or other Bayesian cluster analysis packages) and the appropriate R functions? Sorry I don't know how this forum works yet -- View this message in context: http://r.789695.n4.nabble.com/cluster-analysis-in-R-tp4649635p4650341.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] remote connection to an Oracle database - using RODBC - RMySQL..?
On Nov 21, 2012, at 1:52 PM, Raffaello Vardavas r_varda...@hotmail.com wrote: Dear users, I can access an database oracle database using sql developer. This was done by importing an xml file that contains the login details - username, password and specifies that it uses the KERBEROS_AUTHENTICATION. I'm trying to connect R - so that it can access this database - do sql queries and convert the resulting tables into dataframes. I am a novice in SQL and database access - but a friend provided me with the following approach: library(DBI) library(RMySQL) drvr-dbDriver(MySQL) #Or another driver, say from the RODBC package? acon-dbConnect(drvr, user=ENTER_USERID, dbname=ENTER_NAME, host=ENTER_HOST, port=1521,password=NULL) #password maybe non-null? cmds-dbSendQuery(acon,statement=YOUR SQL QUERY HERE) yourdata-fetch(cmds, n=-1) #Collects all rows and columns of data requested query. I have provided this info changing the relevant info in the dbConnect command and provided the password. However this doesn't work. I suspect because in this command there is not specification of the encryption of the password (i.e., KERBEROS_AUTHENTICATION) When I look at the details of the connection in SQL developer - what is specified is the follow: connection name, username, password (that I cannot see), hostname, port and the SID. Note that although the password here cannot be seen - I believe it is computed by the longer password displaced the the xml file I use to set up the connection with sql developer using the KERBEROS_AUTHENTICATION. Any ideas on how to proceed. Please help. Thank you. Raff. Several comments: 1. Future posts on this subject should be made to R-SIG-DB, not here. More info: https://stat.ethz.ch/mailman/listinfo/r-sig-db 2. Why would you expect to use an R package and driver for MySQL when attempting to access an Oracle server? 3. There is a good starting point on this subject generally in the R Data Import/Export manual: http://cran.r-project.org/doc/manuals/r-release/R-data.html#Relational-databases 4. I would recommend using RODBC, which is what I use. You will of course need to have an ODBC driver for Oracle installed on your system and properly configured. You may need to get that from Oracle or other parties depending upon your OS which is unstated here. You may also need to get assistance with that process from your SysAdmin or DBAdmin. 5. If you use RODBC, there is additional, quite good information in the package vignette, which is accessible by using: vignette(RODBC) post package installation. 6. I don't have any experience using Kerberos authentication on my Oracle server here, so you may have to follow up on the R-SIG-DB list on that point. A search of the archives did not reveal anything material on that point. 7. Alternatives to RODBC would include ROracle and RJDBC via CRAN. Regards, Marc Schwartz __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Remove Column from matrix
Hello, Three things: 1. You don't need an explicit comparison to TRUE, if(all(Asse[,SSdiff]==0)){ will do the same. 2. Your matrix Asse doesn't have colnames, try to see the output of colnames(Asse) You forgot to assign colnames(Asse) - namVar. 3. Even if it did, SSdiff is the 4th column, which you have set to 2000 so the if statement would return FALSE. Hope this helps, Rui Barradas Em 21-11-2012 17:52, frespider escreveu: Hi,, Can I get help with this. I need to remove a column form the matrix if that specific column has his all entry zero, here the code I wrote but it is not working can you help me please namVar - c(TrlgWSST,TrlgWSSE,TrlgWSSR,SSdiff,TrlgWMSE,TrlgWR2,TrlgWR2adj,TrlgSSE,TrlgMSE,TrlgR2,TrlgR2adj,TrSSE,TrMSE,TrR2,TrR2adj,rdf2, TelgSSE,TelgMSE,TelgR2,TelgR2adj,TelgWSSE,TelgWMSE ,TelgWR2,TelgWR2adj,TeSSE,TeMSE,TeR2,TeR2adj,edf2,Runtime) Asse - matrix(0,nrow=5,ncol=length(namVar)) Asse[,1:3]-2 Asse[2,4] -2000 Asse[,5:10]-3 Asse[,11:20]-5 Asse[,21:30]-12 if(all(Asse[,SSdiff]==0)==TRUE){ Asse - Asse[,-which(colnames(Asse)%in%SSdiff)]} -- View this message in context: http://r.789695.n4.nabble.com/Remove-Column-from-matrix-tp4650334.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] Using doMC to run parallel SVM grid search?
Has anyone used doMC to speed up an SVM grid search? I am considering doing like so: library(doMC) registerDoMC() foreach (i=0:3) %dopar% { tuned_part1 - tune.svm(label~., data = trainset, gamma = 10^(-10:-6), cost = 10^(-1:1)) tuned_part2 - tune.svm(label~., data = trainset, gamma = 10^(-5:0), cost = 10^(-1:1)) tuned_part3 - tune.svm(label~., data = trainset, gamma = 10^(1:-5), cost = 10^(-1:1)) tuned_part4 - tune.svm(label~., data = trainset, gamma = 10^(5:10), cost = 10^(-1:1)) } I have a Quad Core processor, so if I understand correctly the above could split that up across the cores. My goal would be a coarse grid search, not sure if the above parameters are good for that, it just seemed like some good starting points. I would just manually look at each of the resulting files, although it would be cool if it resulted in an instance variable being set of the best values. Has anyone used doMC for something like this? Is there a better library to potentially use than doMC for doing something like splitting up an SVM grid search over multiple cores? Brian __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help 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: is there a R Package for L1-regression (not regression with L1-penalty)
Chee Chen chee.c...@yahoo.com writes: Dear All, Is there a R package for L1-regression (meaning, optimize the sum of absolute deviations, NOT TO BE UNDERSTOOD as regression with L1-penalty) ? Yes. Any information will be appreciated. See http://cran.cnr.berkeley.edu/web/views/Robust.html HTH, Chuck __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Regression: standardized coefficients CI
I run 9 WLS regressions in R, with 7 predictors each. What I want to do now is compare: (1) The strength of predictors within each model (assuming all predictors are significant). That is, I want to say whether x1 is stronger than x2, and also say whether it is significantly stronger. I compare strength by simply comparing standardized beta weights, correct? How do I compare if one predictor is significantly stronger than the others? I thought about comparing confidence intervals, but if I understand correctly the confidence intervals are calculated from the unstandardized beta weights, which in this case would not help me, correct? (2) The strength of the same predictor over different models. I want to say whether x1 affects y1 - y9 equally strong or not. How would I do this? I hope that I provided all information that is needed. Thank you T [[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] Integration in R
On 21/11/12 22:26, Rehena Sultana wrote: Dear R - Experts, I am trying to integrate lognormal distribution (mu = -0.3 and sigma2 = 0.00041.. ) based on the some hypothetical data. But I am getting 0 as the result. I have checked that my R-code is correct as code is giving me result for some other data. As I understand, when I am integrating some pdf with in the range of (0, Inf), I should not get 0. How to handle this kind of problem? Please help. Looking forward for your reply. Reproducible example? When I do integrate(function(x){dlnorm(x,meanlog=-0.3,sdlog=sqrt(0.00041))},0,Inf) I get 1 with absolute error 3.5e-06 No problema. Why do you want to integrate it anyhow? You know the answer is 1. Or if you want the integral from 0 to x for some x infinity, just use plnorm(). (???) cheers, Rolf Turner __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Regression: standardized coefficients CI
1. This is a statistics, not an R, question. Post on a statistics list, like stats.stackexchange.com Also... On Wed, Nov 21, 2012 at 12:39 PM, Torvon tor...@gmail.com wrote: I run 9 WLS regressions in R, with 7 predictors each. What I want to do now is compare: (1) The strength of predictors within each model (assuming all predictors are significant). That is, I want to say whether x1 is stronger than x2, and also say whether it is **significantly stronger.** -- I have no idea what this means, though perhaps it is defined somewhere and in some way that I am not familiar with. When you post to a stats list, I suggest you provide a reference so the folks there know what you mean by this. -- Bert I compare strength by simply comparing standardized beta weights, correct? How do I compare if one predictor is significantly stronger than the others? I thought about comparing confidence intervals, but if I understand correctly the confidence intervals are calculated from the unstandardized beta weights, which in this case would not help me, correct? (2) The strength of the same predictor over different models. I want to say whether x1 affects y1 - y9 equally strong or not. How would I do this? I hope that I provided all information that is needed. Thank you T [[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. -- Bert Gunter Genentech Nonclinical Biostatistics Internal Contact Info: Phone: 467-7374 Website: http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] [lattice] print only legend
On Nov 21, 2012, at 1:45 AM, AnjaM wrote: Is it possible to plot (and save) only the legend of a lattice plot? Of course I could make the axes and axis labels transparent and use an empty panel function, but additionally to being a very dirty solution, there would be still a lot of free space on the plot, while I would like to save only the legend as a separate plot without any white space around it. Is there a (nice) way to do this? If you read the help page: ? xyplot ... it should not be too hard to find the section that names the grid function that draws a key. Unsurprisingly, it is `draw.key`. -- David Winsemius, MD Alameda, CA, USA __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Integration in R
But if you use a smaller sdlog value then integrate does get it wrong because it does not find the delta-like function hidden somewhere between 0 and infinity. integrate(function(x){dlnorm(x,meanlog=-0.3,sdlog=0.00041)},0,Inf) 0 with absolute error 0 integrate(function(x){dlnorm(x,meanlog=-0.3,sdlog=0.00041)},0,1) 0 with absolute error 0 Tell it where the bulk of the mass is and it works integrate(function(x)dlnorm(x,-0.3,0.00041), 0.738, 0.743, subdivisions=10^3) 1 with absolute error 4.4e-05 Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Rolf Turner Sent: Wednesday, November 21, 2012 12:57 PM To: Rehena Sultana Cc: r-help@r-project.org Subject: Re: [R] Integration in R On 21/11/12 22:26, Rehena Sultana wrote: Dear R - Experts, I am trying to integrate lognormal distribution (mu = -0.3 and sigma2 = 0.00041.. ) based on the some hypothetical data. But I am getting 0 as the result. I have checked that my R-code is correct as code is giving me result for some other data. As I understand, when I am integrating some pdf with in the range of (0, Inf), I should not get 0. How to handle this kind of problem? Please help. Looking forward for your reply. Reproducible example? When I do integrate(function(x){dlnorm(x,meanlog=-0.3,sdlog=sqrt(0.00041))},0,Inf) I get 1 with absolute error 3.5e-06 No problema. Why do you want to integrate it anyhow? You know the answer is 1. Or if you want the integral from 0 to x for some x infinity, just use plnorm(). (???) cheers, Rolf Turner __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Finding a max
Thanks a lot! On Wed, Nov 21, 2012 at 12:51 PM, Rui Barradas ruipbarra...@sapo.pt wrote: Hello, You're complicating what is simple: prop3$effort[which.max(prop3$**Low)] # First maximum of Low prop3$effort[which.max(prop3$**High)] # Ditto, of High which.max(prop3$Low) # Row number that maximizes Low which.max(prop3$High) # Row number that maximizes High Hope this helps, Rui Barradas Em 21-11-2012 17:10, Ignacio Martinez escreveu: My data looks like this: X Y1(X) Y2(X) i want to find the values of x that maximize Y1 and Y2. Right now I'm getting the answer but I would like to know if there is a more efficient/elegant way of doing this. This code reproduces what I'm doing: [code] prop3-structure(list(effort = c(0, 0.008989899, 0.017979798, 0.026969697, 0.035959596, 0.044949495, 0.053939394, 0.062929293, 0.071919192, 0.080909091, 0.08989899, 0.09889, 0.107878788, 0.116868687, 0.125858586, 0.134848485, 0.143838384, 0.152828283, 0.161818182, 0.170808081, 0.17979798, 0.188787879, 0.19778, 0.206767677, 0.215757576, 0.224747475, 0.233737374, 0.242727273, 0.251717172, 0.260707071, 0.26969697, 0.278686869, 0.287676768, 0.29667, 0.305656566, 0.314646465, 0.323636364, 0.332626263, 0.341616162, 0.350606061, 0.35959596, 0.368585859, 0.377575758, 0.386565657, 0.39556, 0.404545455, 0.413535354, 0.422525253, 0.431515152, 0.440505051, 0.44949495, 0.458484849, 0.467474748, 0.476464647, 0.485454546, 0.49445, 0.503434344, 0.512424243, 0.521414142, 0.530404041, 0.53939394, 0.548383839, 0.557373738, 0.566363637, 0.575353536, 0.584343435, 0.59334, 0.602323233, 0.611313132, 0.620303031, 0.62929293, 0.638282829, 0.647272728, 0.656262627, 0.665252526, 0.674242425, 0.683232324, 0.69223, 0.701212122, 0.710202021, 0.71919192, 0.728181819, 0.737171718, 0.746161617, 0.755151516, 0.764141415, 0.773131314, 0.782121213, 0.79112, 0.800101011, 0.80909091, 0.818080809, 0.827070708, 0.836060607, 0.845050506, 0.854040405, 0.863030304, 0.872020203, 0.881010102, 0.89001), Low = c(7118.22889879, 7198.74588723, 7202.19756567, 7205.63654441, 7209.06211889, 7212.47354473, 7215.87003521, 7219.25075859, 7222.61483517, 7225.96133418, 7229.28927041, 7232.59760064, 7235.88521975, 7239.15095652, 7242.39356918, 7245.61174055, 7248.8040728, 7251.96908185, 7255.10519126, 7258.21072566, 7261.28390362, 7264.32282997, 7267.32548746, 7270.28972767, 7273.21326125, 7276.0936472, 7278.92828132, 7281.7143836, 7284.44898447, 7287.12890981, 7289.75076469, 7292.31091545, 7294.80547025, 7297.23025772, 7299.5808036, 7301.85230504, 7304.03960253, 7306.13714891, 7308.13897531, 7310.03865366, 7311.82925527, 7313.50330516, 7315.05273141, 7316.46880922, 7317.74209876, 7318.86237619, 7319.81855692, 7320.59861012, 7321.18946333, 7321.57689588, 7321.74541961, 7321.678145, 7321.35663099, 7320.76071577, 7319.86832617, 7318.65526223, 7317.09495336, 7315.15818179, 7312.81276812, 7310.02321309, 7306.7502885, 7302.95056882, 7298.57589369, 7293.57274947, 7287.8817, 7281.43583878, 7274.16127505, 7265.97457404, 7256.78217653, 7246.47872816, 7234.94528475, 7222.04719437, 7207.63158811, 7191.52439555, 7173.52677949, 7153.41085818, 7130.91454853, 7105.73531868, 7077.52257998, 7045.86837049, 7010.29587987, 6970.24522727, 6925.05571843, 6873.94355449, 6815.97361626, 6750.02346243, 6674.73699741, 6588.46429282, 6489.18264441, 6374.39189638, 6240.97402156, 6085.00235313, 5901.47881048, 5683.96641688,
Re: [R] update fit (removing insignificant variables)
HI, I am not sure about the ?update() method. You could try this: set.seed(232) mat1-matrix(sample(1:100,80,replace=TRUE),ncol=8) #with 8 columns dat1-data.frame(mat1) names(dat1)[1]-Y fit-lm(Y~.,data=dat1) res-coef(summary(fit)) res # Estimate Std. Error t value Pr(|t|) #(Intercept) 143.763081344 21.9902865 6.53757200 0.02260698 #X2 -0.009030461 0.1103611 -0.08182650 0.94223654 #X3 -1.844809745 0.2655513 -6.94709326 0.02009766 #X4 1.436647351 0.2540660 5.65462216 0.02988003 #X5 -0.005406684 0.2906822 -0.01859998 0.98684896 #X6 -0.050101169 0.1486149 -0.33712071 0.76811703 #X7 0.563284987 0.1204945 4.67477901 0.04284010 #X8 -1.901918462 0.2697166 -7.05154460 0.01952387 Wtd-row.names(res[res[,Pr(|t|)]0.05,]) Wtd1-Wtd[!grepl(\\(.*\\),Wtd)] fit1-lm(as.formula(paste(Y~,paste(Wtd1,collapse=+))),data=dat1) coef(summary(fit1)) # Estimate Std. Error t value Pr(|t|) #(Intercept) 146.8921451 10.87053736 13.51287 3.975711e-05 #X3 -1.9002023 0.10667909 -17.81232 1.023637e-05 #X4 1.4421062 0.09790384 14.72982 2.606788e-05 #X7 0.5726324 0.05396720 10.61075 1.285606e-04 #X8 -1.9560052 0.14204298 -13.77052 3.625118e-05 A.K. From: farnoosh sheikhi farnoosh...@yahoo.com To: arun smartpink...@yahoo.com Sent: Wednesday, November 21, 2012 2:47 PM Subject: update fit (removing insignificant variables) Hi there, I have a question for removing insignificant predictors from fit. The output looks like below but with 170 predictors. Lab_1 0.037928 * Lab_2 0.030423 * Lab_4 0.616122 Lab_7 0.101278 Lab_8 2.44e-06 *** Lab_12 0.003181 ** Lab_14 0.096809 I need to update my model with significant ones. I know if I want to remove one, I use the following code, but I don't know how to do that for 70 insignificant predictors. fit2-update(fit, .~. -Lab_7) Thanks a lot. Best,Farnoosh Sheikhi __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Remove Column from matrix
Hi, I edited the code sorry, I forgot the line before Can you have look again please? Thanks -- View this message in context: http://r.789695.n4.nabble.com/Remove-Column-from-matrix-tp4650334p4650348.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] Remove Column from matrix
Hi, In this particular example, you may not be able to remove any columns: because: namVar - c(TrlgWSST,TrlgWSSE,TrlgWSSR,SSdiff,TrlgWMSE,TrlgWR2,TrlgWR2adj,TrlgSSE,TrlgMSE,TrlgR2,TrlgR2adj,TrSSE,TrMSE,TrR2,TrR2adj,rdf2, TelgSSE,TelgMSE,TelgR2,TelgR2adj,TelgWSSE,TelgWMSE ,TelgWR2,TelgWR2adj,TeSSE,TeMSE,TeR2,TeR2adj,edf2,Runtime) Asse - matrix(0,nrow=5,ncol=length(namVar), dimnames = list(NULL, namVar)) #JoAnn's suggestion Asse[,1:3]-2 Asse[2,4] -2000 Asse[,5:10]-3 Asse[,11:20]-5 Asse[,21:30]-12 Asse[,1:5] # TrlgWSST TrlgWSSE TrlgWSSR SSdiff TrlgWMSE #[1,] 2 2 2 0 3 #[2,] 2 2 2 2000 3 #[3,] 2 2 2 0 3 #[4,] 2 2 2 0 3 #[5,] 2 2 2 0 3 So, if you are not assigning : #Asse[2,4] -2000 Then, Asse[,4] will be all zeros. Asse[,!colSums(abs(Asse))==0] #will remove the columns which are all zeros #or Asse[,!apply(Asse,2,function(x) all(x==0))] #will get the results you wanted. A.K. - Original Message - From: frespider frespi...@hotmail.com To: r-help@r-project.org Cc: Sent: Wednesday, November 21, 2012 12:52 PM Subject: [R] Remove Column from matrix Hi,, Can I get help with this. I need to remove a column form the matrix if that specific column has his all entry zero, here the code I wrote but it is not working can you help me please namVar - c(TrlgWSST,TrlgWSSE,TrlgWSSR,SSdiff,TrlgWMSE,TrlgWR2,TrlgWR2adj,TrlgSSE,TrlgMSE,TrlgR2,TrlgR2adj,TrSSE,TrMSE,TrR2,TrR2adj,rdf2, TelgSSE,TelgMSE,TelgR2,TelgR2adj,TelgWSSE,TelgWMSE ,TelgWR2,TelgWR2adj,TeSSE,TeMSE,TeR2,TeR2adj,edf2,Runtime) Asse - matrix(0,nrow=5,ncol=length(namVar)) Asse[,1:3]-2 Asse[2,4] -2000 Asse[,5:10]-3 Asse[,11:20]-5 Asse[,21:30]-12 if(all(Asse[,SSdiff]==0)==TRUE){ Asse - Asse[,-which(colnames(Asse)%in%SSdiff)]} -- View this message in context: http://r.789695.n4.nabble.com/Remove-Column-from-matrix-tp4650334.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] lmer model specification
I am running version 2.15.2 64 bit version on 64 bit Windows 7. I have a data set with the following structure: Fixed Effect: locationFact Random Effects: datefact, timefact nested in datefact, interactions of datefact and timefact with locationFact I fit the model with the latest version of lme4. The formula is: Thick2 ~ locationFact + (1 | datefact) + (1 | datefact/timefact) + (1 | locationFact:datefact) + (1 | datefact/locationFact:timefact) Other elements of output object are: Linear mixed model fit by REML Random effects: GroupsName Variance Std.Dev. locationFact:timefact:datefact (Intercept) 34.614 5.8833 timefact:datefact(Intercept) 96.795 9.8385 locationFact:datefact (Intercept) 56.375 7.5083 datefact (Intercept) 20.341 4.5101 datefact (Intercept) 20.338 4.5098 datefact (Intercept) 20.340 4.5100 Residual 447.252 21.1483 I tested this model using rmel with another software package and found that the datefact variance is the sum of the 3 datefact variance estimates above. Is there a way to specify the model so I do not get the 3 datefact estimates? The same applies to the datefact BLUPs. I have to add them to get the actual BLUP. Thank you, Roy Robertson __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Creating a frequency table for binomial varaible
Hi, library(plyr) #sorry, forgot about that ?count() Anyway, Bill's solution is much easier and simple. You can also use this: set.seed(25) bindat-rbinom(20,15,0.1) data.frame(value=0:5,freq=sapply(0:5,function(x,y=bindat) length(y[y==x]))) # value freq #1 0 4 #2 1 7 #3 2 6 #4 3 1 #5 4 2 #6 5 0 A.K. - Original Message - From: arun4 arun.ganesh2...@gmail.com To: r-help@r-project.org Cc: Sent: Wednesday, November 21, 2012 10:58 AM Subject: Re: [R] Creating a frequency table for binomial varaible Thank you A.K Btw in which package count() is available? -- View this message in context: http://r.789695.n4.nabble.com/Creating-a-frequency-table-for-binomial-varaible-tp4650286p4650305.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.