Re: [R] LMER vs PROC MIXED estimates

2012-11-06 Thread David Winsemius
On Nov 6, 2012, at 7:00 PM, sandip1006 wrote: > Hi experts, > > I have just about started to use R (after using SAS for more than 5 years) > and still finding my way...I have been trying to replicate PROC MIXED > results in LMER but noticed that the estimates are coming different. Better practi

[R] LMER vs PROC MIXED estimates

2012-11-06 Thread sandip1006
Hi experts, I have just about started to use R (after using SAS for more than 5 years) and still finding my way...I have been trying to replicate PROC MIXED results in LMER but noticed that the estimates are coming different. My SAS code is as follows (trying to randomise X2 and Intercept): PR

[R] (no subject)

2012-11-06 Thread Raju Maiti
I have faced one problem in maximizing a very complicated likelihood through R-package GenSA. But it takes huge time. But I have to replicates the process for more than 1000 times. Could you suggest me some other packages which can handle such likelihood function quickly. regrads, Raju -- "The

Re: [R] Ordered probit using clm2

2012-11-06 Thread Rune Haubo
Hi Alice, A factor is a fairly basic R concept that you can read about in http://cran.r-project.org/doc/manuals/R-intro.pdf on page 16. Now to fit the CLM, you need to turn your response variable into a factor with something like datareg$Newpercentagecash <- factor(datareg$Newpercentagecash, orde

Re: [R] options()$width ignored by print.formula

2012-11-06 Thread Prof Brian Ripley
On 06/11/2012 17:54, Sarah Goslee wrote: Thanks, Prof. Ripley. Using deparse(b$formula, width.cutoff = options()$width) works as I'd expected (full example below). So I can use that to write a custom summary.gam(), though that still seems like a lot of work to get summary(b) to follow the usual

Re: [R] Survplot, Y-axis in percent

2012-11-06 Thread David Winsemius
On Nov 6, 2012, at 1:39 PM, maziar.mohaddes wrote: > Thanks alot for ur help. Sorry about me be being a real rookie in forum > manners. > I am pretty new to R and although i did read the forum rules before > submitting obvoiusly I was not able to > I did try the yaxt=n, as stated in my post. > I

Re: [R] a simple list question

2012-11-06 Thread Rolf Turner
On 07/11/12 18:35, Erin Hodgess wrote: Dear R People I have a simple list question, please: I have vectors x.1, x.2,...x.n (each of different lengths) and I would like to combine them into a list. However, I'm sure that there is a better way to do this than to type in x <- list(x.1,x.2,x.3,...

Re: [R] model frame and formula mismatch with latent class analysis poLCA

2012-11-06 Thread Galled
I've had the same problem, but although seems ridiculous I have solved by reducing the length of the name of the variables (yes the character length of each variable, e.g: if you have many variables named big_name_variable, rename it with bnv) I hope this solves your problem. __

Re: [R] Bootstrap and Jackknife Bias using Survey Package

2012-11-06 Thread John Cam
Dear Prof Lumley and Dear All, I've seen how to get parameter estimates in your previous message: R> a <- svymean(~api00,rclus1,return.replicates=TRUE) R> a$replicates [1] 642.5814 648.0168 646.2873 642.8824 645.1215 644.6369 646.9609 637.8084 640.7874 640.1007 642.7284 667.7329 638.3000 644.

Re: [R] glm fitting routine and convergence

