[R] Package rms: c-statistic from lrm function with weights

2016-06-15 Thread Marie-Pierre Sylvestre
Dear list, I am using the lrm function from the rms package to estimate a logistic model with weights. The c-statistic (or area under the curve) is part of the lrm output. To understand how the weights enter the computation of the c-statistics, I looked at the script of lrm and lrm.fit but I am o

[R] cv.binary problem

2016-06-15 Thread Amit Sengupta via R-help
HI,I am analyzing a risk model for type 2 diabetes using a logistic regression. In the final model I have only 6 predictors. The regression gives correct output (fullmod is the fitted model). Now I  try to do cross validation using cv.binary. Any help in resolving this problem will be appreciate

Re: [R] [FORGED] Re: help with r package "trip"

2016-06-15 Thread Michael Sumner
On Wed, 15 Jun 2016 at 18:51 Rolf Turner wrote: > On 15/06/16 20:18, Jim Lemon wrote: > > Hi Alice, > > Have you tried creating a vector of the start position (xpos[1],ypos[1]): > > > > xstart<-rep(xpos[1],n) > > ystart<-rep(ypos[1],n) > > # where "n" is the number of subsequent positions in the

[R] Fwd: help for fine mappting

2016-06-15 Thread greg holly
Dear all; Unfortunately I did not get any response for my following questions. It is time sensitive job. I would be greatly appreciate if you give help soon. Regards, Greg I am sorry for this posting. I have got help from Jim, Bert, Jeff and PIKAL on similar issue before. I tried to modify

Re: [R] dplyr's arrange function

2016-06-15 Thread David Winsemius
> On Jun 15, 2016, at 2:08 PM, Muhuri, Pradip (AHRQ/CFACT) > wrote: > > Hello, > > I am using the dplyr's arrange() function to sort one of the many data > frames on a character variable (named "prevalence"). > > Issue: I am not getting the desired output (line 7 is the problem, which >

Re: [R] dplyr's arrange function

2016-06-15 Thread Jim Lemon
Hi Pradip, I'll assume that you are reading the data from a file: pm.df<-read.csv("pmdat.txt",stringsAsFactors=FALSE) # create a vector of numeric values of prevalence numprev<-as.numeric(sapply(strsplit(trimws(pm.df$prevalence)," "),"[",1)) # order the data frame by that vector pm.df[order(numpre

Re: [R] benchmark-dea

2016-06-15 Thread Jim Lemon
Hi farzana, Probably the first thing is to ascertain what the class of "farzana" might be: class(farzana) Because "write.csv" expects "the object to be written, preferably a matrix or data frame. If not, it is attempted to coerce x to a data frame." to be the first argument. It seems that "farzan

Re: [R] dplyr's arrange function

2016-06-15 Thread Daniel Nordlund
On 6/15/2016 2:08 PM, Muhuri, Pradip (AHRQ/CFACT) wrote: Hello, I am using the dplyr's arrange() function to sort one of the many data frames on a character variable (named "prevalence"). Issue: I am not getting the desired output (line 7 is the problem, which should be the very last line

[R] cv.glm problem

2016-06-15 Thread Amit Sengupta via R-help
HI,I am analyzing a risk model for type 2 diabetes using a logistic regression. In the final model I have only 6 predictors. The regression gives correct output (fullmod is the fitted model). Now I have a subset of dataset (mydata1) with 7 variables (1 response(0/1) + 6 predictors) and try to do

[R] dplyr's arrange function

2016-06-15 Thread Muhuri, Pradip (AHRQ/CFACT)
Hello, I am using the dplyr's arrange() function to sort one of the many data frames on a character variable (named "prevalence"). Issue: I am not getting the desired output (line 7 is the problem, which should be the very last line in the sorted data frame) because the sorted field is cha

Re: [R] Writing R package that call Fortran codes

2016-06-15 Thread Eduardo M. A. M.Mendes
Hi Have you tried to load and run the fortran code using just a wrapper function in R? I do that as the first step in order to build a package. Example: fortran sources -> rk4_mod_r.f90 ,derive_henonheilles.f90, poincare_section.f90 a) I use R CMD SHLIB rk4_mod_r.f90 ,derive_henonheilles

Re: [R] Closing FTP sessions with RCurl

2016-06-15 Thread William Dunlap via R-help
>With the call to gc(), the garbage collector will be called some time in the >future and the finalizers will be run then. Typo: that initial 'With' should be 'Without'. Bill Dunlap TIBCO Software wdunlap tibco.com On Wed, Jun 15, 2016 at 12:57 PM, William Dunlap wrote: > >>rm(curl) # rel

Re: [R] Closing FTP sessions with RCurl

2016-06-15 Thread J Payne
Fantastic!  That did the trick.  I still suspect that there may be a command within RCurl that accomplishes the same thing, but in any case I’m very grateful to have a solution that works.  Best, John From: William Dunlap Date: Wednesday, June 15, 2016 at 12:57 PM To: J Payne Cc: T

[R] Writing R package that call Fortran codes

