Re: [R] Issue on LGP solving

2016-09-20 Thread PIKAL Petr
Hi > -Original Message- > From: Dr. Debasis Ghosh [mailto:d...@debasis.in] > Sent: Tuesday, September 20, 2016 3:59 PM > To: PIKAL Petr ; R-help@r-project.org > Subject: RE: [R] Issue on LGP solving > > Thanks Petr!! However, I found in the goalprog package I found > "achievements" as "a

Re: [R] Run a fixed effect regression and a logit regression on a national survey that need to be "weighted"

2016-09-20 Thread laura roncaglia
Thank you for the answer but I had already tried that way; when I introduce weights in the glm appears the error: Warning: non-integer #successes in a binomial glm! I tried to run the glm regression using the family quasibinomial: eq <- glm(pip ~ men + age_pr + age_c + I(age_pr^2) + I(age_c^2),

[R] Query on the R of free soft version 3

2016-09-20 Thread Kamin Kyuji
Dear Although I can install the new version of the R, I can not open the soft. How do I do it? Kyuzi Kamoi, MD. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.e

[R] if/else help

2016-09-20 Thread Crombie, Burnette N
If a data.frame (r4) does not exist in my R environment, I would like to create it before I move on to the next step in my script. How do I make that happen? Here is what I want to do from a code perspective: if (exists(r4)) { is.data.frame(get(r4)) } else { a <- 0, b <- 0, c <- 0, d <- "x", r4

[R] Help with PCA data file prep and R code

2016-09-20 Thread Sarah Stinson
Hello DRUGs, I'm new to R and would appreciate some expert advice on prepping files for, and running, PCA... My data set consists of aquatic invertebrate and zooplankton count data and physicochemical measurements from an ecotoxicology study. Four chemical treatments were applied to mesocosm tanks

Re: [R] about data problem

2016-09-20 Thread Jeff Newmiller
You can use the latter IF you know there are no problems with the input data. If you need to troubleshoot then you need separate columns so you can compare them. -- Sent from my phone. Please excuse my brevity. On September 20, 2016 4:22:41 PM PDT, lily li wrote: >Thanks. The former method wo

Re: [R] about data problem

2016-09-20 Thread lily li
Thanks. The former method works. I confused character with factor. Besides, I should use: dta$DischargeNum <- as.numeric( dta$Discharge ) instead of: dta$Discharge <- as.numeric( dta$Discharge ) On Tue, Sep 20, 2016 at 5:18 PM, Jeff Newmiller wrote: > Which means it avoided converting to facto

Re: [R] about data problem

2016-09-20 Thread Jeff Newmiller
Which means it avoided converting to factor... Success! Note that the column apparently has garbage characters in one or more of the rows, which should be evident when you LOOK AT THE CHARACTERS in the column. They should all be numeric symbols, plus or minus, and perhaps decimal points. If the

Re: [R] about data problem

2016-09-20 Thread lily li
Yes, I tried to add this statement when reading the dataset. But when I use summary(df), it shows: Discharge Length: Class :character Mode :character On Tue, Sep 20, 2016 at 5:06 PM, Joe Ceradini wrote: > read.csv("your_data.csv", stringsAsFactors=FALSE) > (I'm just reiterating Jianling said.

Re: [R] about data problem

2016-09-20 Thread Jeff Newmiller
Find the offending data. One approach is to look at the input data with your image sensors and neural pattern processor (eyes and brain). One way to reduce the load on those told is to read in the data with the stringsAsFactors=TRUE argument and try manually converting the resulting character st

Re: [R] about data problem

2016-09-20 Thread Joe Ceradini
read.csv("your_data.csv", stringsAsFactors=FALSE) (I'm just reiterating Jianling said...) Joe On Tue, Sep 20, 2016 at 4:56 PM, lily li wrote: > Is there a function in read.csv that I can use to avoid converting numeric > to factor? Thanks a lot. > > > > On Tue, Sep 20, 2016 at 4:42 PM, lily li

Re: [R] about data problem

2016-09-20 Thread lily li
Is there a function in read.csv that I can use to avoid converting numeric to factor? Thanks a lot. On Tue, Sep 20, 2016 at 4:42 PM, lily li wrote: > Thanks. Then what should I do to solve the problem? > > On Tue, Sep 20, 2016 at 4:30 PM, Jeff Newmiller > wrote: > >> I suppose you can do what

Re: [R] about data problem

2016-09-20 Thread lily li
Thanks. Then what should I do to solve the problem? On Tue, Sep 20, 2016 at 4:30 PM, Jeff Newmiller wrote: > I suppose you can do what works for your data, but I wouldn't recommend > na.rm=TRUE because it hides problems rather than clarifying them. > > If in fact your data includes true NA value

Re: [R] about data problem

2016-09-20 Thread Jeff Newmiller
I suppose you can do what works for your data, but I wouldn't recommend na.rm=TRUE because it hides problems rather than clarifying them. If in fact your data includes true NA values (the letters NA or simply nothing between the commas are typical ways this information may be indicated), then

Re: [R] about data problem

2016-09-20 Thread lily li
I reread the data, and use 'na.rm = T' when reading the data. This time it has no such problem. It seems that the existence of NAs convert the integer to factor. Thanks for your help. On Tue, Sep 20, 2016 at 4:09 PM, Jianling Fan wrote: > Add the "stringsAsFactors = F" when you read the data,

Re: [R] about data problem

2016-09-20 Thread Jianling Fan
Add the "stringsAsFactors = F" when you read the data, and then convert them to numeric. On 20 September 2016 at 16:00, lily li wrote: > Yes, it is stored as factor. I can't check out any problem in the original > data. Reread data doesn't help either. I use read.csv to read in the data, > do yo

Re: [R] about data problem

2016-09-20 Thread lily li
Yes, it is stored as factor. I can't check out any problem in the original data. Reread data doesn't help either. I use read.csv to read in the data, do you think it is better to use read.table? Thanks again. On Tue, Sep 20, 2016 at 3:55 PM, Greg Snow <538...@gmail.com> wrote: > This indicates th

Re: [R] about data problem

2016-09-20 Thread Greg Snow
This indicates that your Discharge column has been stored/converted as a factor (run str(df) to verify and check other columns). This usually happens when functions like read.table are left to try to figure out what each column is and it finds something in that column that cannot be converted to a

[R] about data problem

2016-09-20 Thread lily li
Hi R users, I have a problem in reading data. For example, part of my dataframe is like this: df month day year Discharge 31 20106.4 32 2010 7.58 33 2010 6.82 34 2010 8.63 3

Re: [R] "invalid argument to unary operator" while selecting rows by name

2016-09-20 Thread ruipbarradas
Sorry, I've made a stupid mistake. It's obviously the other way around. ix <- which(rownames(data) %in% c("601", "604")) clean <- data[-ix, ] Rui Barradas Citando ruipbarra...@sapo.pt: Hello, Try something like the following. ix <- which(c("601", "604") %in% rownames(data)) clean <- data[

Re: [R] "invalid argument to unary operator" while selecting rows by name

2016-09-20 Thread ruipbarradas
Hello, Try something like the following. ix <- which(c("601", "604") %in% rownames(data)) clean <- data[-ix, ] Hope this helps, Rui Barradas Citando Pauline Laïlle : Dear all, I built a dataframe with read.csv2(). Initially, row names are integers (order of answers to a survey). They a

Re: [R] How to plot the regression line of multivariable linear model?

2016-09-20 Thread Greg Snow
You might consider the Predict.Plot and TkPredict functions in the TeachingDemos package. These help you explore multiple linear regression models by plotting the "line" relating the response to one of the predictors at given values of the other predictors. These lines can be combined in a single

Re: [R] "invalid argument to unary operator" while selecting rows by name

2016-09-20 Thread Bert Gunter
Hint: "601" is not 601. Have you gone through any R tutorials? Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Tue, Sep 20, 2016 at 5:42 AM, Paul

[R] "invalid argument to unary operator" while selecting rows by name

2016-09-20 Thread Pauline Laïlle
Dear all, I built a dataframe with read.csv2(). Initially, row names are integers (order of answers to a survey). They are listed in the csv's first column. The import works well and my dataframe looks like I wanted it to look. Row names go as follows : [1] "6" "29" "31" "32" "52" "55" "6

[R] mgcv: bam(), error in models with random intercepts and random slopes

2016-09-20 Thread Fotis Fotiadis
Hi all I am using the bam function of the mgcv package to model behavioral data of a learning experiment. To model individual variation in learning rate, I am testing models with (a) by-participant random intercepts of trial, (b) by-participant random slopes and random intercepts of trial, and (c)

Re: [R] Run a fixed effect regression and a logit regression on a national survey that need to be "weighted"

2016-09-20 Thread Adams, Jean
If you want your records to be weighted by the survey weights during the analysis, then use the weights= argument of the glm() function. Jean On Tue, Sep 20, 2016 at 5:04 AM, laura roncaglia wrote: > I am a beginner user of R. I am using a national survey to test what > variables influence the

Re: [R] Return the indices of rows of a data frame

2016-09-20 Thread Bert Gunter
There are many good R tutorials on the web. Some recommendations can be found here: https://www.rstudio.com/online-learning/#R Please spend some time learning fundamental R constructs and functionality before posting what appear to be very basic questions here. Cheers, Bert Bert Gunter "The t

Re: [R] lm model with many categorical variables

2016-09-20 Thread Bert Gunter
You need statistical help, which is generally off topic here. I suggest you post to a statistcal site like stats.stackexchange.com instead. Better yet, find a local statistical expert with whom you can consult. Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep com

Re: [R] Return the indices of rows of a data frame

2016-09-20 Thread Robert Baer
On 9/19/2016 10:37 PM, John wrote: Hi, I have the following dataframe: temp<-data.frame(a=c(1,1,2), b=2:4, c=1:3) row.names(temp)<-c("D", "E", "F") temp a b c D 1 2 1 E 1 3 2 F 2 4 3 I would like R to tell me which rows has value "a" equal to 1. The answer is the first row and t

Re: [R] Issue on LGP solving

2016-09-20 Thread Dr. Debasis Ghosh
Thanks Petr!! However, I found in the goalprog package I found "achievements" as "a data frame with the deviation variables for each objective together with the priority level". I defined > p1<-c(2,0,0,0,0,0) > p2 <- c(0,0,0,0,1,0) > p3<- c(0,0,0,0,0,1) > achievement <- data.frame(p1,p2,p3) He

Re: [R] Errors in Raster to Point

2016-09-20 Thread David Remotti
First answer is that R is not the proper environment for such a question. There a re many free package for image analysis or even GIS. Try for example Q-GIS David Il 19/09/2016 22:34, GwanSeon Kim ha scritto: Hi, all I am just beginner to use R. I am working with TIF image file, and the info

Re: [R] lm model with many categorical variables

2016-09-20 Thread Ismail SEZEN
> On 20 Sep 2016, at 11:34, Michael Haenlein wrote: > > Dear all, > > I am trying to estimate a lm model with one continuous dependent variable > and 11 independent variables that are all categorical, some of which have > many categories (several dozens in some cases). If I’m not wrong, ( I as

Re: [R] Issue on LGP solving

2016-09-20 Thread PIKAL Petr
Hi Just a wild guess. Achievement in the goalprog package is data frame with four named columns (objective, priority, p and n). Your achievement is 3 column data.frame with names p1, p2 and p3. Maybe data frame with defined structure is required. Cheers Petr > -Original Message- > Fr

[R] Run a fixed effect regression and a logit regression on a national survey that need to be "weighted"

2016-09-20 Thread laura roncaglia
I am a beginner user of R. I am using a national survey to test what variables influence the partecipation in complementary pensions (the partecipation in complementary pension is voluntary in my country). Since the dependent variable is a dummy (1 if the person partecipate and 0 otherwise) I want

[R] Issue on LGP solving

2016-09-20 Thread Dr. Debasis Ghosh
I was solving a LGP problem which is very basic. Find x0 = [x1; x2], n0 = [n1; n2; n3] and p0 = [p1; p2; p3] that minimize a = [(2p1); (n2); (n3)] The objectives are as follows 10x1 + 15x2 + n1 - p1 = 40 100x1 + 100x2 + n2 - p2 = 1000 x2 + n3 - p3 = 7 x; n; p >= 0 The solution is x' = [4

Re: [R] Using lm's subset parameter results in Error in xj[i] : invalid subscript type 'list'

2016-09-20 Thread PIKAL Petr
Hi see in line > -Original Message- > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of mviljamaa > Sent: Tuesday, September 20, 2016 10:01 AM > To: r-help@r-project.org > Subject: [R] Using lm's subset parameter results in Error in xj[i] : invalid > subscript type 'list' >

[R] lm model with many categorical variables

2016-09-20 Thread Michael Haenlein
Dear all, I am trying to estimate a lm model with one continuous dependent variable and 11 independent variables that are all categorical, some of which have many categories (several dozens in some cases). I am not interested in statistical inference to a larger population. The objective of my mo

Re: [R] Using lm's subset parameter results in Error in xj[i] : invalid subscript type 'list'

2016-09-20 Thread Jorge Cimentada
By subsetting the rows in the firstkids data frame, you've already subsetted your data. Try specifying firstkids as your data instead of a subset in the lm call. Also, eliminate the kidmomhsage prefix from all of your variables since you're running the linear model on a different data frame(firstk

Re: [R] Errors in Raster to Point

2016-09-20 Thread Michael Sumner
On Tue, 20 Sep 2016, 15:55 GwanSeon Kim wrote: > Hi, all > I am just beginner to use R. > I am working with TIF image file, and the information about the raster is > following: > > class : RasterLayer > dimensions : 11150, 21808, 243159200 (nrow, ncol, ncell) > resolution : 30, 30 (x, y

[R] Using lm's subset parameter results in Error in xj[i] : invalid subscript type 'list'

2016-09-20 Thread mviljamaa
I'm trying to take lm on a subset of my dataset and to do this I believe I need to pass my subset of the data as the subset parameter of lm. So I do my subsetting: firstkids <- kidmomhsage[0:234,], i.e. the first 234 rows of the data frame. Then construct the model: fit4 <- lm(kidmomhsage$k

Re: [R] Where is R installed on my Linux?

2016-09-20 Thread Loris Bennett
Mike Wojnowicz writes: > I have successfully installed R on my AWS EC2 r3.8 box running Linux with >>sudo yum install -y R > > However, I cannot find R anywhere (which I want for the sake of > tar'ing it up and decompressing to make future installations easier.) > For example, > >> rpm -ql R > >