[R] Archer-Lemeshow Goodness of Fit Test for Survey Data with Log. Regression

2016-11-16 Thread Courtney Benjamin
?Hello R Experts, I am trying to implement the Archer-Lemeshow GOF Test for survey data on a logistic regression model using the survey package based upon an R Help Archive post that I found where Dr. Thomas Lumley advised how to do it: http://r.789695.n4.nabble.com/Goodness-of-t-tests-for-Comp

Re: [R] Run a Python code from R

2016-11-16 Thread David Winsemius
> On Nov 16, 2016, at 4:53 PM, Nelly Reduan wrote: > > Thank you very much for your help ! > > > I 'm trying to use the package "rPithon" but I obtain this error message: Are you sure you are not just misspelling rPython? If that's not the issue than you need to say where you got rPithon,

Re: [R] Run a Python code from R

2016-11-16 Thread Nelly Reduan
Thank you very much for your help ! I 'm trying to use the package "rPithon" but I obtain this error message: > if (pithon.available()) + { + nRow <-50 + nCol <-50 + h <- 0.75 + + # this file contains the definition of function concat + pithon.load("C:/Users/Anaconda2/Lib/site-

Re: [R] Run a Python code from R

2016-11-16 Thread Wensui Liu
take a look at rpython or rPithon package On Wed, Nov 16, 2016 at 4:53 PM, Nelly Reduan wrote: > Hello, > > > How can I run this Python code from R ? > > import nlmpy nlm = nlmpy.mpd(nRow=50, nCol=50, h=0.75) nlmpy.exportASCIIGrid("raster.asc", nlm) > > > Nlmpy is a Python package

[R] Run a Python code from R

2016-11-16 Thread Nelly Reduan
Hello, How can I run this Python code from R ? >>> import nlmpy >>> nlm = nlmpy.mpd(nRow=50, nCol=50, h=0.75) >>> nlmpy.exportASCIIGrid("raster.asc", nlm) Nlmpy is a Python package to build neutral landscape models https://pypi.python.org/pypi/nlmpy . The example comes from this website. I

Re: [R] using pmax in presence of NAs

2016-11-16 Thread Dimitri Liakhovitski
Thank you, Peter! On Wed, Nov 16, 2016 at 4:21 PM, peter dalgaard wrote: > >> On 16 Nov 2016, at 21:58 , Dimitri Liakhovitski >> wrote: >> >> Hello! >> >> I need to calculate the maximum of each row of a data frame. >> This works: >> >> x <- data.frame(a = 1:5, b=11:15, c=111:115) >> x >> do

Re: [R] using pmax in presence of NAs

2016-11-16 Thread peter dalgaard
> On 16 Nov 2016, at 21:58 , Dimitri Liakhovitski > wrote: > > Hello! > > I need to calculate the maximum of each row of a data frame. > This works: > > x <- data.frame(a = 1:5, b=11:15, c=111:115) > x > do.call(pmax, x) > [1] 111 112 113 114 115 > > However, how should I modify it if my

Re: [R] using pmax in presence of NAs