2016-06-15 Thread Kodalore Vijayan, Vineetha W
Hi, I'm trying to write an R package that calls a Fortran subroutine on my Mac os x El Capitan with Xcode 7 and gfortran 6.1, R 3.3.0. I can build and load the library but when I try to use it in R I get this error: >library(NEpidemic) >random_epi(variable_names) Error in .Fortran("random_epi"

Re: [R] Closing FTP sessions with RCurl

2016-06-15 Thread William Dunlap via R-help
>>rm(curl) # release the curl! (does this end the session???) Try adding a call to gc() immediately after this removal. That will force an immediate run of any finalizer associated with the object just removed. With the call to gc(), the garbage collector will be called some time in the futur

[R] benchmark-dea

2016-06-15 Thread farzana akbari
in the name of God hi dear I use benchmark package to use of dea and when I wanna save my result as csv by this as below write.csv(farzana,'D:sajjaad.csv') I can not and the error is as below Error in as.data.frame.default(x[[i]], optional = TRUE, stringsAsFactors = stringsAsFactors) : c

Re: [R] Closing FTP sessions with RCurl

2016-06-15 Thread J Payne
Thanks Tom! I tried that and it didn’t work, but perhaps there are other problems. The system administrator wrote “I think closing sessions immediately upon completion of the transfer, or continuing to use the same session for additional requests would both have a similar and positive effect.”

Re: [R] Find mean of values in three-dimensional array

2016-06-15 Thread Dénes Tóth
On 06/15/2016 09:05 PM, peter dalgaard wrote: > >> On 15 Jun 2016, at 19:37 , Nick Tulli wrote: >> >> Hey R-Help, >> >> I've got a three dimensional array which I pulled from a netcdf file. >> The data in array are the humidity values of locations in the United >> States over a time period. The

Re: [R] Find mean of values in three-dimensional array

2016-06-15 Thread peter dalgaard
> On 15 Jun 2016, at 19:37 , Nick Tulli wrote: > > Hey R-Help, > > I've got a three dimensional array which I pulled from a netcdf file. > The data in array are the humidity values of locations in the United > States over a time period. The three dimensions are [longitude, > latitude, days], 14

[R] Find mean of values in three-dimensional array

2016-06-15 Thread Nick Tulli
Hey R-Help, I've got a three dimensional array which I pulled from a netcdf file. The data in array are the humidity values of locations in the United States over a time period. The three dimensions are [longitude, latitude, days], 141x81x92. My goal is to find the mean value at each longitude/lat

Re: [R] is there a package in R or functions to calculate odds/hasard ratio from spline regression

2016-06-15 Thread takiy berrandou
Hello, thank you for the answer. it's true i was'nt clear enough. the problem with glm()/gam or coxph() when the spline terms are used (specialy spline of 3rd degree) the calculated coefficients for the spline terms are difficult to interpret. for example for spline of degree=3 and 3 knots, there a

Re: [R] is there a package in R or functions to calculate odds/hasard ratio from spline regression

2016-06-15 Thread David Winsemius
> On Jun 15, 2016, at 9:12 AM, takiy berrandou wrote: > > Hello, > thank you for the answer. it's true i was'nt clear enough. > the problem with glm()/gam or coxph() when the spline terms are used > (specialy spline of 3rd degree) the calculated coefficients for the spline > terms are difficu

Re: [R] inverse table

2016-06-15 Thread David L Carlson
After converting the table to a data frame, replicate each row by the number of observations: > ddd.df <- as.data.frame(ddd) # as.data.frame.table does the same thing > ddd.new <- as.matrix(ddd.df[rep(seq_along(ddd.df[, 1]), ddd.df$Freq), 1:2]) > head(ddd.new) a b 1 "a" "A" 1.1 "a" "A"

Re: [R] inverse table

2016-06-15 Thread Marc Schwartz
> On Jun 15, 2016, at 11:10 AM, Patrizio Frederic > wrote: > > Dear R-users, > I've a problem that puzzle me > > suppose I have a two way contigency table > > a <- sample(al <- letters[1:10],100,T) > b <- sample(bl <- LETTERS[1:5],100,T) > ab <- cbind(a,b) > > ddd <- (xtabs(data = ab)) > dd

Re: [R] inverse table

2016-06-15 Thread Leonardo Fontenelle
Em Qua 15 jun. 2016, às 13:10, Patrizio Frederic escreveu: > Dear R-users, > I've a problem that puzzle me > > suppose I have a two way contigency table > > a <- sample(al <- letters[1:10],100,T) > b <- sample(bl <- LETTERS[1:5],100,T) > ab <- cbind(a,b) > > ddd <- (xtabs(data = ab)) > ddd <- a

Re: [R] inverse table

