[R] Little's Chi Square test for MCAR?

2012-11-29 Thread Sileshi Melesse
Is there any further development in R to identify the missing data Mechanism? Would you please help ? === Please find our Email Disclaimer here-->: http://www.ukzn.ac.za/disclaimer === [[alternative HTML version deleted]] __ R-help@r-p

[R] How to add widgets of gWidgets to widgets of rgtk2 ???

2012-11-29 Thread KRISHNA2222
I have a layout in gwidgets. To this, I wanted to add a Textbox(gtkEntry) created from rgtk2... The code is as follows: MainLayOut <- glayout(homogeneous = FALSE, spacing = 10, container = SubGroup) MainLayOut[1, 1, anchor=left] <- "Number of Total Patients: " font(MainLayOut[1, 1, anchor=left

Re: [R] How to subtract the counter i in for loop?

2012-11-29 Thread C W
thanks, Berend. Both of your code works great. Is there a function that can do it? Something like this: x <- matrix(NA, nrow=15, ncol=2) for(i in 1:15){ x[i,] <- sample(c(NA, 20, 77), 2, prob=c(0.2, 0.3, 0.4)) } > x [,1] [,2] [1,] NA 77 [2,] 77 NA [3,] NA 77 [4,]

Re: [R] How to subtract the counter i in for loop?

2012-11-29 Thread Berend Hasselman
On 30-11-2012, at 05:47, C W wrote: > David, > Your results is, > >> samples > > [1] 111 NA 111 NA 111 NA 111 NA 111 NA > It still has NA's in it. I want it look like this, > >> samples > > [1] 111 111 111 111 111 You don't need the for loop at all. samples <- x[x<200] or samples

[R] SVM using R

2012-11-29 Thread vivek kumar singh
HI All, I am very new to R tool. Can some one please suggest me some tutorial links for understanding SVM using R. Regards, Vivek __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http

Re: [R] How to subtract the counter i in for loop?

2012-11-29 Thread C W
David, Your results is, > samples [1] 111 NA 111 NA 111 NA 111 NA 111 NA It still has NA's in it. I want it look like this, > samples [1] 111 111 111 111 111 thanks, Mike On Thu, Nov 29, 2012 at 7:55 PM, David Winsemius wrote: > > On Nov 29, 2012, at 3:25 PM, C W wrote: > > I want t

Re: [R] Help with this error "kernlab class probability calculations failed; returning NAs"

2012-11-29 Thread Brian Feeny
Max, Thank you for the assistance. That was it. My dependent variable was just using 1 and 0 as levels, I changed them to "yes", "no": levels(trainset$outcome) <- list(no="0", yes="1") and I no longer get the warning. Brian On Nov 29, 2012, at 10:29 PM, Max Kuhn wrote: > Your output has:

Re: [R] Data Cleaning -New user coming from SAS

2012-11-29 Thread arun
HI Arum, May be this helps: #dat is the data  res<-do.call(rbind,lapply(split(dat,cumsum(as.numeric(grepl("Loan",dat$Date,function(x){ x[,1]<-x[1,4];x[,2]<-x[1,6];return(x)}))  row.names(res)<-1:nrow(res)  res[,1:4] #  Loan..   Account.Name   Date Action #1  

Re: [R] Example metropolis hasting

2012-11-29 Thread Jeff Newmiller
At the R prompt, type RSiteSearch("metropolis Hastings") and catch your own fish. --- Jeff NewmillerThe . . Go Live... DCN:Basics: ##.#. ##.#. Live Go...

Re: [R] Help with this error "kernlab class probability calculations failed; returning NAs"

2012-11-29 Thread Max Kuhn
Your output has: "At least one of the class levels are not valid R variables names; This may cause errors if class probabilities are generated because the variables names will be converted to: X0, X1" Try changing the factor levels to avoid leading numbers and try again. Max On Thu, Nov 29,

[R] Example metropolis hasting

2012-11-29 Thread Tania
Hello all, could you tell where is an example of metropolis hasting? Thank you! Tania Sent from my iPod __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting

Re: [R] Help with this error "kernlab class probability calculations failed; returning NAs"

2012-11-29 Thread Brian Feeny
Yes I am still getting this error, here is my sessionInfo: > sessionInfo() R version 2.15.2 (2012-10-26) Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit) locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8 attached base packages: [1] stats graphics grDevices utils

Re: [R] Help with this error "kernlab class probability calculations failed; returning NAs"

2012-11-29 Thread Max Kuhn
You didn't provide the results of sessionInfo(). Upgrade to the version just released on cran and see if you still have the issue. Max On Thu, Nov 29, 2012 at 6:55 PM, Brian Feeny wrote: > I have never been able to get class probabilities to work and I am > relatively new to using these tools

Re: [R] Confidence intervals for estimates of all independent variables in WLS regression

2012-11-29 Thread Torvon
Rui, Thank you very much. Are there other things I have to adjust except for exchanging "object" by the name of my model? Torvon On 29 November 2012 08:17, Rui Barradas wrote: > ci_lm <- function(object, level = 0.95){ > summfit <- summary(object) > beta <- summfit$coefficients[, 1] >

Re: [R] googleVis plot and knitr/sweave

2012-11-29 Thread Yihui Xie
Then you can take a look at the ggmap (on CRAN) or snippets package (on Simon's RFroge: http://rforge.net/snippets/), which supports OpenStreet Map; googleVis is HTML/SVG based. Regards, Yihui -- Yihui Xie Phone: 515-294-2465 Web: http://yihui.name Department of Statistics, Iowa State University

Re: [R] How to subtract the counter i in for loop?

2012-11-29 Thread David Winsemius
On Nov 29, 2012, at 3:25 PM, C W wrote: > I want to fill up vector a with vector b. Vector "a"? Vector "b"? > The condition is: b<200, otherwise don't fill it up. That would seem to be the current behavior, subject of course to an agreed upon definition for "filling up". It's possible , ev

Re: [R] googleVis plot and knitr/sweave

2012-11-29 Thread Filoche
Hi and thank you for your answer. In fact, I don't really need the interactive part of googleVis map. So if there's a way to plot a static version of the map it would be perfect for me. Regards, Phil -- View this message in context: http://r.789695.n4.nabble.com/googleVis-plot-and-knitr-swea

[R] Help with this error "kernlab class probability calculations failed; returning NAs"

2012-11-29 Thread Brian Feeny
I have never been able to get class probabilities to work and I am relatively new to using these tools, and I am looking for some insight as to what may be wrong. I am using caret with kernlab/ksvm. I will simplify my problem to a basic data set which produces the same problem. I have read th

Re: [R] RGL plot : cex and zlim arguments do not work

2012-11-29 Thread Duncan Murdoch
On 12-11-29 2:49 PM, Stephane Chantepie wrote: yes sorry, When we use this function text3d(1:3, 1:3, 1:3, LETTERS[1:3], cex=1:3) we expect the letters to have different size (increase from 1 to 3). But when I try this code , all the letter have the same size. This problem (to not be able to

[R] [mgcv][gam] Manually defining my own knots?

2012-11-29 Thread Andrew Crane-Droesch
Dear List, I'm using GAMs in a multiple imputation project, and I want to be able to combine the parameter estimates and covariance matrices from each completed dataset's fitted model in the end. In order to do this, I need the knots to be uniform for each model with partially-imputed data.

Re: [R] How to subtract the counter i in for loop?

2012-11-29 Thread Jean V Adams
Mike, I'm still not sure what you want samples to look like, but here are a couple possibilities, using a different x. library(zoo) x <- c(50, 250, 100, 300, 300, 20, 40, 800) samples1 <- ifelse(x<200, x, NA) samples2 <- na.locf(samples1) samples3 <- samples1[!is.na(samples1)] samples1 sa

Re: [R] Coerce rownames to factor for ordering

2012-11-29 Thread Jean V Adams
Josh, The code you submitted is not reproducible. I don't have the following objects: barchart, DataToPlot..SeCl, or Colors. However, I think I can answer your questions, with some modified code ... A rowname can't be a factor. But you can still use a factor to sort the rows of your

Re: [R] How to subtract the counter i in for loop?

2012-11-29 Thread C W
I want to fill up vector a with vector b. The condition is: b<200, otherwise don't fill it up. Mike On Thu, Nov 29, 2012 at 6:11 PM, David Winsemius wrote: > > On Nov 29, 2012, at 1:55 PM, C W wrote: > > > Hi list, > > I am writing a for loop that looks like this: > > samples<-rep(NA,10) > > x <

Re: [R] How to subtract the counter i in for loop?

2012-11-29 Thread C W
Hi Jean, I am going through vector x, if it is less than 200, fill it into samples. I am having trouble with indexing x. For example, samples <-rep(NA, 10) at i=2 x[2], 225<200 is not true; and samples[2] remains NA. The loop continues to i=3, leaving x[2]=NA. I don't want that to happen, I wa

Re: [R] Data Cleaning -New user coming from SAS

2012-11-29 Thread Jean V Adams
Other readers of this list may have better suggestions for how to read in data with interspersed header rows, but here's a work-around to do specifically what you requested ... # find the rows where "Loan" is in the Date column sel <- grep("Loan", dat$Date) # create a new vector with these row

Re: [R] How to subtract the counter i in for loop?

2012-11-29 Thread David Winsemius
On Nov 29, 2012, at 1:55 PM, C W wrote: > Hi list, > I am writing a for loop that looks like this: > samples<-rep(NA,10) > x <- rep(c(111, 225), 5) > for(i in 1:10){ >If(x[i]<200){ > samples[i] <- x[i] > }else{ > i=i-1 If you expected the else clause to assign something to th

Re: [R] How to subtract the counter i in for loop?

2012-11-29 Thread Jeff Newmiller
Use a while loop instead of a for loop. I don't think what you have coded makes any sense, but fighting the for loop over control of the indexing variable is a recipe for failure. --- Jeff NewmillerThe

Re: [R] How to subtract the counter i in for loop?

2012-11-29 Thread Jean V Adams
Mike, Based on this example, what do you want samples to look like? It's not clear to me what you're trying to do with i-1 Jean C W wrote on 11/29/2012 03:55:12 PM: > > Hi list, > I am writing a for loop that looks like this: > samples<-rep(NA,10) > x <- rep(c(111, 225), 5)

[R] instrumental variables regression using ivreg (AER) or tsls (sem)

2012-11-29 Thread Ranjan Maitra
Dear friends, I am trying to understand and implement instrumental variables regression using R. I found a small (simple) example here which purportedly illustrates the mechanics (using 2-stage least-squares): http://www.r-bloggers.com/a-simple-instrumental-variables-problem/ Basically, here ar

Re: [R] bootstrapped cox regression (rms package)

2012-11-29 Thread Eric Claus
Hi Frank, Below is the actual output from the anova(out) command. I had copied in the p-values and from the previous output from anova(out) and the confidence intervals from print(quantile(out$boot.Coef[,i], c(.025, .975))) to illustrate that the confidence intervals were similar to SPSS while the

Re: [R] knitr error with Lyx

2012-11-29 Thread Mark Lamias
Hi, Yihui, Attached is an HTML Diff report of the two files.  The left pane contains the R-2.15.0 file. Thanks. --Mark From: Yihui Xie To: Mark Lamias Cc: "r-help@r-project.org" Sent: Thursday, November 29, 2012 2:43 PM Subject: Re: [R] knitr error wi

Re: [R] Analysis of Variance

2012-11-29 Thread arun
HI, Try this:  res2<-aov(time~factor(drug),data=example12_7)  summary(res2) # Df Sum Sq Mean Sq F value Pr(>F)  #factor(drug)  2  21.98  10.991   4.188 0.0345 * #Residuals    16  41.99   2.624 #--- #Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 A.K.

[R] How to subtract the counter i in for loop?

2012-11-29 Thread C W
Hi list, I am writing a for loop that looks like this: samples<-rep(NA,10) x <- rep(c(111, 225), 5) for(i in 1:10){ If(x[i]<200){ samples[i] <- x[i] }else{ i=i-1 } } The problem is that the returning vector still contains NA, I think the i in "else" is not getting subtr

Re: [R] Read in alphanumeric column without decimals

2012-11-29 Thread Steven Ranney
Thanks for the replies. I hadn't considered changing the original spreadsheet to a table as there are several different analyses using the .xlsx spreadsheet that contains the alphanumeric data, thus requiring an alteration of all of our code. However, the first response did prompt me to try chang

Re: [R] Read in alphanumeric column without decimals

2012-11-29 Thread jim holtman
Your problem is the the data read in from the spreadsheet is probably a 'factor' since it has a non-numeric in the column. To change it to number you have to do the following as.numeric(as.character(yourdata$TeamLeaderID)) What you as seeing with just the call to as.numeric is the value of the '

Re: [R] Analysis of Variance

2012-11-29 Thread Andrés Aragón Martínez
Hi D, R is taking drug as numeric, you ned indicate to R that drug is a factor: > example12_7$drug <-factor(example12_7$drug) > ej2<-aov(time~drug,data=example12_7) > summary(ej2) Df Sum Sq Mean Sq F value Pr(>F) drug 2 21.98 10.991 4.188 0.0345 * Residuals 16 41.99

Re: [R] Help in Bissection algorithm

2012-11-29 Thread jim holtman
What is 'i'? I don't see it as a parameter? is it something in the global environment that you forgot to pass? On Thu, Nov 29, 2012 at 10:18 AM, finehko wrote: > I'm trying to make a function witch recieves a function "f", "a" and "b", and > the error "e". When I run the algorithm without label

Re: [R] error, R commends cannot show the expected output

2012-11-29 Thread David Winsemius
On Nov 28, 2012, at 5:43 PM, Jack Bryan wrote: > > I run You are asked to state which OS and version of R you are using. > >> cars <- c(1, 3, 6, 4, 9) >> plot(cars) When this happens and you add: dev.new() ### Do you then see a plot with: plot(cars)# ??? -- David > > No graph pop

Re: [R] Conditional model in R

2012-11-29 Thread David Winsemius
On Nov 28, 2012, at 11:32 AM, Kirsten Martin wrote: > Hello all, > > I have a data set where the response variable is the percent cover of a > specific plant (represented in cover classes 0,1,2,3,4,5, or 6). This data > set has a lot of zeros (plots where the plant was not present). > I am try

Re: [R] libary survival

2012-11-29 Thread David Winsemius
On Nov 29, 2012, at 5:18 AM, Thiago Luiz Nogueira da Silva wrote: > > Hello,I would like to know if there is residue analysis after the Cox model > and make the adjustment for my random cluster? Is this in 'coxme' or in 'survival'. If in 'survival' then there are "residuals" functions and wh

Re: [R] Weight matrix in linear regression

2012-11-29 Thread Mikołaj Hnatiuk
Hello, is there a way to compute multilevel (3-stage) regression using weights matrix (on different levels, just like in HLM) in R ? The nlme package doesn't seem to get the job done. Do you have any suggestions ? I _really_ don't want to use HLM to do this. Best, Mikołaj Hnatiuk 2012/11/29 Greg

Re: [R] googleVis plot and knitr/sweave

2012-11-29 Thread Yihui Xie
I'm not aware of the possibility of embedding google vis in PDF: https://developers.google.com/chart/interactive/docs/gallery I do not think everything has to live in PDF, otherwise what is the point of HTML/JS and web browsers? Regards, Yihui -- Yihui Xie Phone: 515-294-2465 Web: http://yihui.na

[R] Analysis of Variance

2012-11-29 Thread David Arnold
Hi, I am encountering a difficulty I don't understand. Be patient, I'm very new to analysis of variance. If I load this data: example12_7=read.table("http://msemac.redwoods.edu/~darnold/math15/data/chapter12/example12_7.dat",header=TRUE) The run the oneway.test: oneway.test(time~drug,data=examp

[R] Data Cleaning -New user coming from SAS

2012-11-29 Thread arum
Hello, this is my first post. I have a large CSV file where I need to fill in the 1st and 2nd column with a Loan # and Account name that would be found in a line of text : like this: ,,Loan #:,ML-113-07,Account Name:, Quilting Boutique,,, I would like to place the Loan #: ML-113-07 in the f

Re: [R] Help

2012-11-29 Thread Rui Barradas
Hello, The following document is _not_ about lm(), it's about creating packages but it includes an example that might answer to what you want, a simple lm() substitute. (It uses the QR decomposition, not Cholesky) http://cran.r-project.org/doc/contrib/Leisch-CreatingPackages.pdf Hope this help

Re: [R] Help in Bissection algorithm

2012-11-29 Thread William Dunlap
And have the function return a value. All values set in the function will be destroyed when the function is done - you must return something and the caller must assign the return value to a variable if you want to keep it. E.g., raiz function (f, a, b, e) { i <- 0 repeat { if (i

Re: [R] Help in Bissection algorithm

2012-11-29 Thread Rui Barradas
Hello, Actually, it would throw an error, you forgot to assign 'i'. And in the end your function didn't have a return value. I've edited and simplified it a bit. (And what to do if abs(a - b) == e ? The second condition was deleted.) raiz <- function(f,a,b,e){ i <- 0 repeat{ if

Re: [R] Help in Bissection algorithm

2012-11-29 Thread Berend Hasselman
On 29-11-2012, at 16:18, finehko wrote: > I'm trying to make a function witch recieves a function "f", "a" and "b", and > the error "e". When I run the algorithm without labeling it a function and > typing the values it works, but when I just try to save it in a function It > doesn't ' bug but do

[R] googleVis plot and knitr/sweave

2012-11-29 Thread Filoche
Dear R users. I'm currently making a report with knitr (RStudio) where I would like to plot a googleVis map. However, the map generated is an HTML file which I don't know how to integrate it in my report. So my question is how to include a map generated with googleVis in a PDF created with knitr

Re: [R] deleting data of a given date range.

2012-11-29 Thread arun
Hi, You haven't given any example dataset.  So,not sure about the format of the date column. set.seed(5) dat1<-data.frame(Date1=c("10/25/2009","11/25/2009","12/25/2009","5/10/2010","8/10/2010","9/25/2011","11/28/2011","5/3/2012"),col2=sample(1:15,8,replace=TRUE)) dat1$Date1<-as.Date(dat1$Date1,fo

Re: [R] bootstrapped cox regression (rms package)

2012-11-29 Thread Frank Harrell
Eric, the output you showed for anova(out) is not correct. anova.rms does not produce such output. Please give us the correct script that obtained those results and let us know if you are overriding the anova command somehow. To your point, make sure that SPSS does not use the bootstrap to obtai

[R] Help

2012-11-29 Thread Mohammad Ahmed
Help Please Hello, I want to find the whole hat matrix not only the hat values. Is there anyway that could be extracted from lm function ?. If not, please suggest something else. Direct computations using chol2inv or solve are not stable if t(X)%*%X has   high determinant. In this case lm is sti

[R] Coerce rownames to factor for ordering

2012-11-29 Thread LCOG1
Hi all, I think this might be an easy one but I cannot think of a way to do this other than what I am currently attempting. I simply want to sort my data frame's rownames by a defined vector so that the plots I generate from that vector are in the desired order Consider the test data below:

[R] Help in Bissection algorithm

2012-11-29 Thread finehko
I'm trying to make a function witch recieves a function "f", "a" and "b", and the error "e". When I run the algorithm without labeling it a function and typing the values it works, but when I just try to save it in a function It doesn't ' bug but don't do anything. Here's the code, anyone know what

Re: [R] [R-pkgs] New package: gRain - gRAphical Independence Networks

2012-11-29 Thread fkh
I am trying to use your package gRain using your book on graphical models in R to do predictions, I have 38 columns of vectors all factors and built a bayesian network using iamb() function, then I used the following command to make a grpahNEL (However, I have 38 nodes and 106 edges) using BN<-ia

[R] Read in alphanumeric column without decimals

2012-11-29 Thread Steven Ranney
All - How can I read in a column of alphanumeric values without including ".0" on the numeric values? Original column: TeamLeaderID 258 342 316 U8 331 279 D1 116 235 296 ... [truncated] leaders = read.xlsx2('FILE', sheetIndex = 1, header = T) Column after it's been read in: leaders$TeamLeader

Re: [R] Weight matrix in linear regression

2012-11-29 Thread Greg Snow
The gls function in the nlme package is one approach. If you know the covariance matrix exactly (it is just numerical with nothing that needs to be estimated) then you can also take the Cholesky decomposition of the inverse of the covariance matrix (or other square root method) and multiply the x

Re: [R] RGL plot : cex and zlim arguments do not work

2012-11-29 Thread Stephane Chantepie
yes sorry, When we use this function text3d(1:3, 1:3, 1:3, LETTERS[1:3], cex=1:3) we expect the letters to have different size (increase from 1 to 3). But when I try this code , all the letter have the same size. This problem (to not be able to resize character) occurs with diiferent the text

Re: [R] knitr error with Lyx

2012-11-29 Thread Yihui Xie
That is very helpful! Just to continue debugging, can you save the two versions of the tex files produced from LyX with different versions of R and do a diff on them? It sounds like something has changed from R 2.15.0 to 2.15.2. Regards, Yihui -- Yihui Xie Phone: 515-294-2465 Web: http://yihui.na

Re: [R] RGL plot : cex and zlim arguments do not work

2012-11-29 Thread Duncan Murdoch
On 29/11/2012 1:34 PM, Stephane Chantepie wrote: Hi Ducan and others, I am sorry for this such late reply but I did not see that I had a reply... I have not solved the problem text3d(1:3, 1:3, 1:3, LETTERS[1:3], cex=1:3) does not work for me It works for me. Perhaps if you explained what "

Re: [R] Can R be embedded in html?

2012-11-29 Thread Mark Lamias
I haven't used it yet, so I can't comment about the stability or appropriateness of it, but R.NET looks somewhat promising for this: http://rdotnet.codeplex.com/ Shiny is another potential way to go. You could also take a look at David Firth's CGIwithR:  http://www2.warwick.ac.uk/fac/sci/stati

Re: [R] knitr error with Lyx

2012-11-29 Thread Mark Lamias
Thanks, Yihui! Luckily I kept R-2.15.0 and left it untouched (so I can continue to use that for now).  If it helps any, I was able to go back into Lyx and change the path to point to R-2.15.0 and I also changed the windows path environment variable to point to the old version.  After doing this

Re: [R] Can R be embedded in html?

2012-11-29 Thread Yihui Xie
I did not read every reply; perhaps someone has already mentioned Shiny. There are a few live examples of "embedding R in HTML" here: http://www.rstudio.com/shiny/ Regards, Yihui -- Yihui Xie Phone: 515-294-2465 Web: http://yihui.name Department of Statistics, Iowa State University 2215 Snedecor

Re: [R] Fast Normalize by Group

2012-11-29 Thread Berend Hasselman
On 29-11-2012, at 19:55, Noah Silverman wrote: > Hi, > > I have a very large data set (aprox. 100,000 rows.) > > The data comes from around 10,000 "groups" with about 10 entered per group. > > The values are in one column, the group ID is an integer in the second column. > > I want to normali

Re: [R] Fast Normalize by Group

2012-11-29 Thread Noah Silverman
Close, but not quite what I need. That very nicely gives me sums by group. I need to take each value of X and divide it by the sum of the group it belongs to. With your example, I have 100,000 X and only 10,000 group. The "by" command gives me 10,000 sums. I still have to loop over all 100,0

Re: [R] Fast Normalize by Group

2012-11-29 Thread jim holtman
try the 'data.table' package. Takes about 0.1 seconds to normalize the data. > x <- data.frame(id = sample(1, 10, TRUE), value = runif(10)) > require(data.table) Loading required package: data.table data.table 1.8.2 For help type: help("data.table") > system.time({ + x <- data.ta

Re: [R] Fast Normalize by Group

2012-11-29 Thread Rui Barradas
Hello, If yopu want one value per group use tapply(), if you want one value per value of x use ave() tapply(x, group, FUN = function(.x) .x/sum(.x)) ave(x, group, FUN = function(.x) .x/sum(.x)) Hope this helps, Rui Barradas Em 29-11-2012 18:55, Noah Silverman escreveu: Hi, I have a very l

Re: [R] Fast Normalize by Group

2012-11-29 Thread Mikołaj Hnatiuk
Yes, type in: ?by for example: data <- data.frame(fac=factor(c("A","A","B","B")), vec=c(1:4) ) by(data$vec,data$fac, FUN=sum) Best, Mikołaj Hnatiuk 2012/11/29 Noah Silverman > Hi, > > I have a very large data set (aprox. 100,000 rows.) > > The data comes from around 10,000 "groups" with about

Re: [R] Fast Normalize by Group

2012-11-29 Thread Peter Langfelder
Not tested but should work: sums = tapply(x, group, sum); sums.ext = sums[ match(group, names(sums))] normalized = x/sums.ext It may be that the tapply is just as slow as your loop though, I'm not sure. HTH, Peter On Thu, Nov 29, 2012 at 10:55 AM, Noah Silverman wrote: > Hi, > > I have a ver

Re: [R] knitr error with Lyx

2012-11-29 Thread Yihui Xie
Quite a few people have had this problem, but since I'm unable to reproduce it, I'm not exactly sure how to fix it either. A few references that might be helpful to you: http://stackoverflow.com/q/12448507/559676 https://github.com/yihui/knitr/issues/413 It is very likely to be a pure LaTeX probl

[R] Fast Normalize by Group

2012-11-29 Thread Noah Silverman
Hi, I have a very large data set (aprox. 100,000 rows.) The data comes from around 10,000 "groups" with about 10 entered per group. The values are in one column, the group ID is an integer in the second column. I want to normalize the values by group: for(g in unique(groups){ x[group==

Re: [R] RGL plot : cex and zlim arguments do not work

2012-11-29 Thread Stephane Chantepie
Hi Ducan and others, I am sorry for this such late reply but I did not see that I had a reply... I have not solved the problem text3d(1:3, 1:3, 1:3, LETTERS[1:3], cex=1:3) does not work for me Maybe it is related to my material, I am on linux debian Sys.info() sysname "Linux" release

[R] What am I missing when using zoo on version 2.15?

2012-11-29 Thread Eduardo M. A. M.Mendes
Hello I am running R versions 2.13 and 2.15. One of my codes run ok on 2.13 but on 2.15. I have tried to understand what is wrong but come up with nothing. Here is the code rm(list=ls()) graphics.off() library(R.matlab) library(zoo); library(xts); library(lattice); library(h

Re: [R] Label axis with strings instead of numbers

2012-11-29 Thread Rui Barradas
Hello, Use argument yaxt = "n" of function symbols. yaxt means "y axis type" and "n" for "none" (or "no"). Then plot the axis with axis(2, ...) Hope this helps, Rui Barradas Em 29-11-2012 16:17, seanlilley escreveu: Hi, The axis function plots an axis ontop of my current axis. So although I

[R] knitr error with Lyx

2012-11-29 Thread Mark Lamias
R Users, I just upgraded my version of R from R-2.15.0 to R-2.15.2 and installed the latest versions of LyX and MikTex running Windows 7 Ultimate, 64-bit OS.  Prior to the upgrade, I was using Lyx with knitr to generate a document with no problems.  However, after the upgrade, and using the sa

[R] How to use doSMP(revoIPC) with R 2.15.x version

2012-11-29 Thread 박상규
Hello, I'd like to use package 'doSMP'. But I can only found source codes in the CRAN. I tried to build source code using 'r CMD build doSMP' in the source directory, the following error is shown: ERROR: dependencies 'foreach', 'iterators', 'revoIPC' are not available for pack age 'doSMP' So

Re: [R] Deleting certain observations (and their imprint?)

2012-11-29 Thread Sarah Goslee
Hi Kirk, It's because tension is a factor with three levels, as you could see with str(warpbreaks). Factors are one of the mysteries of R that distinguish a novice from an initiate. Reading ?subset directs you to ?droplevels. Here's an example: > summary(warpbreaks) breaks wool tens

Re: [R] QQplot

2012-11-29 Thread FJ M
Have you tried fitting your data to the Pearson family of distributions? In particular the Pearson Type IV has parameters to fit skewed and kurtotic distributions. The Pearson library is described here: http://cran.r-project.org/web/packages/PearsonDS/PearsonDS.pdf The Type IV is described here

Re: [R] GSCA package error

2012-11-29 Thread Seb
it's the GSCA packagei made a typo in the subject, my apologies the package is available from here http://www.biostat.wisc.edu/~kendzior/GSCA/ i am now trying to do co-expression analysis using EBcoexpress but looks like i have a similar problem due to the sample size! thanks! -- View thi

[R] Deleting certain observations (and their imprint?)

2012-11-29 Thread Stodola, Kirk
I'm manipulating a large dataset and need to eliminate some observations based on specific identifiers. This isn't a problem in and of itself (using which.. or subset..) but an imprint of the deleted observations seem to remain, even though they have 0 observations. This is causing me problems

Re: [R] splitting a string by space except when contained within quotes

2012-11-29 Thread arun
Hi, You could also do this:  res<-unlist(strsplit(str,"[\"]"))  res1<-res[res!=" "] res2<-c(unlist(strsplit(res1[grepl("\\s+$",res1)]," ")),res1[!grepl("\\s+$",res1)]) res2 #[1] "rainfall"    "snowfall"    "Channel storage" "Rivulet storage" A.K. - Original Message - From: dow

Re: [R] splitting a string by space except when contained within quotes

2012-11-29 Thread arun
Hi, May be this helps: str1 <- 'rainfall snowfall "Channel storage" "Rivulet storage"' res<-unlist(strsplit(gsub("[\"]","",str1)," "))  res1<-c(res[1],res[2],paste(res[3],res[4],""),paste(res[5],res[6],collapse=""))  res1 #[1] "rainfall" "snowfall" "Channel storage " "Rivulet stora

Re: [R] Can R be embedded in html?

2012-11-29 Thread Gergely Daróczi
I grab the opportunity to suggest giving a try `pander` package, which holds a forked version of `brew` called `Pandoc.brew`. If you are familiar with `brew`, you could easily create nicely formatted HTML output automatically beside other formats, example: http://rapporter.github.com/pander/#exampl

Re: [R] comparing two vectors

2012-11-29 Thread Berend Hasselman
On 29-11-2012, at 14:28, soham chakraborty wrote: > Hello, > I am performing Newton Raphson iteration where the parameter vector which I > want to optimize is an *nx1* vector. Are you trying to solve a system of nonlinear equations? Have a look at package nleqslv. Are you max-/min-imizing a fun

Re: [R] Label axis with strings instead of numbers

2012-11-29 Thread seanlilley
Hi, The axis function plots an axis ontop of my current axis. So although I am able to write my labels in, they are written ontop of the numbers in the current axis rather than replacing them. Any other alternatives? Sean -- View this message in context: http://r.789695.n4.nabble.com/Label-ax

Re: [R] How to handle Chinese [It seems Cyrillic] character in R plot?

2012-11-29 Thread Prof Brian Ripley
Your subject line says Chinese! On 29/11/2012 08:42, Manish Gupta wrote: Hi, I m working on R plot with Russian label but on windows (adobe) russian text are not visible. Do i need to install some package to view it. pdf("sample.pdf",width = 6.6 ,height = 4.2,family= "URWHelvetica", encoding

[R] bootstrapped cox regression (rms package)

2012-11-29 Thread Eric Claus
Hi, I am trying to convert a colleague from using SPSS to R, but am having trouble generating a result that is similar enough to a bootstrapped cox regression analysis that was run in SPSS. I tried unsuccessfully with bootcens, but have had some success with the bootcov function in the rms package

Re: [R] splitting a string by space except when contained within quotes

2012-11-29 Thread William Dunlap
Try using scan(quote='"', ...), as in the following > str <- 'rainfall snowfall "Channel storage" "Rivulet storage"' > scan(text=str, what="", quote='"', quiet=TRUE) [1] "rainfall""snowfall""Channel storage" "Rivulet storage" Bill Dunlap Spotfire, TIBCO Software wdunlap tibco

Re: [R] Label axis with strings instead of numbers

2012-11-29 Thread Rui Barradas
Hello, See the ?axis function, argument 'labels'. Hope this helps, Rui Barradas Em 29-11-2012 12:20, seanlilley escreveu: I have created a bubble plot in R using the following formula: symbols(Data$Day.Number,Data$Team,circles=Data$Total.amount, inches=0.5, fg="white",bg="red",xlab="Day Numbe

[R] QQplot

2012-11-29 Thread Nathan
Hi! We are stuck with a problem considering the qqplot of a dataset. We are trying to discover what kind of distribution this is. We already tried to normal, exponential or the logaritmical distribution but none of those are able to solve our

Re: [R] splitting a string by space except when contained within quotes

2012-11-29 Thread Gabor Grothendieck
On Thu, Nov 29, 2012 at 9:43 AM, downtowater wrote: > I've been trying to split a space delimited string with double-quotes in R > for some time but without success. An example of a string is as follows: > > /rainfall snowfall "Channel storage" "Rivulet storage"/ > > It's important for us because

Re: [R] Conditional model in R

2012-11-29 Thread Kirsten Martin
Thank you very much, I'll look into that package! Kirsten _ Kirsten Martin Von Holle Lab Department of Biology, BL 405 University of Central Florida Orlando, FL 32816 From: Jagat.K.Sheth [via R] [ml-node+s

Re: [R] deleting data of a given date range.

2012-11-29 Thread PIKAL Petr
Hi > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of siddanth911 > Sent: Thursday, November 29, 2012 12:10 PM > To: r-help@r-project.org > Subject: [R] deleting data of a given date range. > > hey, > > I have a huge dataset w

Re: [R] Calculating Linkage Disequilibrium for Microsatellite Markers?

2012-11-29 Thread david_c
Function LDkl of package gap. I am also trying to use it. -- View this message in context: http://r.789695.n4.nabble.com/Calculating-Linkage-Disequilibrium-for-Microsatellite-Markers-tp4642701p4651285.html Sent from the R help mailing list archive at Nabble.com. ___

Re: [R] GLM Coding Issue

2012-11-29 Thread Craig P O'Connell
Thank you both for the extensive amount of help!  I am sorry it has taken me a bit to respond, but i've been trying to plug away at this.  I still have a few questions, if you don't mind giving me some pointers: Here is the fake data again: treatment feeding avoid

[R] Simper analysis with Morisita-Horn

2012-11-29 Thread VG
Dear ecology fellows, I tried to implement Morisita-Horn distance (instead of Bray that is in the current version) in the code for the Simper analysis in vegan. I would be very grateful if someone can check if the code is right. function (comm, group, ...) { if (any(rowSums(comm, na.rm = T

Re: [R] Conditional model in R

2012-11-29 Thread Kirsten Martin
Jean, Thank you! That is exactly the type of information I was looking for! The script for the combined model is what I couldn't seem to come up with on my own. Thank you again for your help! Sincerely, Kirsten -- View this message in context: http://r.789695.n4.nabble.com/Conditional-model-i

Re: [R] Error 0ps.factor: level sets of factors are different

2012-11-29 Thread arun
Hi, You could do this with ?merge() or ?join() library(plyr) new<-data.frame(ID=1:10,height1=NA) combo<-data.frame(ID=c(3,7,9,10),height=c(185,NA,158,176))  join(new,combo,type="left")[,-2] #Joining by: ID  #  ID height #1   1 NA #2   2 NA #3   3    185 #4   4 NA #5   5 NA #6   6  

[R] comparing two vectors

2012-11-29 Thread soham chakraborty
Hello, I am performing Newton Raphson iteration where the parameter vector which I want to optimize is an *nx1* vector. I am running a while loop which will continue unless a stopping condition is satisfied Now, the stopping condition will have to be such that the parameter vector after two success

[R] libary survival

2012-11-29 Thread Thiago Luiz Nogueira da Silva
Hello,I would like to know if there is residue analysis after the Cox model and make the adjustment for my random cluster? [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https:

  1   2   >