2016-11-16 Thread Dimitri Liakhovitski
Thanks a lot, Sarah. I just had no idea where to put na.rm = T in the do.call call. Appreciate it! Dimitri On Wed, Nov 16, 2016 at 4:06 PM, Sarah Goslee wrote: > pmax has a na.rm argument. Why not just use that? > > x <- data.frame(a = c(1:5), b=11:15, c=c(111:114,NA)) > >> do.call(pmax, c(x, na.

Re: [R] using pmax in presence of NAs

2016-11-16 Thread Sarah Goslee
pmax has a na.rm argument. Why not just use that? x <- data.frame(a = c(1:5), b=11:15, c=c(111:114,NA)) > do.call(pmax, c(x, na.rm=TRUE)) [1] 111 112 113 114 15 On Wed, Nov 16, 2016 at 3:58 PM, Dimitri Liakhovitski wrote: > Hello! > > I need to calculate the maximum of each row of a data frame

Re: [R] using pmax in presence of NAs

2016-11-16 Thread Dimitri Liakhovitski
To clarify: I know I could do: apply(x, 1, max, na.rm = T) But I was wondering if one can modify the pmax one... On Wed, Nov 16, 2016 at 3:58 PM, Dimitri Liakhovitski wrote: > Hello! > > I need to calculate the maximum of each row of a data frame. > This works: > > x <- data.frame(a = 1:5, b=1

[R] using pmax in presence of NAs

2016-11-16 Thread Dimitri Liakhovitski
Hello! I need to calculate the maximum of each row of a data frame. This works: x <- data.frame(a = 1:5, b=11:15, c=111:115) x do.call(pmax, x) [1] 111 112 113 114 115 However, how should I modify it if my data frame has NAs? I'd like it to ignore NAs and return the maximum of all non-NAs

[R] GAMs: test of simple effects following a significant interaction

2016-11-16 Thread Marine Regis
Hello, I am a novice in Generalized Additive Models (GAMs) and I would need some advice on these models. From capture data, I would like to assess the effect of longitudinal changes in proportion of forests on abundance of skunks. To test this, I built this GAM where the dependent variable is th

[R] Course: "Statistical Data Analysis with R"

2016-11-16 Thread PD Dr. Pablo Emilio Verde
Dear list members, I am very glad to announce the introductory course: "Statistical Data Analysis with R". I have running this course for 10 years and previous participants have had a nice time learning R at the LinuxHotel. You are invited to bring their own data to analyze during the course.

Re: [R] Variable 'A' is not a factor Error message

2016-11-16 Thread S Ellison
This looks like one of those 'please talk to a statistician' questions ... You appear to have requested a 12-run placket-burman experiment, which is a design that requires up to 11 two-level factors. You then fitted (I think) simulated data to that design, using those factors converted to their

[R] Some basic time series questions

2016-11-16 Thread Hall, Mark
Hi, As I sit and learn how to work with time series, I've run into a problem that is eluding a quick easy answer (and googling for answers seems to really slow the process...) Question #1-- In a simple example on R 3.3.1 (sorry my employer hasn't upgraded to 3.3.2 yet): x=rnorm(26,0,1) x.ts<-ts(

Re: [R] Different results when converting a matrix to a data.frame

2016-11-16 Thread David Winsemius
> On Nov 16, 2016, at 8:43 AM, Jeff Newmiller wrote: > > I will start by admitting I don't know the answer to your question. > > However, I am responding because I think this should not be an issue in real > life use of R. Data frames are lists of distinct vectors, each of which has > its own

Re: [R] Different results when converting a matrix to a data.frame

2016-11-16 Thread Jeff Newmiller
I will start by admitting I don't know the answer to your question. However, I am responding because I think this should not be an issue in real life use of R. Data frames are lists of distinct vectors, each of which has its own reason for being present in the data, and normally each has its own

[R] Different results when converting a matrix to a data.frame

2016-11-16 Thread G . Maubach
Hi All, I build an empty dataframe to fill it will values later. I did the following: -- cut -- matrix(NA, 2, 2) [,1] [,2] [1,] NA NA [2,] NA NA > data.frame(matrix(NA, 2, 2)) X1 X2 1 NA NA 2 NA NA > as.data.frame(matrix(NA, 2, 2)) V1 V2 1 NA NA 2 NA NA -- cut -- Why does data.

Re: [R] Issues with the way Apply handled NA's

2016-11-16 Thread S Ellison
> -Original Message- > > You can check for an empty vector as follows: > ... > vals <- apply(plabor[c("colA","colB","colC")],1,function(x) > length(na.omit(x))) > vals # [1] 3 0 3 2 > <- ifelse(vals>0, plabor$colD, NA) > plabor A slightly more compact variant that avoids the interme

Re: [R] Text categories based on the sentences

2016-11-16 Thread S Ellison
> I have data set contains one variable "*Description*" > > *Description** Category* > > 1. i want ice cream food > 2. i like banana very much fruit > 3. tomorrow i will eat chick

Re: [R] extracting all different items in a matrix colum or vector

2016-11-16 Thread Michael Dewey
You say you are coming back to R after a pause. I think the key word in Sarah's response is re-reading. Why not start with the material you used before and re-read it? If you have never read the Introduction to R which comes with your installation that is worth a read too. On 15/11/2016 20:47,