[R] John M. Chambers Statistical Software Award

2015-12-04 Thread Patrick Breheny
John M. Chambers Statistical Software Award 2016 This is a second announcement for the Chambers Award and reminder that all application materials must be submitted by December 15. The John M. Chambers Statistical Software Award is an annual award given by the Statistical Computing Section of t

Re: [R] Keep only first date from consecutive dates

2015-12-04 Thread David Winsemius
> On Dec 4, 2015, at 1:10 PM, William Dunlap wrote: > > With a data.frame sorted by id, with ties broken by date, as in > your example, you can select rows that are either the start > of a new id group or the start of run of consecutive dates with: > >> w <- c(TRUE, diff(uci$date)>1) | c(TRUE,

Re: [R] Keep only first date from consecutive dates

2015-12-04 Thread William Dunlap
With a data.frame sorted by id, with ties broken by date, as in your example, you can select rows that are either the start of a new id group or the start of run of consecutive dates with: > w <- c(TRUE, diff(uci$date)>1) | c(TRUE, diff(uci$id)!=0) > which(w) [1] 1 4 5 7 > uci[w,] id date

Re: [R] Survival analysis: ERROR: Time and status are different lengths

2015-12-04 Thread Marleen Hamoen
Hi Terry, I already suspected it had something to do with missing values in one of the covariates. I couldn't get the na.action="na.exclude" to work (perhaps this is because I am relatively unexperienced with R), but I managed to solve the problem by using the following command with "complete.case

Re: [R] system.file(...) self-referencing the containing package

2015-12-04 Thread Duncan Murdoch
On 04/12/2015 11:28 AM, Murat Tasan wrote: Perfect, thanks! (Any idea if/where this is documented? I checked through the "Writing R Extensions" doc and couldn't find any mention of it.) It is mentioned in ?getPackageName: " (Currently, the name is stored as the object |.packageName| but don't

Re: [R] Can we use all the functions of R in visual studio? The Rmath.dll and R.dll seems only contain a part of R functions

2015-12-04 Thread Erich Neuwirth
There is statconnDCOM, whoch gives full R as a COM server which can be used from all he Visual languages. It is not free. There are cost free licenses for student and home use, but essentially it is a commercial product. Mor information can be found at www.statconn.com

[R] RPostgreSQL (or even ANSI DBI) parameterized query with IN (...)

2015-12-04 Thread Murat Tasan
Using PostgreSQL's parameterized query form, this works: R> dbSendQuery(CONN, "SELECT * FROM foo WHERE val = $1 OR val = $2", list("bar", "baz")) ... and becomes: SELECT * FROM foo WHERE val = 'bar' OR val = 'baz'; I cannot figure out, however, if something like this is possible with RPostgreSQL

Re: [R] system.file(...) self-referencing the containing package

2015-12-04 Thread Murat Tasan
Perfect, thanks! (Any idea if/where this is documented? I checked through the "Writing R Extensions" doc and couldn't find any mention of it.) Thanks much again, -Murat On Thu, Dec 3, 2015 at 6:42 PM, William Dunlap wrote: > Every package has in it, after it is installed, a character object >

Re: [R] Ordering Filenames stored in list or vector

2015-12-04 Thread Mark Sharp
Mario, I am certain there are more elegant solutions. This is an effort to make the process clear by dividing out each transformation used into separate lines. ## Start of code library(stringi) # This is written in C and C++ (ICU library), is fast, and is well documented. filenames <- c("Q_Read

Re: [R] Question Regarding a nested for loop in R

2015-12-04 Thread MacQueen, Don
I'll hope this isn't homework (R-help has a "don't do people's homework for them" convention), and make a few suggestions. The inner loop is not needed. For example, you can replace for (i in 1:15 ) { Inv1Outcome[i] = if (random[i] <= .25){Inv1Returns[1]} else if (random[i] > .25 & random[i]

Re: [R] Ordering Filenames stored in list or vector

2015-12-04 Thread Henrik Bengtsson
> filenames <- c("Q_Read_prist#1...@1.xls", "Q_Read_prist#1...@10.xls", > "Q_Read_prist#1...@2.xls") > filenames <- gtools::mixedsort(filenames, numeric.type="decimal") > filenames [1] "Q_Read_prist#1...@1.xls" "Q_Read_prist#1...@2.xls" "Q_Read_prist#1...@10.xls" /Henrik On Fri, Dec 4, 2015 a

Re: [R] dataframe rbind

2015-12-04 Thread Troels Ring
Thanks a lot - I should have seen that Best wishes Troels Den 04-12-2015 kl. 17:09 skrev PIKAL Petr: Hi Maybe little bit of studying how functions work can be useful rbind uses to bind two objects together, however you give it only one. Use DF <- rbind(DF, data.frame(a=rnorm(10),b=runif(10),

Re: [R] dataframe rbind

2015-12-04 Thread peter dalgaard
On 04 Dec 2015, at 17:03 , Troels Ring wrote: > Dear friends - I have a very simple question - > I generate a number of dataframes with identical names and want to combine > them into one large dataframe with the same names - > here is an example > > DF <- data.frame(a=rnorm(10),b=runif(10),ID

Re: [R] dataframe rbind

2015-12-04 Thread Bert Gunter
Try reading and following the Help file, ?rbind.data.frame. You are inventing your own syntax, not using R's. Incidentally, growing the frames as you do is generally a bad idea. Search r-help archives for why. Cheers, Bert Bert Gunter "Data is not information. Information is not knowledge. And

Re: [R] For loop coding

2015-12-04 Thread PIKAL Petr
Hi > -Original Message- > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Saba > Sehrish via R-help > Sent: Friday, December 04, 2015 11:21 AM > To: r-help@r-project.org > Subject: [R] For loop coding > > Hi > > I will be grateful if someone please tell me the programming t

Re: [R] dataframe rbind

2015-12-04 Thread David L Carlson
This will work, although depending on what you are trying to do, there may be a better way: > DF <- data.frame(a=rnorm(10),b=runif(10),ID=0) > for (i in 1:10){ + DF <- rbind(DF, data.frame(a=rnorm(10),b=runif(10),ID=i))} > str(DF) 'data.frame': 110 obs. of 3 variables: $ a : num 0.792 0.141

Re: [R] dataframe rbind

2015-12-04 Thread PIKAL Petr
Hi Maybe little bit of studying how functions work can be useful rbind uses to bind two objects together, however you give it only one. Use DF <- rbind(DF, data.frame(a=rnorm(10),b=runif(10),ID=i)) instead. Cheers Petr > -Original Message- > From: R-help [mailto:r-help-boun...@r-pro

Re: [R] Random forest regression: feedback on general approach and possible issues

2015-12-04 Thread Bert Gunter
I would suggest that you post instead on stats.stackexchange.com . This forum is mostly about R programming issues, not statistics (admittedly, the intersection is nonempty, but ...) That stackexchange forum is more about statistics. You might also consider a bioconductor forum, as this appears t

[R] dataframe rbind

2015-12-04 Thread Troels Ring
Dear friends - I have a very simple question - I generate a number of dataframes with identical names and want to combine them into one large dataframe with the same names - here is an example DF <- data.frame(a=rnorm(10),b=runif(10),ID=0) for (i in 1:10){ DF <- DF+rbind(data.frame(a=rnorm(10),

Re: [R] Ordering Filenames stored in list or vector

2015-12-04 Thread Boris Steipe
The thread below has a number of solutions. I personally like the one with sprintf(). https://stat.ethz.ch/pipermail/r-help/2010-July/246059.html B. On Dec 4, 2015, at 5:51 AM, BARLAS Marios 247554 wrote: > Hello everyone, > > I am an R rookie and I'm learning as I program. > > I am work

[R] For loop coding

2015-12-04 Thread Saba Sehrish via R-help
Hi I will be grateful if someone please tell me the programming to run regression on time series data through "For Loop". Regards. Saba Sent from Yahoo Mail on Android [[alternative HTML version deleted]] __ R-help@r-project.org mailing lis

Re: [R] Strange error

2015-12-04 Thread Nicolae Doban
Hi again, i found the error: the problem was that I have created a template of rmarkdown myself inspired from Tufte one and I guess I didn't build it correctly..when i tried running it in a regular rmarkdown template it worked. sorry for inconvenience nick Nicolae (Nick) Doban | Masters student

[R] Random forest regression: feedback on general approach and possible issues

2015-12-04 Thread Johannes Klene
Hi all, I'd like to use random forest regression to say something about the importance of a set of genes (binary) for schizophrenia-related behavior (continuous measure). I am still reading up on this technique, but would already really appreciate any feedback on whether my approach is valid. So...

Re: [R] Question Regarding a nested for loop in R

2015-12-04 Thread MCGUIRE, Rhydwyn
Hi Ryan, I don't think you need the outer loop, loops are worth avoiding if you can possibly can because they are inefficient, have a look at this dplyr tutorial (https://cran.rstudio.com/web/packages/dplyr/vignettes/introduction.html) which should be able to achieve what your outer loop is cu

[R] Ordering Filenames stored in list or vector

2015-12-04 Thread BARLAS Marios 247554
Hello everyone, I am an R rookie and I'm learning as I program. I am working on a script to process a large amount of data: I read a pattern of filenames in the folder I want and import their data filenames = list.files(path, pattern="*Q_Read_prist*") myfiles = lapply(filenames, function(x) re

[R] Can we use all the functions of R in visual studio? The Rmath.dll and R.dll seems only contain a part of R functions

2015-12-04 Thread 李琥
Can we use all the functions of R in visual studio? The Rmath.dll and R.dll seems only contain a part of R functions Hi, I 'm going to use R functions in visual studio. I have investigated this problem for several days. There're guide about using R in embedded way,which use R.dll. But it see

Re: [R] Survival analysis: ERROR: Time and status are different lengths

2015-12-04 Thread Therneau, Terry M., Ph.D.
I expect that reading the result of print(fit.weib) will answer your question. If there were any missing values in the data set, then the fit.weib$linear.predictors will be shorter than the original data set, and the printout will have a note about "...deleted due to missing". The simplest sol

[R] queries return different output when sourced

2015-12-04 Thread Thierry Onkelinx
Dear all, We need to run several queries in an R Markdown file. The queries have quit elaborate sql statements. We try to recude the amount of code in the markdown file by moving the query functions in a seperate R script which is sourced by the markdown file. The queries work fine if we place th