Re: [R] Ifelse statement on a factor level data frame
I believe you are in Circle 8.2.7 of The R Inferno. http://www.burns-stat.com/documents/books/the-r-inferno/ Pat On 28/09/2014 05:49, Kate Ignatius wrote: Quick question: I am running the following code on some variables that are factors: dbpmn$IID1new - ifelse(as.character(dbpmn[,2]) == as.character(dbpmn[,(21)]), dbpmn[,20], '') Instead of returning some value it gives me this: c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)) Playing around with the code, gives me some kind of variation to it. Is there some way to get me what I want. The variable that its suppose to give back is a bunch of sampleIDs. 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. -- Patrick Burns pbu...@pburns.seanet.com twitter: @burnsstat @portfolioprobe http://www.portfolioprobe.com/blog http://www.burns-stat.com (home of: 'Impatient R' 'The R Inferno' 'Tao Te Programming') __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] how to get the rows that satisfy a specific condition
in ?which read about arr.ind following jims assumption (column instead of row indices is what you want) this also works: m - matrix(1:20,4) unique(which(m11, arr.ind = T)[,col]) On 27 September 2014 12:23, Jim Lemon j...@bitwrit.com.au wrote: On Fri, 26 Sep 2014 10:15:14 PM Fix Ace wrote: Hello, there, I wonder if there is an easier way that I would only get the rows that satisfies some condition. For example:I have the following matrix, and I would like to output only the 3rd row and 4th row, since only these two rows contain the numbers greater than 11 a [,1] [,2] [,3] [,4] [,5] [1,]159 13 17 [2,]26 10 14 18 [3,]37 11 15 19 [4,]48 12 16 20 a11 [,1] [,2] [,3] [,4] [,5] [1,] FALSE FALSE FALSE TRUE TRUE [2,] FALSE FALSE FALSE TRUE TRUE [3,] FALSE FALSE FALSE TRUE TRUE [4,] FALSE FALSE TRUE TRUE TRUE I have tried to use a[a11, ] and it did not work. Thanks a lot for the help:) Hi Fix Ace, I have to admit that I am unfamiliar with the system of arithmetic that you are employing in the above example. In no system with which I am conversant are 13, 17, 14 and 18 less than or equal to 11. I can only offer the desperate conjecture that you want the third to fifth columns of the matrix rather than the third and fourth rows. If this wild surmise happens to be the case, I suggest that you try this: testmat[,apply(testmat,2,function(x) return(max(x) 11))] Jim __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Ifelse statement on a factor level data frame
Strange that, I did put everything with as.character but all I got was the same... class of dbpmn[,2]) = factor class of dbpmn[,21] = factor class of dbpmn[,20] = data.frame This has to be a problem ??? I can put reproducible output here but not sure if this going to of help here. I think its all about factors and data frames and characters... K. On Sun, Sep 28, 2014 at 1:15 AM, Jim Lemon j...@bitwrit.com.au wrote: On Sun, 28 Sep 2014 12:49:41 AM Kate Ignatius wrote: Quick question: I am running the following code on some variables that are factors: dbpmn$IID1new - ifelse(as.character(dbpmn[,2]) == as.character(dbpmn[,(21)]), dbpmn[,20], '') Instead of returning some value it gives me this: c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)) Playing around with the code, gives me some kind of variation to it. Is there some way to get me what I want. The variable that its suppose to give back is a bunch of sampleIDs. Hi Kate, If I create a little example: dbpmn-data.frame(V1=factor(sample(LETTERS[1:4],20,TRUE)), V2=factor(sample(LETTERS[1:4],20,TRUE)), V3=factor(sample(LETTERS[1:4],20,TRUE))) dbpmn[4]- ifelse(as.character(dbpmn[,1]) == as.character(dbpmn[,(2)]), dbpmn[,3],) dbpmn V1 V2 V3 V4 1 B D C 2 C A D 3 C B A 4 A B C 5 B D B 6 D D A 1 7 D D D 4 8 B C A 9 B D B 10 D C A 11 A D C 12 A C B 13 A A A 1 14 D C A 15 C D B 16 A A B 2 17 A C C 18 B B C 3 19 C C C 3 20 D D D 4 I get what I expect, the numeric value of the third element in dbpmn where the first two elements are equal. I think what you want is: dbpmn[4]- ifelse(as.character(dbpmn[,1]) == as.character(dbpmn[,(2)]), as.character(dbpmn[,3]),) dbpmn V1 V2 V3 V4 1 B D C 2 C A D 3 C B A 4 A B C 5 B D B 6 D D A A 7 D D D D 8 B C A 9 B D B 10 D C A 11 A D C 12 A C B 13 A A A A 14 D C A 15 C D B 16 A A B B 17 A C C 18 B B C C 19 C C C C 20 D D D D Jim __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] help with splitting parts of data frame
Dear All, please help with the following if you can: we have: simt -seq(0,147,by=1) simc -50*exp(-0.01*simt) out1.2 -data.frame(simt,simc) AUC -c(0,apply(matrix(simc),2,function(x) (diff(simt)*(x[-1]+x[-length(x)]))/2 )) df -cbind(out1.2,AUC) z -cumsum(rep(24,max(out1.2$simt/24))) first24 -sum(unlist(c(subset(df, df[, 'simt'] 0 df[, 'simt'] = z[1], 3 second24 -sum(unlist(c(subset(df, df[, 'simt'] z[1] df[, 'simt'] = z[2], 3 third24 -sum(unlist(c(subset(df, df[, 'simt'] z[2] df[, 'simt'] = z[3], 3 fourth24 -sum(unlist(c(subset(df, df[, 'simt'] z[3] df[, 'simt'] = z[4], 3 fifth24 -sum(unlist(c(subset(df, df[, 'simt'] z[4] df[, 'simt'] = z[5], 3 sixth24 -sum(unlist(c(subset(df, df[, 'simt'] z[5] df[, 'simt'] = z[6], 3 last24 -sum(unlist(c(subset(df, df[, 'simt'] z[6] , 3 my end result is to get this vector: c(first24,second24,third24,fourth24,fifth24,sixth24,last24) the important aspect is that z can be of different length, depending on simt, so what I am trying to do is to code the section between the tags above to accommodate any length of z that is greater then 0. I thought of split( df , f = df$id ), where we would need to add a column with name id to df based on the values in z in such a way where for example all rows of id where simt =z[1] would be 1 (or a o whatever) , and 2 (or b or whatever) if simt z[1] and =z[2], and so on, then we could split df based on id and could work with respective columns... This is one thought, but having a hard time figuring out how to add the id column as such that may accommodate z of changing lengths... Or any other ideas that are more suitable would be welcome, thanks, Andras [[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] Ifelse statement on a factor level data frame
Inline. Bert Gunter Genentech Nonclinical Biostatistics (650) 467-7374 Data is not information. Information is not knowledge. And knowledge is certainly not wisdom. Clifford Stoll On Sun, Sep 28, 2014 at 6:38 AM, Kate Ignatius kate.ignat...@gmail.com wrote: Strange that, I did put everything with as.character but all I got was the same... class of dbpmn[,2]) = factor class of dbpmn[,21] = factor class of dbpmn[,20] = data.frame This has to be a problem ??? Indeed -- your failure to read documentation. I suggest you do your due diligence, read Pat Burns's link, and follow the advice given you by posting a reproducible example. More than likely the last will be unnecessary as you will figure it out in the course of doing what you should do. Cheers, Bert I can put reproducible output here but not sure if this going to of help here. I think its all about factors and data frames and characters... K. On Sun, Sep 28, 2014 at 1:15 AM, Jim Lemon j...@bitwrit.com.au wrote: On Sun, 28 Sep 2014 12:49:41 AM Kate Ignatius wrote: Quick question: I am running the following code on some variables that are factors: dbpmn$IID1new - ifelse(as.character(dbpmn[,2]) == as.character(dbpmn[,(21)]), dbpmn[,20], '') Instead of returning some value it gives me this: c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)) Playing around with the code, gives me some kind of variation to it. Is there some way to get me what I want. The variable that its suppose to give back is a bunch of sampleIDs. Hi Kate, If I create a little example: dbpmn-data.frame(V1=factor(sample(LETTERS[1:4],20,TRUE)), V2=factor(sample(LETTERS[1:4],20,TRUE)), V3=factor(sample(LETTERS[1:4],20,TRUE))) dbpmn[4]- ifelse(as.character(dbpmn[,1]) == as.character(dbpmn[,(2)]), dbpmn[,3],) dbpmn V1 V2 V3 V4 1 B D C 2 C A D 3 C B A 4 A B C 5 B D B 6 D D A 1 7 D D D 4 8 B C A 9 B D B 10 D C A 11 A D C 12 A C B 13 A A A 1 14 D C A 15 C D B 16 A A B 2 17 A C C 18 B B C 3 19 C C C 3 20 D D D 4 I get what I expect, the numeric value of the third element in dbpmn where the first two elements are equal. I think what you want is: dbpmn[4]- ifelse(as.character(dbpmn[,1]) == as.character(dbpmn[,(2)]), as.character(dbpmn[,3]),) dbpmn V1 V2 V3 V4 1 B D C 2 C A D 3 C B A 4 A B C 5 B D B 6 D D A A 7 D D D D 8 B C A 9 B D B 10 D C A 11 A D C 12 A C B 13 A A A A 14 D C A 15 C D B 16 A A B B 17 A C C 18 B B C C 19 C C C C 20 D D D D Jim __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Ifelse statement on a factor level data frame
Apologies - you're right. Missed it in the pdf. K. On Sun, Sep 28, 2014 at 10:22 AM, Bert Gunter gunter.ber...@gene.com wrote: Inline. Bert Gunter Genentech Nonclinical Biostatistics (650) 467-7374 Data is not information. Information is not knowledge. And knowledge is certainly not wisdom. Clifford Stoll On Sun, Sep 28, 2014 at 6:38 AM, Kate Ignatius kate.ignat...@gmail.com wrote: Strange that, I did put everything with as.character but all I got was the same... class of dbpmn[,2]) = factor class of dbpmn[,21] = factor class of dbpmn[,20] = data.frame This has to be a problem ??? Indeed -- your failure to read documentation. I suggest you do your due diligence, read Pat Burns's link, and follow the advice given you by posting a reproducible example. More than likely the last will be unnecessary as you will figure it out in the course of doing what you should do. Cheers, Bert I can put reproducible output here but not sure if this going to of help here. I think its all about factors and data frames and characters... K. On Sun, Sep 28, 2014 at 1:15 AM, Jim Lemon j...@bitwrit.com.au wrote: On Sun, 28 Sep 2014 12:49:41 AM Kate Ignatius wrote: Quick question: I am running the following code on some variables that are factors: dbpmn$IID1new - ifelse(as.character(dbpmn[,2]) == as.character(dbpmn[,(21)]), dbpmn[,20], '') Instead of returning some value it gives me this: c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)) Playing around with the code, gives me some kind of variation to it. Is there some way to get me what I want. The variable that its suppose to give back is a bunch of sampleIDs. Hi Kate, If I create a little example: dbpmn-data.frame(V1=factor(sample(LETTERS[1:4],20,TRUE)), V2=factor(sample(LETTERS[1:4],20,TRUE)), V3=factor(sample(LETTERS[1:4],20,TRUE))) dbpmn[4]- ifelse(as.character(dbpmn[,1]) == as.character(dbpmn[,(2)]), dbpmn[,3],) dbpmn V1 V2 V3 V4 1 B D C 2 C A D 3 C B A 4 A B C 5 B D B 6 D D A 1 7 D D D 4 8 B C A 9 B D B 10 D C A 11 A D C 12 A C B 13 A A A 1 14 D C A 15 C D B 16 A A B 2 17 A C C 18 B B C 3 19 C C C 3 20 D D D 4 I get what I expect, the numeric value of the third element in dbpmn where the first two elements are equal. I think what you want is: dbpmn[4]- ifelse(as.character(dbpmn[,1]) == as.character(dbpmn[,(2)]), as.character(dbpmn[,3]),) dbpmn V1 V2 V3 V4 1 B D C 2 C A D 3 C B A 4 A B C 5 B D B 6 D D A A 7 D D D D 8 B C A 9 B D B 10 D C A 11 A D C 12 A C B 13 A A A A 14 D C A 15 C D B 16 A A B B 17 A C C 18 B B C C 19 C C C C 20 D D D D Jim __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help 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 splitting parts of data frame
Andras Farkas motyocska at yahoo.com writes: Dear All, please help with the following if you can: [snip details] first24 -sum(unlist(c(subset(df, df[, 'simt'] 0 df[, 'simt'] = z[1], 3 second24 -sum(unlist(c(subset(df, df[, 'simt'] z[1] df[, 'simt'] = z[2], 3 third24 -sum(unlist(c(subset(df, df[, 'simt'] z[2] df[, 'simt'] = z[3], 3 fourth24 -sum(unlist(c(subset(df, df[, 'simt'] z[3] df[, 'simt'] = z[4], 3 fifth24 -sum(unlist(c(subset(df, df[, 'simt'] z[4] df[, 'simt'] = z[5], 3 sixth24 -sum(unlist(c(subset(df, df[, 'simt'] z[5] df[, 'simt'] = z[6], 3 last24 -sum(unlist(c(subset(df, df[, 'simt'] z[6] , 3 my end result is to get this vector: c(first24,second24,third24,fourth24,fifth24,sixth24,last24) Some hints: see ?xtabs for weighted tabulations and ?cut for forming categories to tabulate. Try to solve this using just those functions, 'c', and the '~' operator. It can be done in one line. 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] Robust Standard Error in R
Hi, In order to have robust standard errors in R, what would be the command that can generate results similar to the robust option in STATA? I tried using the lmrob command from the package robustbase. With that, the Adjusted R squared is quite different from the normal lm command. This does not happen in STATA. Can anybody please enlighten me on this? -Regards Arnab [[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] Robust Standard Error in R
Arnab Dutta arnab.killy at gmail.com writes: Hi, In order to have robust standard errors in R, what would be the command that can generate results similar to the robust option in STATA? I tried using the lmrob command from the package robustbase. With that, the Adjusted R squared is quite different from the normal lm command. This does not happen in STATA. Can anybody please enlighten me on this? -Regards Arnab I think you're looking for the sandwich package example(lm) library(sandwich) sqrt(diag(vcov(lm.D9))) sqrt(diag(vcovHAC(lm.D9))) (or see example(vcovHAC) __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Robust Standard Error in R
On Sun, 28 Sep 2014, Arnab Dutta wrote: Hi, In order to have robust standard errors in R, what would be the command that can generate results similar to the robust option in STATA? This usually refers to sandwich standard errors aka HC or HC0 in case of the linear regression model. These are available in package car or package sandwich. See vignette(sandwich, package = sandwich) for a detailed overview. I tried using the lmrob command from the package robustbase. With that, the Adjusted R squared is quite different from the normal lm command. This performs robust estimation of the linear model while robust standard errors employ the usual OLS estimation and just adjust the subsequent inference. The robustness properties are quite different. While robust standard errors still require that the linear equation for the conditional mean holds for all observations, this is relaxed in robust estimates of the regression coefficients. More details can be found in the reference of the corresponding manuals. This does not happen in STATA. Can anybody please enlighten me on this? -Regards Arnab [[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] Ifelse statement on a factor level data frame
ifelse() often has problems constructing the right type of return value. if you want to keep the data as a factor (with its existing levels) use x[condition] - value instead of ifelse(condition, value, x). E.g., x - factor(c(Large,Small,Small,XLarge), levels=c(Small,Med,Large,XLarge)) x [1] Large Small Small XLarge Levels: Small Med Large XLarge XLarge2Large - function(x) { x[x==XLarge] - Large ; x } XLarge2Large(x) [1] Large Small Small Large Levels: Small Med Large XLarge instead of things like ifelse(x==XLarge, Large, x) [1] 3 1 1 Large If you don't care about the factor levels, then convert x to a character vector. Bill Dunlap TIBCO Software wdunlap tibco.com On Sat, Sep 27, 2014 at 10:13 PM, Jeff Newmiller jdnew...@dcn.davis.ca.us wrote: Not reproducible, ball in your court. However, in the meantime, my suggestion is to not do that. Convert to character before you alter the factor, then convert back when you are done. --- Jeff NewmillerThe . . Go Live... DCN:jdnew...@dcn.davis.ca.usBasics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/BatteriesO.O#. #.O#. with /Software/Embedded Controllers) .OO#. .OO#. rocks...1k --- Sent from my phone. Please excuse my brevity. On September 27, 2014 9:49:41 PM PDT, Kate Ignatius kate.ignat...@gmail.com wrote: Quick question: I am running the following code on some variables that are factors: dbpmn$IID1new - ifelse(as.character(dbpmn[,2]) == as.character(dbpmn[,(21)]), dbpmn[,20], '') Instead of returning some value it gives me this: c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)) Playing around with the code, gives me some kind of variation to it. Is there some way to get me what I want. The variable that its suppose to give back is a bunch of sampleIDs. 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. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] if else statement in loop
I have two data frames For simplicity: X= V1 V2 V3 V4 V5 V6 samas4 samas5 samas6 samas4_father samas5_mother samas6_sibling samas4 samas5 samas6 samas4_father samas5_mother samas6_sibling samas4 samas5 samas6 samas4_father samas5_mother samas6_sibling Y= FID IID FAM01 samas4 FAM01 samas5 FAM01 samas6 I want to set to create a new IID in Y using V4 V5 V6 in X using an ifelse statement in a loop. I've used something like the following (after figuring out my factor problem): for(i in length(1:(2*nrow(X{ Y$IID1new - ifelse((as.character(Y[,2]) == as.characterXl[,i]) X$IID1new != '') , as.character(as.matrix(X[,(2*nrow(X)+i)])),'') } But of course this tends to overwrite. Is there an easy way to set up a loop to replace missing values? This didn't work either but not sure if its as easy as this: Y$IID1new - ifelse((as.character(Y[,2]) == as.characterXl[,i]) X$IID1new != '') , as.character(as.matrix(X[,(2*nrow(X)+i)])),'') for(i in length(2:(2*nrow(X{ ifelse((as.character(Y[,i]) == as.character(Xl[,i])), X[is.na(X$IID1new)] - as.character(as.matrix(X[(2*nrow(X)+i)])),'') } Thanks! K. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Plotting Categorical/Numerical Data?
Hello Everyone, I've created a sample of poker hands being dealt. How can I plot the data visually in R/R-Studio where x=(Card1,Card2) and Y = Frequency Of Occurence? I'm trying to visualize a simulation, to compare to an actual dataset, to determine if the hands being dealt in the actual computer game are fair and in fact random. For example: 5 4 3 2 1 QS AH, 1S 2C, 5H KH Thanks In Advance, Jason E. [[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] optim for maximization
Hi Sir, How to use the optim for maximization. I don't understand the control$fnscale option that is given on help page. It says if the control$fnscale is negative, the function will be maximized. Thanks a lot Padmanand -- Padmanand Madhavan Nambiar Alternate e-mail id : an...@uga.edu (Patience pays) [[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] optim for maximization
Padmanand Madhavan Nambiar padmanandm at gmail.com writes: Hi Sir, How to use the optim for maximization. I don't understand the control$fnscale option that is given on help page. It says if the control$fnscale is negative, the function will be maximized. Thanks a lot Padmanand If 'fn' is your objective function and 'par' is your starting parameter vector, just optim(par=par,fn=fn,control=list(fnscale=-1)) __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] CRAN (and crantastic) updates this week
CRAN (and crantastic) updates this week New packages * ADDT (1.0) Maintainer: Yili Hong Author(s): Yili Hong, Yimeng Xie, and Caleb King License: GPL-2 http://crantastic.org/packages/ADDT Accelerated destructive degradation tests (ADDT) are often used to collect necessary data for assessing the long-term properties of polymeric materials. Based on the collected data, a thermal index (TI) is estimated. The TI can be useful for material rating and comparison. This package performs the least squares (LS) and maximum likelihood (ML) procedures for estimating TI for polymeric materials. The LS approach is a two-step approach that is currently used in industrial standards, while the ML procedure is widely used in the statistical literature. The ML approach allows one to do statistical inference such as quantifying uncertainties in estimation, hypothesis testing, and predictions. Two publicly available datasets are provided to allow users to experiment and practice with the functions. * ASMap (0.3) Maintainer: Julian Taylor Author(s): Julian Taylor julian.tay...@adelaide.edu.au, David Butler david.but...@daff.qld.gov.au. License: GPL (= 2) http://crantastic.org/packages/ASMap Functions for (A)ccurate and (S)peedy linkage map construction, manipulation and diagnosis of double haploid, backcross and and RIL R/qtl objects. This includes extremely fast linkage map clustering and optimal marker ordering using MSTmap (see Wu et al.,2008). * causaleffect (1.0) Maintainer: Santtu Tikka Author(s): Santtu Tikka License: GPL-2 http://crantastic.org/packages/causaleffect An implementation of the complete identification algorithm constructed by Ilya Shpitser and Judea Pearl (2006) for deriving expressions of joint interventional distributions in causal models, which contain unobserved variables and induce directed acyclic graphs. * Compind (1.0) Maintainer: Francesco Vidoli Author(s): Francesco Vidoli, Elisa Fusco License: GPL-3 http://crantastic.org/packages/Compind Compind package contains several functions to enhance approaches to the Composite Indicators (http://stats.oecd.org/glossary/detail.asp?ID=6278}, https://composite-indicators.jrc.ec.europa.eu/) methods, focusing, in particular, on the normalisation and weighting-aggregation steps. * crayon (1.0.0) Maintainer: quot;Gabor Csardiquot; Author(s): Gabor Csardi [aut, cre] License: MIT + file LICENSE http://crantastic.org/packages/crayon Crayon adds support for colored terminal output on terminals that support ANSI color and highlight codes. ANSI color support is automatically detected. Colors and highlighting can be combined and nested. New styles can also be created easily. This package was inspired by the chalk JavaScript project. * deming (1.0-1) Maintainer: Terry Therneau Author(s): Terry Therneau License: LGPL (= 2) http://crantastic.org/packages/deming Generalized Deming regression, Theil-Sen regression and Passing-Bablock regression functions. * documair (0.6-0) Maintainer: Jean-Baptiste Denis Author(s): Jean-Baptiste Denis jean-baptiste.de...@jouy.inra.fr, Regis Pouillot rpouil...@yahoo.fr, Kien Kieu kien.k...@jouy.inra.fr License: GPL (= 2.15) http://crantastic.org/packages/documair Production of R packages from tagged comments introduced within the code and a minimum of additional documentation files. * GenWin (0.1) Maintainer: Timothy M. Beissinger Author(s): Timothy M. Beissinger beissin...@ucdavis.edu License: MIT + file LICENSE http://crantastic.org/packages/GenWin Defines window or bin boundaries for the analysis of genomic data. Boundaries are based on the inflection points of a cubic smoothing spline fitted to the raw data. Along with defining boundaries, a technique to evaluate results obtained from unequally-sized windows is provided. Applications are particularly pertinent for, though not limited to, genome scans for selection based on variability between populations (e.g. using Wright#39;s fixations index, Fst, which measures variability in subpopulations relative to the total population). * ivprobit (1.0) Maintainer: Zaghdoudi Taha Author(s): Zaghdoudi Taha License: Artistic-2.0 http://crantastic.org/packages/ivprobit ivprobit fit an Instrumental variables probit model using the generalized least squares estimator * kofnGA (1.0) Maintainer: Mark A. Wolters Author(s): Mark A. Wolters License: GPL-2 http://crantastic.org/packages/kofnGA Function kofnGA uses a genetic algorithm to choose a subset of a fixed size k from the integers 1:n, such that a user-supplied objective function is minimized at that subset. The selection step is done by tournament selection based on ranks, and elitism may be used to retain a portion of the best solutions from one generation to the next. * MetFns (1.0) Maintainer:
[R] draw piecharts or histograms at the points of a scatterplot
Hi, I?m fairly new to R and have a problem mentioned in the subject ... I want to draw a scatterplot in 3d - either with scatterplot3d or - preferably - with the rgl package - but instead of points or text (text3d command of rgl) I would like to draw either histograms or pie charts to visualize further properties of the objects. Is there a way to do this? Many thanks in advance spok [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] How do I install a Windows package built from source?
Hello, I'm trying to connect to a MongoDB through the rmongodb package. Here is my system info: R version 3.1.1 (2014-07-10) Platform: x86_64-w64-mingw32/x64 (64-bit) I can install the rmongodb package but it won't load, see below: install.packages(rmongodb) Installing package into ‘C:/Users/David/Documents/R/win-library/3.1’ (as ‘lib’ is unspecified) trying URL ' http://cran.revolutionanalytics.com/bin/windows/contrib/3.1/rmongodb_1.6.5.zip ' Content type 'application/zip' length 1155000 bytes (1.1 Mb) opened URL downloaded 1.1 Mb package ‘rmongodb’ successfully unpacked and MD5 sums checked The downloaded binary packages are in C:\Users\David\AppData\Local\Temp\RtmpqSKJi9\downloaded_packages library(rmongodb) Error in get(.packageName, where) : lazy-load database 'P' is corrupt In addition: Warning message: In get(.packageName, where) : internal error -3 in R_decompress1 Error: package or namespace load failed for ‘rmongodb’ So, next I remove it, then try installing with devtools as shown here: library(devtools) install_github(rmongodb, mongosoup) but that just flat out fails to install. So now I've downloaded the source and have successfully built the package with Visual Studio 2012 but I'm not sure how to load it into R. Here is the directory listing: ls Documents/visual studio 2012/Projects/rmongodb/Debug/rmongodb App.xaml Common resources.pri rmongodb.exe rmongodb.ilk rmongodb.pdb AppxManifest.xml MainPage.xaml rmongodb.build.appxrecipe rmongodb.exp rmongodb.lib rmongodb.winmd Any help would be greatly appreciated, Thank you, David Parker [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Plotting Categorical/Numerical Data?
1. Homework? We don't do homework here. 2. I believe what you purport to do is unlikely answer the is it random question. Or, more exactly, may very well give an incorrect answer. To learn what you should do: 3. Post to a statistics (or math) site like stats.stackexchange.com. You gave no details, but it may well be complex. 4. Or consult someone locally with knowledge of probability and statistics. Cheers, Bert Bert Gunter Genentech Nonclinical Biostatistics (650) 467-7374 Data is not information. Information is not knowledge. And knowledge is certainly not wisdom. Clifford Stoll On Sun, Sep 28, 2014 at 12:26 PM, Jason Eyerly ccfdexplo...@gmail.com wrote: Hello Everyone, I've created a sample of poker hands being dealt. How can I plot the data visually in R/R-Studio where x=(Card1,Card2) and Y = Frequency Of Occurence? I'm trying to visualize a simulation, to compare to an actual dataset, to determine if the hands being dealt in the actual computer game are fair and in fact random. For example: 5 4 3 2 1 QS AH, 1S 2C, 5H KH Thanks In Advance, Jason E. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] How do I install a Windows package built from source?
1) This question belongs on R-devel. Please read the Posting Guide. 2) I am almost certain that unless you have built your R software using Visual Studio 2012, you will be unable to use a package built with that tool with your R software. Read the instructions regarding Rtools on CRAN regarding building packages for R on Windows. --- Jeff NewmillerThe . . Go Live... DCN:jdnew...@dcn.davis.ca.usBasics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/BatteriesO.O#. #.O#. with /Software/Embedded Controllers) .OO#. .OO#. rocks...1k --- Sent from my phone. Please excuse my brevity. On September 28, 2014 4:15:33 PM PDT, David K Parker davpar...@gmail.com wrote: Hello, I'm trying to connect to a MongoDB through the rmongodb package. Here is my system info: R version 3.1.1 (2014-07-10) Platform: x86_64-w64-mingw32/x64 (64-bit) I can install the rmongodb package but it won't load, see below: install.packages(rmongodb) Installing package into ‘C:/Users/David/Documents/R/win-library/3.1’ (as ‘lib’ is unspecified) trying URL ' http://cran.revolutionanalytics.com/bin/windows/contrib/3.1/rmongodb_1.6.5.zip ' Content type 'application/zip' length 1155000 bytes (1.1 Mb) opened URL downloaded 1.1 Mb package ‘rmongodb’ successfully unpacked and MD5 sums checked The downloaded binary packages are in C:\Users\David\AppData\Local\Temp\RtmpqSKJi9\downloaded_packages library(rmongodb) Error in get(.packageName, where) : lazy-load database 'P' is corrupt In addition: Warning message: In get(.packageName, where) : internal error -3 in R_decompress1 Error: package or namespace load failed for ‘rmongodb’ So, next I remove it, then try installing with devtools as shown here: library(devtools) install_github(rmongodb, mongosoup) but that just flat out fails to install. So now I've downloaded the source and have successfully built the package with Visual Studio 2012 but I'm not sure how to load it into R. Here is the directory listing: ls Documents/visual studio 2012/Projects/rmongodb/Debug/rmongodb App.xaml Common resources.pri rmongodb.exe rmongodb.ilk rmongodb.pdb AppxManifest.xml MainPage.xaml rmongodb.build.appxrecipe rmongodb.exp rmongodb.lib rmongodb.winmd Any help would be greatly appreciated, Thank you, David Parker [[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.