Re: [R] Ifelse statement on a factor level data frame

2014-09-28 Thread Patrick Burns
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]) ==

Re: [R] how to get the rows that satisfy a specific condition

2014-09-28 Thread Sven E. Templer
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:

Re: [R] Ifelse statement on a factor level data frame

2014-09-28 Thread Kate Ignatius
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

[R] help with splitting parts of data frame

2014-09-28 Thread Andras Farkas
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)))

Re: [R] Ifelse statement on a factor level data frame

2014-09-28 Thread Bert Gunter
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

Re: [R] Ifelse statement on a factor level data frame

2014-09-28 Thread Kate Ignatius
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

Re: [R] help with splitting parts of data frame

2014-09-28 Thread Charles Berry
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

[R] Robust Standard Error in R

2014-09-28 Thread Arnab Dutta
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

Re: [R] Robust Standard Error in R

2014-09-28 Thread Ben Bolker
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

Re: [R] Robust Standard Error in R

2014-09-28 Thread Achim Zeileis
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

Re: [R] Ifelse statement on a factor level data frame

2014-09-28 Thread William Dunlap
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

[R] if else statement in loop

2014-09-28 Thread Kate Ignatius
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

[R] Plotting Categorical/Numerical Data?

2014-09-28 Thread Jason Eyerly
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

[R] optim for maximization

2014-09-28 Thread Padmanand Madhavan Nambiar
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

Re: [R] optim for maximization

2014-09-28 Thread Ben Bolker
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

[R] CRAN (and crantastic) updates this week

2014-09-28 Thread Crantastic
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

[R] draw piecharts or histograms at the points of a scatterplot

2014-09-28 Thread rhelp
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

[R] How do I install a Windows package built from source?

2014-09-28 Thread David K Parker
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

Re: [R] Plotting Categorical/Numerical Data?

2014-09-28 Thread Bert Gunter
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

Re: [R] How do I install a Windows package built from source?

2014-09-28 Thread Jeff Newmiller
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