2016-06-15 Thread Ulrik Stervbo
Hi Patrizio, maybe there is a more efficient way, but you can loop over rows and columns like this ab.recon <- data.frame() ddd.rownames <- rownames(ddd) ddd.colnames <- colnames(ddd) for(cur.row in ddd.rownames){ for(cur.col in ddd.colnames){ times.found <- ddd[cur.row, cur.col] tmp.

[R] inverse table

2016-06-15 Thread Patrizio Frederic
Dear R-users, I've a problem that puzzle me suppose I have a two way contigency table a <- sample(al <- letters[1:10],100,T) b <- sample(bl <- LETTERS[1:5],100,T) ab <- cbind(a,b) ddd <- (xtabs(data = ab)) ddd <- as.matrix(ddd) the question is: how do I reverse the code, thus how do I get raw

Re: [R] is there a package in R or functions to calculate odds/hasard ratio from spline regression

2016-06-15 Thread Leonardo Fontenelle
Em Ter 14 jun. 2016, às 11:43, takiy berrandou escreveu: > Hello, > > I'm looking for a package or function, which calculate OR/HR from spline > model regression. for example in SAS it exist some MACRO helping to do > that > easiely. > > i had make some research on the forum here and on the web b

Re: [R] is there a package in R or functions to calculate odds/hasard ratio from spline regression

2016-06-15 Thread David Winsemius
> On Jun 14, 2016, at 7:43 AM, takiy berrandou wrote: > > Hello, > > I'm looking for a package or function, which calculate OR/HR from spline > model regression. for example in SAS it exist some MACRO helping to do that > easiely. > > i had make some research on the forum here and on the web b

[R] help for fine mappting

2016-06-15 Thread greg holly
dear all; I am sorry for this posting. I have got help from Jim, Bert, Jeff and PIKAL on similar issue before. I tried to modify Jim`s code to the real data but it did not work. Now I am posting first two rows the imitation of real data using dput() format (please see at the bottom). I have two

Re: [R] Error in twitterR package

2016-06-15 Thread Jeff Newmiller
I have never used that package, but the error message seems clear. You need to use the correct arguments to the setup_twitter_oauth function, and that requires that you interact with twitter parsonally to obtain appropriate credentials. While someone here may be able to give you a pointer as to

[R] Y in Kohonen xyf function

2016-06-15 Thread ch.elahe via R-help
Hi all, I have a df and I want to use supervised Self Organizing Map to do classification. I should use Kohonen library and xyf function from it. As you know the xyf function looks like this and I have problem defining my Y: xyf(data,Y,grid=somgrid(),rlen=100,alpha=c(0.05,0.01)) I want to do

Re: [R] messy code found when reading CSV file on win 10 system

2016-06-15 Thread Duncan Murdoch
On 15/06/2016 1:22 AM, 李兰婷 wrote: Dear Team, A problem occured when I run Rstudio. Could you please give me some advice?there is a lot of messy code when I read a csv file, which includes several columns in chinese, and R code run on WIN 10 system. I tried all the methods I can find on the

[R] messy code found when reading CSV file on win 10 system

2016-06-15 Thread 李兰婷
 Dear Team, A problem occured when I run Rstudio.  Could you please give me some advice?there is a lot of messy code when I read a csv file, which includes several columns in chinese, and R code run on WIN 10  system. I tried all the methods I can find on the internet, but no one is worked. is t

Re: [R] Warning message in openxlsx

2016-06-15 Thread peter dalgaard
On 15 Jun 2016, at 11:04 , PIKAL Petr wrote: > Hi > > not completely sure but is there a variable with name "fonts" in some of your > data frames? That doesn't usually give a warning, unless an option is set, and even then, it's not quite the same message: > options(warnPartialMatchDollar=

Re: [R] Warning message in openxlsx

2016-06-15 Thread PIKAL Petr
Hi not completely sure but is there a variable with name "fonts" in some of your data frames? Regards Petr > -Original Message- > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of > g.maub...@weinwolf.de > Sent: Tuesday, June 14, 2016 4:12 PM > To: r-help@r-project.org > S

Re: [R] Factor levels in training set

2016-06-15 Thread PIKAL Petr
Hi Elahe I get slightly different error when using scale to nonnumeric data so I am not sure if you use the scale function from base package. > scale(raman[1:20,]) Error in colMeans(x, na.rm = TRUE) : 'x' must be numeric Anyway, how do you expect scaling shall be done when you have nonumeric v

Re: [R] [FORGED] Re: help with r package "trip"

2016-06-15 Thread Rolf Turner
On 15/06/16 20:18, Jim Lemon wrote: Hi Alice, Have you tried creating a vector of the start position (xpos[1],ypos[1]): xstart<-rep(xpos[1],n) ystart<-rep(ypos[1],n) # where "n" is the number of subsequent positions in the trip max(trackDistance(xstart,ystart,xpos[2:n],ypos[2:n],...)) may then

Re: [R] help with r package "trip"

2016-06-15 Thread Jim Lemon
Hi Alice, Have you tried creating a vector of the start position (xpos[1],ypos[1]): xstart<-rep(xpos[1],n) ystart<-rep(ypos[1],n) # where "n" is the number of subsequent positions in the trip max(trackDistance(xstart,ystart,xpos[2:n],ypos[2:n],...)) may then give you the value of the longest dist