2012-11-06 Thread David Winsemius
On Nov 6, 2012, at 1:44 PM, Christopher A. Simon wrote: > What kind of special magic does glm have? > > I'm working on a logistic regression solver (L-BFGS) in c and I've been > using glm to check my results. I came across a data set that has a very > high condition number (the data matrix tran

Re: [R] pivot table

2012-11-06 Thread farnoosh sheikhi
It worked beautifully. Thank you so much:-)   Best,Farnoosh Sheikhi Cc: R help Sent: Tuesday, November 6, 2012 2:44 PM Subject: Re: [R] pivot table Hi, Is this okay? library(reshape2) dat1<-read.table(text=" ID   Diag   Proc  DOB  Gender   a    diag1    pro

[R] a simple list question

2012-11-06 Thread Erin Hodgess
Dear R People I have a simple list question, please: I have vectors x.1, x.2,...x.n (each of different lengths) and I would like to combine them into a list. However, I'm sure that there is a better way to do this than to type in x <- list(x.1,x.2,x.3,...) Is there a better way to do this, ple

Re: [R] pivot table

2012-11-06 Thread farnoosh sheikhi
Hi there, Thanks a lot for your help, but Proc doesn't show in the result. I also want to assign 1 and 0 instead of the name of variables. Thanks a lot.   Best,Farnoosh Sheikhi Cc: R help Sent: Tuesday, November 6, 2012 1:42 PM Subject: Re: [R] pivot table H

Re: [R] pivot table

2012-11-06 Thread farnoosh sheikhi
Hi again, I have another question for different data. Here is how my data looks like: ID     Lab   Status a         1          N a   1          A a   2          N b   3       N b   1          A   I need to reformat this data as following. ID   Lab1.N   Lab1.A   Lab2.N    Lab2.A    Lab3.N    Lab3

Re: [R] Looking for mingw32-make.exe (make.exe not working) in RTools

2012-11-06 Thread Florian Burkart
Seeing that rubenvb's MinGW-w64 build uses gcc 4.7 and RTools use gcc 4.6, I have tried again to get rid of all MinGWs and only use RTools (suspecting maybe binary incompatibility). Instead of mingw32-make.exe I am trying to use the make.exe supplied by RTools. Boost compiles just fine, luckily. W

[R] sample from list

2012-11-06 Thread Benjamin Ward (ENV)
Hi all, I have a list of genes present in 500 individuals, the individuals are the elements: Genes <- lapply(1:nrow(inds),function(x) sample(1:1,inds$No_of_Genes,replace=TRUE)) (This was later written to a dataframe as well as kept as the list object: inds2 <- data.frame(inds,Genes=I(Genes

[R] Ordered probit using clm2

2012-11-06 Thread Alice LAMBERTON
Hi, I am new in R. I would like to do a ordered probit regression using clm2 (in the ordinal package). My dependent variable y is the way of payment in M&A: y=0 if the deal is financed by stock only, y=1 if the deal is financed by a mix of cash and stock and y=2 if it is by cash only. My indepe

[R] glm fitting routine and convergence

2012-11-06 Thread Christopher A. Simon
What kind of special magic does glm have? I'm working on a logistic regression solver (L-BFGS) in c and I've been using glm to check my results. I came across a data set that has a very high condition number (the data matrix transpose the data matrix) that when running my solver does not converge

Re: [R] pivot table

2012-11-06 Thread arun
Hi, May be this helps: dat1<-read.table(text=" ID Lab   Status a 1  N a       1  A a       2  N b       3       N b       1  A ",sep="",header=TRUE,stringsAsFactors=FALSE) library(reshape2) res1<-dcast(dat1,ID~Lab+Status,value.var="Lab") res1[,-1]<-if

Re: [R] HELP! Excel and R give me totally different regression results using the exact same data

2012-11-06 Thread David Winsemius
On Nov 6, 2012, at 4:20 PM, frauke wrote: > Hallo, > > I am totally confused why Excel and R give me totally different regression > results for the data below. If you know the solution, please enlighten me. > > In Excel I used LINEST() and Data>Data Analysis>Regression and both > (fortunatel

[R] HELP! Excel and R give me totally different regression results using the exact same data

2012-11-06 Thread frauke
Hallo, I am totally confused why Excel and R give me totally different regression results for the data below. If you know the solution, please enlighten me. In Excel I used LINEST() and Data>Data Analysis>Regression and both (fortunately) gave the same result. The coefficients were: /b0=1.16,

Re: [R] Two-way Random Effects with unbalanced data

2012-11-06 Thread Matthias Kuhn
Asaf, I think that the lme4-package on CRAN with its main function lmer() can help you here. It uses restricted ML to find the estimates and should cope with unbalanced data. The two factors of your random effects can be either nested or crossed. Have a look in the book (draft-version) on lme4 by

Re: [R] avarage my data each hour

2012-11-06 Thread R. Michael Weylandt
library(xts) period.apply() might also be helpful. Michael On Tue, Nov 6, 2012 at 7:32 PM, Rui Barradas wrote: > Hello, > > You should provide us with a data example. Since you haven't, look at the > following code and see if you understand it. > > # Make up some data > x <- Sys.time() + (1:100

Re: [R] R and SPSS

2012-11-06 Thread Ben Bolker
Jeremy Miles gmail.com> writes: > > I think we'll need some output to know so we can see the differences. (And > data and code would be useful too, if you could provide a small example). Definitely. > > One thought is that the programs might remove a variable that is completely > collinear,

Re: [R] pivot table

2012-11-06 Thread arun
Hi, Is this okay? library(reshape2) dat1<-read.table(text=" ID   Diag   Proc  DOB  Gender   a    diag1    proc1   10/15/1969 M  b    diag2    proc2    8/25/1978 F c    diag1    proc1    1/10/1985 M a    diag3    proc3    10/15/1969 M b    diag4    proc4    8/25/1978 F b    diag6    proc5    8/2

Re: [R] R and SPSS

2012-11-06 Thread Jeremy Miles
I think we'll need some output to know so we can see the differences. (And data and code would be useful too, if you could provide a small example). One thought is that the programs might remove a variable that is completely collinear, but the different programs might remove different variables -

Re: [R] Violin plot of categorical/binned data

2012-11-06 Thread Brian Diggs
On 11/3/2012 5:47 PM, Jim Lemon wrote: On 11/04/2012 06:27 AM, Nathan Miller wrote: Hi, I'm trying to create a plot showing the density distribution of some shipping data. I like the look of violin plots, but my data is not continuous but rather binned and I want to make sure its binned nature

Re: [R] pivot table

2012-11-06 Thread arun
HI, It is better to dput() an example dataset to work with. May be this helps: dat1<-read.table(text=" ID   Diag   Proc  DOB  Gender   a    diag1    1   10/15/1969 M  b    diag2    2    8/25/1978 F c    diag1    1    1/10/1985 M a    diag3    3    10/15/1969 M b    diag4    4    8/25/1978 F b

[R] R and SPSS

2012-11-06 Thread Hui Du
Hi group: I have a data set, which has severe colinearity problem. While running linear regression in R and SPSS, I got different models. I am wondering if somebody knows how to make the two software output the same results. (I guess the way R and SPSS handling singularity is different, which

Re: [R] Question about cut()

2012-11-06 Thread peter dalgaard
On Nov 6, 2012, at 22:16 , Brian Diggs wrote: > On 11/2/2012 11:11 AM, Ni, Shenghua wrote: >>> r<-c(1,1,9,1,1,1) >>> col_no<-cut(r,c(0,2,3,6,8,10,100)) >>> levels(col_no)<-c("<2%","2-4%","4-6%","6-8%","8-10%",">10%") >>> col_no >> [1] <2% <2% 8-10% <2% <2% <2% >> Levels: <2% 2-4% 4-6% 6-8

Re: [R] Mixed Data Sampling Regression Models

2012-11-06 Thread Mark Leeds
Hi: Assuming that you're talking about "MIDAS", that question is more relevant to R-Sig-Finance. I don't know if there's anything in R but google for eric ghysels website because he is the originator of that approach. He may have some code ( my guess is matlab rather than R ) at his site ? On

Re: [R] Survplot, Y-axis in percent

2012-11-06 Thread David Winsemius
On Nov 6, 2012, at 12:18 PM, maziar.mohaddes wrote: >> As far as I can see, survplot.survfit (from package rms) is written with > base graphics, so you need to suppress the >> default axis call with yaxt=FALSE, and replace it with your desired >> values using axis(2, at=..., labels=...). > Than

Re: [R] Question about cut()

2012-11-06 Thread David Winsemius
On Nov 2, 2012, at 11:51 AM, Berend Hasselman wrote: > > On 02-11-2012, at 19:11, Ni, Shenghua wrote: > >>> r<-c(1,1,9,1,1,1) >>> col_no<-cut(r,c(0,2,3,6,8,10,100)) >>> levels(col_no)<-c("<2%","2-4%","4-6%","6-8%","8-10%",">10%") >>> col_no >> [1] <2% <2% 8-10% <2% <2% <2% >> Levels: <2

Re: [R] Reduce(paste, x) question

2012-11-06 Thread Brian Diggs
On 11/1/2012 1:06 PM, mdvaan wrote: I should have been more specific: y <- list() a <- c("A", "K") b <- c("B", "L") c <- c("C", "M") d <- c("D", "N") e <- c("E", "O") y[[1]] <- a y[[2]] <- b y[[3]] <- c y[[4]] <- d y[[5]] <- e y [[1]] [1] "A" "K" [[2]] [1] "B" "L" [[3]] [1] "C" "M" [[4]] [1

Re: [R] Question about cut()

2012-11-06 Thread Brian Diggs
On 11/2/2012 11:11 AM, Ni, Shenghua wrote: r<-c(1,1,9,1,1,1) col_no<-cut(r,c(0,2,3,6,8,10,100)) levels(col_no)<-c("<2%","2-4%","4-6%","6-8%","8-10%",">10%") col_no [1] <2% <2% 8-10% <2% <2% <2% Levels: <2% 2-4% 4-6% 6-8% 8-10% >10% Yes. (Or, I get the same output from this code. What

[R] Mixed Data Sampling Regression Models

2012-11-06 Thread CALEF ALEJANDRO RODRIGUEZ CUEVAS
Hi everybody. I was wondering if there's any package available that can handle Mixed Data Sampling Regression Models. Thanks a lot for your help. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/ma

Re: [R] Apply same linear model to subset of dataframe

2012-11-06 Thread Ross Ahmed
Superb Jean, many thanks Ross From: Jean V Adams Date: Tuesday, 6 November 2012 19:20 To: Ross Ahmed Cc: Subject: Re: [R] Apply same linear model to subset of dataframe DV <- c("mpg", "drat", "gear") IV <- list(c("cyl", "disp", "hp"), c("wt", "qsec"), c("carb", "hp")) fits <- vector("lis

[R] pivot table

2012-11-06 Thread farnoosh sheikhi
Hello, I have a data which looks like below: Some of the patients have multiple diagnosis. ID(200 patients)   Diag (100 unique Diag-200 in general)   Proc (50 uniqe Proc)  DOB (200)   Gender (200)    a                           daig1 b                           diag2 c                          

Re: [R] Survplot, Y-axis in percent

2012-11-06 Thread maziar.mohaddes
> As far as I can see, survplot.survfit (from package rms) is written with base graphics, so you need to suppress the > default axis call with yaxt=FALSE, and replace it with your desired > values using axis(2, at=..., labels=...). Thanks alot for your response. Unfortunately yaxt function does

Re: [R] Looking for mingw32-make.exe (make.exe not working) in RTools

2012-11-06 Thread Florian Burkart
Hi again, I am still struggling with this unfortunately. I installed 64 bit MinGW (rubenvb's personal build) and managed to fully compile boost (static libraries) and my library (shared library), after a fair amount of pain. I can now even load my library with dyn.load. However, I can't call my f

Re: [R] Looking for mingw32-make.exe (make.exe not working) in RTools

2012-11-06 Thread Florian Burkart
I forgot to mention, mingw32-make.exe isn't just required by premake4 generated make files, but also e.g. by CodeLite. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE

[R] Emulating SPSS's /emmeans in UNIANOVA

2012-11-06 Thread Virgile Capo-Chichi
Dear R users, I am a recent convert from SPSS and trying to emulate the /emmeans subcommand of UNIANOVA in SPSS. I've used the model.tables() function following aov() butnot sure if this is the right thing to do. Anyone out there with other options? Thanks, V [[alternative HTML version de

[R] multinomial MCMCglmm

2012-11-06 Thread Vaniscotte
Thanks for the answers to my previous post, I hope I am posting on the correct list now. I managed so far to run the multinomial model with random effect with the following command: MCMCglmm(fixed=cbind(Apsy,Mygl,Crle,Crru,Miag,empty) ~ habitat:trait,random=~idh(trait):mesh,family="multinomia

Re: [R] write.matrix.csr data conversion

2012-11-06 Thread Sam Steingold
Dear David, > * David Meyer [2012-11-06 19:49:15 +0100]: > > there is C-code related to *reading* in such a file, but in the > internal libsvm-format, not the matrix.csr format. How is the libsvm-format differ from matrix.csr format? I actually use matrix.csr only because it prints to what libsv

[R] Error message in nmkb()

2012-11-06 Thread U30A J C Nash
I would guess -- we don't have a reproducible code -- that you have an undefined function value. Since nmkb is entirely in R to my knowledge, you could simply take the source code and modify it to display the elements in the test that cause the trouble. Then load the source rather than using li

Re: [R] Column names containing ` in R

2012-11-06 Thread David Winsemius
On Nov 6, 2012, at 5:21 AM, Raji wrote: > Hi, > > My data has column names which has ` character. For example , > *> names(dataframe) > [1] "`region""farmsize`" "farmincome" "maincrop" "claimvalue"* > > If i use these objects in my function, the following error is thrown. > > *lmm<-lm(

Re: [R] For the function loc()

2012-11-06 Thread David Winsemius
On Nov 6, 2012, at 10:50 AM, Sarah Goslee wrote: > rseek.org is a good place to start for locating functions. > > We might be better able to help if you'd told us where you got that > code in the first place. > > On Tue, Nov 6, 2012 at 8:53 AM, yuyaxuan <309772...@qq.com> wrote: >> Hello guys,

Re: [R] avarage my data each hour

2012-11-06 Thread Rui Barradas
Hello, You should provide us with a data example. Since you haven't, look at the following code and see if you understand it. # Make up some data x <- Sys.time() + (1:1000)*15 y <- rnorm(1000) brks <- cut(x, breaks = "hour") # hour breaks tapply(y, brks, mean) # hourly means of 'y' Hope

Re: [R] avarage my data each hour

2012-11-06 Thread Sarah Goslee
aggregate(), most likely. But please read: http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example and come back if you need more assistance. Sarah On Tue, Nov 6, 2012 at 1:57 PM, B. Bahar wrote: > Hello, > > I have much more than one milion tempreture is gained ea

Re: [R] Apply same linear model to subset of dataframe

2012-11-06 Thread Jean V Adams
Ross, You can store the lm() results in a list, if you like. For example: DV <- c("mpg", "drat", "gear") IV <- list(c("cyl", "disp", "hp"), c("wt", "qsec"), c("carb", "hp")) fits <- vector("list", length(DV)) for(i in seq(DV)) { fit <- lm(formula=paste(DV[i], paste(IV[[i]], collapse="+")

Re: [R] Column names containing ` in R

2012-11-06 Thread Rui Barradas
Hello, Can't you remove the backquotes from names(df)? If so, you can do it with x <- c("`region","farmsize`", "farmincome", "maincrop", "claimvalue") newx <- gsub("\\`", "", x) Hope this helps, Rui Barradas Em 06-11-2012 13:21, Raji escreveu: Hi, My data has column names which has ` c

Re: [R] Survplot, Y-axis in percent

2012-11-06 Thread David Winsemius
On Nov 6, 2012, at 8:10 AM, maziar.mohaddes wrote: > Hi > > I am a new fan of R after getting mad with the graphical functional in SPSS. > I have been able to create a nice looking Kaplan Meyer graph using Survplot > function. > However I have difficulties in turning the y axis to percent inst

[R] Fwd: Average my data each hour

2012-11-06 Thread B. Bahar
-- Forwarded message -- From: B. Bahar Date: Tue, Nov 6, 2012 at 7:57 PM Subject: avarage my data each hour To: r-help@r-project.org Hello, I have much more than one milion tempreture is gained each 15 seconds. So each 15 seconds, I have one data. How could I calculate avarage

Re: [R] plm(): observations not used for modelling

2012-11-06 Thread David Winsemius
On Nov 6, 2012, at 7:55 AM, Daniel Bab. wrote: > Hello, > > I have posted this problem before, but thought I try to explain it a bit > better. > I'm using the function plm to create a fixed effects model for panel data, > my method is therefor "within" my effect is "twoways". > My Data contains

[R] avarage my data each hour

2012-11-06 Thread B. Bahar
Hello, I have much more than one milion tempreture is gained each 15 seconds. So each 15 seconds, I have one data. How could I calculate avarage datas in each hour in R? If you could help me. [[alternative HTML version deleted]] __ R-help@r-pr

Re: [R] write.matrix.csr data conversion

2012-11-06 Thread David Meyer
Dear Sam, there is C-code related to *reading* in such a file, but in the internal libsvm-format, not the matrix.csr format. There is no C-code for *writing* this to a file. There is certainly a way to speed this up, but I am not likely to do this in the near future. Best David On 2012-11

Re: [R] For the function loc()

2012-11-06 Thread Sarah Goslee
rseek.org is a good place to start for locating functions. We might be better able to help if you'd told us where you got that code in the first place. On Tue, Nov 6, 2012 at 8:53 AM, yuyaxuan <309772...@qq.com> wrote: > Hello guys, > > I am wondering that whether we have the function loc() in R

Re: [R] Plot in function

2012-11-06 Thread David Winsemius
On Nov 6, 2012, at 8:44 AM, Pauli wrote: > Hello, > > I am a R beginner and I have a question about a litte function I found. > Here is the code: > > # Gambler's Ruin Problem. > # seed capital:k > # rounds: n > # probability of success: p >

Re: [R] Plot in function

2012-11-06 Thread R. Michael Weylandt
On Tue, Nov 6, 2012 at 4:44 PM, Pauli wrote: > Hello, > > I am a R beginner and I have a question about a litte function I found. > Here is the code: > > # Gambler's Ruin Problem. > # seed capital:k > # rounds: n > # probability of success: p >

[R] library(RCurl) quamtmod yahoo data source

2012-11-06 Thread veepsirtt
Hi I try to download the last 10 days quotes for NIFTY index data from yahoo source, but it gives me errors. load.packages('quantmod') endDate =Sys.Date() startDate = as.Date(endDate-100, order="ymd") nsei=getSymbols("^NSEI", src = 'yahoo', from = startDate,end=endDate) last(nsei,10)

Re: [R] write.matrix.csr data conversion

2012-11-06 Thread Sam Steingold
David, thanks for adding the feature. read.matrix.csr and, especially, write.matrix.csr are extremely slow: usersystem elapsed 8381.988 3810.396 12345.349 for a 2797634 x 224 matrix I have to deal with. The help page http://rss.acs.unt.edu/Rdoc/library/e1071/html/read.matrix.csr.ht

[R] Survplot, Y-axis in percent

2012-11-06 Thread maziar.mohaddes
Hi I am a new fan of R after getting mad with the graphical functional in SPSS. I have been able to create a nice looking Kaplan Meyer graph using Survplot function. However I have difficulties in turning the y axis to percent instead of the default 0-1 scale. Further I have tried the function y

[R] plm(): observations not used for modelling

2012-11-06 Thread Daniel Bab.
Hello, I have posted this problem before, but thought I try to explain it a bit better. I'm using the function plm to create a fixed effects model for panel data, my method is therefor "within" my effect is "twoways". My Data contains unbalanced Panels due to missing Values, but contains 309 obser

[R] For the function loc()

2012-11-06 Thread yuyaxuan
Hello guys, I am wondering that whether we have the function loc() in R package??? If so, which one should I install? For example, "locrow = loc(row!=0.0)" I met this in the code...I checked the code,, But I didn't find the self defined function.. Can somebody help me? -- View this message i

Re: [R] Question on callNextMethod

2012-11-06 Thread cberry
Simon Knapp writes: > I don't understand why I get the following results. I define two classes > 'Base' and 'Derived', the latter of which 'contains' the first. I then > define a generic method 'test' and overload it for each of these classes. I > call 'callNextMethod()' in the overload for Deriv

Re: [R] Apply same linear model to subset of dataframe

2012-11-06 Thread Ross Ahmed
Thanks Jean This works for the plots, but it only stores the last lm() computed Ross From: Jean V Adams Date: Tuesday, 6 November 2012 14:12 To: Ross Ahmed Cc: Subject: Re: [R] Apply same linear model to subset of dataframe Ross, Here's one way to condense the code ... DV <- c("mpg",

[R] Column names containing ` in R

2012-11-06 Thread Raji
Hi, My data has column names which has ` character. For example , *> names(dataframe) [1] "`region""farmsize`" "farmincome" "maincrop" "claimvalue"* If i use these objects in my function, the following error is thrown. *lmm<-lm(``region`~farmincome) Error: attempt to use zero-length vari

Re: [R] Filling dataframe incorrectly in for loop

2012-11-06 Thread petermec
Nevermind, I knew it was a simple fix, just needed to take a break from R: for(i in 1:length(mirs)) { holder = subset(data, data$mir==mirs[i]) table = rbind(table, holder) } -- View this message in context: http://r.789695.n4.nabble.com/Filling-dataframe-incorrectly-in-for-loop-tp4648545p4648

[R] Multinomial MCMCglmm

2012-11-06 Thread Vaniscotte.A
Thanks for your answers Stephen and Ben, I hope I am posting on the correct list now. I managed so far to run the multinomial model with random effect with the following command: MCMCglmm(fixed=cbind(Apsy,Mygl,Crle,Crru,Miag,empty) ~ habitat:trait,random=~idh(trait):mesh,family="multinomial12",

Re: [R] Filling matrix elements with a function

2012-11-06 Thread Aimee Kopolow
Hi Jessica and Jim, Thanks for the feedback, Jessica: currently I am defining the functions as the same, but they will be altered at some point soon. Also, I figured that defining the matrix elements as functions would give a dual possibility to the matrix entry depending on the conditions (i.e. o

Re: [R] Excluding fixed number of rows from calculation while summarizing using ddply() function.

2012-11-06 Thread siddu479
Thanks Arun.. I appreciate your time.. in making the generic script. I believe that this is not a very trivial question.. - Sidda Business Analyst Lead Applied Materials Inc. -- View this message in context: http://r.789695.n4.nabble.com/Excluding-fixed-number-of-rows-from-calculatio

Re: [R] Excluding fixed number of rows from calculation while summarizing using ddply() function.

2012-11-06 Thread siddu479
Hi Jeff, First of all I am not a good programmer in R. I have a 2 line code in shell script using awk, head, tail and for loop combination that accomplish this task. So I thought of using R itself to do this task but I don't have any idea how to do it in R. Any way I will try to learn my own wh

[R] Filling dataframe incorrectly in for loop

2012-11-06 Thread petermec
Hi everyone, I am writing a simple script to read in a data file, search through the data file for an exact character match for a microRNA name, subset those rows, and aggregrate a dataframe with those subselections all in a for loop. This is what I have so far: #READ IN DATA file1 = "C:/Desktop/

[R] Confidence intervals for Sen slope in zyp-package

2012-11-06 Thread kun...@gfz-potsdam.de
Hi, I have a question about the computation of confidence intervals in the zyp package, in particular using the functions zyp.sen and confint.zyp, or zyp.yuepilon. (1) I'm a bit confused about the confidence intervals given by zyp.sen and confint.zyp. When I request a certain confidence interv

[R] Plot in function

2012-11-06 Thread Pauli
Hello, I am a R beginner and I have a question about a litte function I found. Here is the code: # Gambler's Ruin Problem. # seed capital:k # rounds: n # probability of success: p # number of trials: N # graphical output (yes/no):

Re: [R] matrix.csr %*% matrix --> matrix

2012-11-06 Thread Sam Steingold
The question is even more pressing for me now given that I no longer can convert some csr matrices to the regular ones for scaling. (http://article.gmane.org/gmane.comp.lang.r.general:279305) Any suggestions? (the original csr matrix is too large to be converted to a regular one, but the product is

Re: [R] no method for coercing this S4 class to a vector

2012-11-06 Thread Sam Steingold
The matrix z is save()d in . It is a product of a sparse matrix and a non-sparse matrix. I need to scale it and write to a file in the sparse format for libsvm. platform x86_64-pc-linux-gnu arch x86_64 os li

Re: [R] options()$width ignored by print.formula

2012-11-06 Thread Sarah Goslee
Thanks, Prof. Ripley. Using deparse(b$formula, width.cutoff = options()$width) works as I'd expected (full example below). So I can use that to write a custom summary.gam(), though that still seems like a lot of work to get summary(b) to follow the usual R output conventions. Sarah library(mgcv)

Re: [R] options()$width ignored by print.formula

2012-11-06 Thread Prof Brian Ripley
On 06/11/2012 17:01, Sarah Goslee wrote: Hi all, I'm working with summary.gam() and noticed that the options()$width argument is ignored by some components of that function, in particular the formula, which is printed at an arbitrary length regardless of the desired width. I've tracked the prob

[R] options()$width ignored by print.formula

2012-11-06 Thread Sarah Goslee
Hi all, I'm working with summary.gam() and noticed that the options()$width argument is ignored by some components of that function, in particular the formula, which is printed at an arbitrary length regardless of the desired width. I've tracked the problem back to print.formula(), so at a lower

Re: [R] Question on callNextMethod

2012-11-06 Thread Martin Morgan
On 11/06/2012 07:03 AM, Simon Knapp wrote: I don't understand why I get the following results. I define two classes 'Base' and 'Derived', the latter of which 'contains' the first. I then define a generic method 'test' and overload it for each of these classes. I call 'callNextMethod()' in the ove

Re: [R] Filling matrix elements with a function

2012-11-06 Thread jim holtman
You need to learn how to debug your code. The most important thing to do is to add: options(error=utils::recover) This will drop you into the 'browser' at the point of the error and then you can examine each of the objects to see where the problem is. As the error says, you have a non-numeric ar

Re: [R] Append Data to an Excel File through each Iteration of a For Loop

2012-11-06 Thread Pieter Schoonees
Look at the append argument of write.table. Also, read ?write.table. The same holds for write.csv. > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of Cheryl Johnson > Sent: Tuesday 6 November 2012 3:38 > To: r-help@r-project.org

Re: [R] Plot 3 lines in one graph

2012-11-06 Thread Ignacio Martinez
Thanks a lot! On Tue, Nov 6, 2012 at 9:31 AM, David L Carlson wrote: > Try this > > ** ** > > x <- read.table(text="V1 V2 V3 V41 > > -4800 25195.73 7415.219 7264.282 > > -2800 15195.73 5415.219 7264.28", > > header=TRUE) > > x > > slopes <- apply(x[1

Re: [R] averaging a list of matrices element wise

2012-11-06 Thread Bert Gunter
Thierry: (Apologies for beating a dead horse ...) Just wanted to point out that sometimes it does not pay to try to be clever: Try the **obvious, simple** solution using a for loop (where z is your list of matrices): > z1 <- 0 > for(i in seq_len(1e6))z1<- z1+z[[i]] > z1<- z1/length(z)}) This wa

[R] Question on callNextMethod

2012-11-06 Thread Simon Knapp
I don't understand why I get the following results. I define two classes 'Base' and 'Derived', the latter of which 'contains' the first. I then define a generic method 'test' and overload it for each of these classes. I call 'callNextMethod()' in the overload for Derived. From the output, it appear

Re: [R] Plot 3 lines in one graph

2012-11-06 Thread David L Carlson
Try this x <- read.table(text="V1 V2 V3 V41 -4800 25195.73 7415.219 7264.282 -2800 15195.73 5415.219 7264.28", header=TRUE) x slopes <- apply(x[1:2,2:4], 2, diff)/diff(x[,1]) inters <- x[1,2:4]-slopes*x[1,1] x[3,] <- cbind(-100, inters+slopes*-100) matplot(x[,1], x[

Re: [R] Apply same linear model to subset of dataframe

2012-11-06 Thread Jean V Adams
Ross, Here's one way to condense the code ... DV <- c("mpg", "drat", "gear") IV <- list(c("cyl", "disp", "hp"), c("wt", "qsec"), c("carb", "hp")) for(i in seq(DV)) { fit <- lm(formula=paste(DV[i], paste(IV[[i]], collapse="+"), sep="~"), data=mtcars) plot(fit$fitted, fit$resid, m

Re: [R] Problem compiling Rnw file

2012-11-06 Thread Riccardo Romoli
Hi, using the full_path I solved the problem. Thanks for your precious suggestion!!! Best Riccardo On Mon, Nov 5, 2012 at 6:12 PM, Yihui Xie wrote: > Let me clarify a little bit about me comments on SO: setwd() should be > called in the first place before you work on anything, and it should > ne

[R] how are the values in ksvm related to the svm formula ( the parameter for kernal function)

2012-11-06 Thread Li, Yan
Hi All, The svm formula, saying the simplest linear one: w*x+b=y. Where w is the normal vectors of the hyper plane and can be calculated by sum(alpha(i)*y(i)*x) The values of ksvm of kernlab has alpha, coef, ymatrix, xmatrix and b. b is sure the offset. How are the others related ? alpha = alph

Re: [R] Filling matrix elements with a function

2012-11-06 Thread arun
Hi, I guess this should also work. f.1 <- function(x) x * x list1<-lapply(rep(list(f.1),25),function(x) x) mat1<-array(unlist(list1),dim=c(5,5))  mat1[[1,1]](3) #[1] 9 A.K. - Original Message - From: jim holtman To: Jessica Streicher Cc: r-help ; Aimee Kopolow Sent: Tuesday, Novembe

Re: [R] Post hoc tests in gam (mgcv)

2012-11-06 Thread Jean V Adams
David, How would you interpret the results of a post hoc test for sexcolor when you have an interaction term with sexcolor in your model? Perhaps it would be helpful to plot doy vs. predicted tle with confidence intervals for each of the four levels of sexcolor at a fixed tl (e.g., the mean).

Re: [R] averaging a list of matrices element wise

2012-11-06 Thread ONKELINX, Thierry
Dear all, Thanks a lot for your suggestions. Arun's suggestion of using simplify2array is only marginally faster than my attempt. The solutions of Dimitris and Bert however were 78 and 30 times faster than my attempt (using n = 51, s = 25, r = 1000 what will be about their size in my applicati

[R] Problem in rhipe.lm.R

2012-11-06 Thread Vignesh Prajapati
Hello All, I am new to Rhipe, my goal is to perform linear regression with Rhipe(R and Hadoop) on data stored at HDFS. But while I am adding R file which have rhlm function gives an error like *> source(file="/media/SYSTEM@/ML/R_HADOOP/**rhipe.lm.R*"*) *Error in source(file = "/media/SYSTEM@/ML/

Re: [R] how Can make function for selecting the products

2012-11-06 Thread Jessica Streicher
If i understand this correctly, what you want to use is a vector or a list as a parameter to that function. getdata<-function(letterVec){ ... query<-paste("SELECT *FROM myfile1 where MODEL in", sqlListFromVector(letterVec)) ... } sqlListFromVector<-function(v){

Re: [R] Filling matrix elements with a function

2012-11-06 Thread jim holtman
Try this if you want a matrix of functions: > # define matrix of list() > x <- vector('list', 25) > dim(x) <- c(5,5) > f.1 <- function(x) x * x > x[[1,1]] <- f.1 > x[[2,2]] <- f.1 > # call the functions > x[[2,2]](42) [1] 1764 > x[[1,1]](3) [1] 9 > On Tue, Nov 6, 2012 at 6:01 AM, Jessica Strei

Re: [R] Plot 3 lines in one graph

2012-11-06 Thread Ignacio Martinez
Hi David. Using the two points to compute slopes and intercepts for the lines and then plotting is exactly what I want to do. Thanks! On Tue, Nov 6, 2012 at 12:16 AM, David L Carlson wrote: > matplot works just fine, but you only have two data points, at -4800 and at > -2800. You chop the x

Re: [R] A general question: Is language S a component part of R?

2012-11-06 Thread Suzen, Mehmet
On Tue, Nov 6, 2012 at 2:34 AM, Hadley Wickham wrote: > On Monday, November 5, 2012, Rolf Turner wrote: > >> On 06/11/12 09:40, Iurie Malai wrote: >> >>> So, R (as a language) can be viewed as an extended S language (S + some >>> improvements)? And the R environment includes this (extended) langua

[R] how Can make function for selecting the products

2012-11-06 Thread Tammy Ma
HI. I make this code: getdata<-function('a','b','c' ,'d','e','f'){ drv <- dbDriver("SQLite") con<-dbConnect(drv, "sqlite.db") lt<-dbListTables(con) myf<-data.frame(NULL) for (i in 1:length(lt)) { myfile<-dbReadTable(con,lt[i]) myfile1<-myfile[-c(14:44)] myfile1$MODEL<-gsub(" ", "", myfile1$

Re: [R] optim & .C / Crashing on run

2012-11-06 Thread Paul Browne
Ah, I hadn't looked at all closely enough at that line then! The parameter with value ~434 is most likely the cause of the problem, since the actual value of that parameter in usage is never going to much exceed ~1E-5 - ~1.0. This too-large computed step must be what then causes the external cod

  1   2   >