Re: [R] summation coding

2012-10-19 Thread djbanana
I am aware of the most basic stuff, especially vectorization and subscripting. I only gave a simple example with length 4. I need to do that for vectors of length 190. Are there any in-built commands? Or should I write the loops myself? Thank you. -- View this message in context:

[R] MLE of negative binomial distribution parameters

2012-10-19 Thread Zoraida
I need to estimate the parameters for negative binomial distribution (pdf) using maximun likelihood, I also need to estimate the parameter for the Poisson by ML, which can be done by hand, but later I need to conduct a likelihood ratio test between these two distributions and I don't know how to

Re: [R] how R implement qnorm()

2012-10-19 Thread peter dalgaard
On Oct 19, 2012, at 06:05 , Thomas Lumley wrote: On Fri, Oct 19, 2012 at 12:21 PM, Sheng Liu sheng@live.ca wrote: Thanks a lot. It's very helpful. I've read through the c code. Just FYI and for my completion of the question, I post some of my thought on it: To me it looks like the

Re: [R] summation coding

2012-10-19 Thread Rainer Schuermann
Assuming that you actually mean a1(b2+b3+b4) + a2(b1+b3+b4) + a3(b1+b2+b4) + a4(b1+b2+b3) ^ ^ ^ this might give you what you want: x - data.frame( a = sample( 1:10, 4 ), b = sample( 11:20, 4 ) ) x

[R] Memory issue with svm modeling in R

2012-10-19 Thread Vignesh Prajapati
As I found the memory problem with local machine/micro instance(amazon) for building SVM model in R on large dataset(2,01,478 rows with 11 variables), then I have migrated our micro instance to large instance at Amazon. Still I have memory issue with large amazon instance while developing R model

Re: [R] summation coding

2012-10-19 Thread Rainer Schuermann
You asked for a loop, you got one... Vectorized is easier and faster: x$c - x$a * ( sum( x$b ) - x$b ) Rgds, Rainer On Friday 19 October 2012 09:38:35 you wrote: Hi, I think I solved it myself by writing loops. What I meant is: are there in-built functions in R that calculate the

Re: [R] summation coding

2012-10-19 Thread Berend Hasselman
On 18-10-2012, at 21:33, djbanana wrote: I would like to code the following in R: a1(b1+b2+b3) + a2(b1+b3+b4) + a3(b1+b2+b4) + a4(b1+b2+b3) or in summation notation: sum_{i=1, j\neq i}^{4} a_i * b_i I realise this is the same as: sum_{i=1, j=1}^{4} a_i * b_i - sum_{i=j} a_i * b_i

Re: [R] summation coding

2012-10-19 Thread Berend Hasselman
On 19-10-2012, at 10:38, Berend Hasselman wrote: On 18-10-2012, at 21:33, djbanana wrote: I would like to code the following in R: a1(b1+b2+b3) + a2(b1+b3+b4) + a3(b1+b2+b4) + a4(b1+b2+b3) or in summation notation: sum_{i=1, j\neq i}^{4} a_i * b_i I realise this is the same as:

Re: [R] likelihood function involving integration, error in nlm

2012-10-19 Thread Berend Hasselman
On 19-10-2012, at 04:40, stats12 wrote: Dear R users, I am trying to find the mle that involves integration. I am using the following code and get an error when I use the nlm function d-matrix(c(1,1,0,0,0,0,0,0,2,1,0,0,1,1,0,1,2,2,1,0),nrow=10,ncol=2) h-matrix(runif(20,0,1),10)

[R] grid(Base): How to avoid Figure region too small and/or viewport too large by specifying 'relative' units?

2012-10-19 Thread Marius Hofert
Dear grid-expeRts, The goal: I would like to construct a plot (matrix) with grid and gridBase, which consists of four sub-plots. The sub-plots should have a square plotting region as one would force with par(pty=s) in base graphics. The problem: I don't get a square plotting region, not even

Re: [R] Keep loop running after webpage times out?

2012-10-19 Thread R. Michael Weylandt
?tryCatch() Michael On Thursday, October 18, 2012, Cess wrote: Hi I have created a loop to obtain data from several webpages but the loop keeps crashing with the error Error in function (type, msg, asError = TRUE) : Operation timed out after 5000 milliseconds with 9196 bytes received

[R] Post Hoc tests for ANOVA

2012-10-19 Thread Amartya
Hi, I was trying to figure out how to do post-hoc tests for Two Way ANOVAs and found the following 2 approaches: a. Do pairwise t-tests (bonferroni corrected) if one finds significance with the ANOVA. Link- http://rtutorialseries.blogspot.com/2011/01/r-tutorial-series-two-way-anova-with.html

[R] quantile regression using copulas

2012-10-19 Thread indu jaya
Hi all, Has anyone used the qua.regressCOP2 function from the copBasic package??? The default copula function used in this function is plackett copula and I wanted to use archimedean copula. Attached below is my code: mycop-frankCopula V=seq(0.001,0.99,by=0.000217)

[R] Question about survdiff in for-loop.

2012-10-19 Thread Sando
Hi everyone!! I have dataset composed of a numbers of survival analyses. ( for batch survival analyses by using for-loop) . Here are code !! ### dim(svsv) Num_t-dim(svsv) Num-Num_t[2] # These are predictors !! names=colnames(svsv) for (i in 1:Num ) { name_tt=names[i]

Re: [R] summation coding

2012-10-19 Thread djbanana
Hi, I think I solved it myself by writing loops. What I meant is: are there in-built functions in R that calculate the following: a1(b2+...+b190) + a2(b1+b3+...+b190) + ... I managed to solve it, quite similar to what you just emailed. Thanks anyway! -- View this message in context:

[R] impute multilevel data in MICE

2012-10-19 Thread ya
Dear list, Is there any one use MICE package deal with multilevel missing values here? I have a question about the 2lonly.pmm() and 2lonly.norm(), I get the following error quite often. Here is the code the error, could you give me some advice please? Am I using it in the right way?

Re: [R] R2HTML giving NULL in output

2012-10-19 Thread ul_nabble
Had the same prob and did not work out the reason why. However, a workaround is to add: .character { display:none; } to the file R2HTML.css or your css file respectively. Cheers UL -- View this message in context:

[R] to.yearly()

2012-10-19 Thread sheenmaria
v=IBM library(quantmod) v v1=getSymbols(v) to.yearly(v1) === when i pass the value through a variable in to.yearly() function it shows the error msg like Error in try.xts(x) : Error in UseMethod(as.xts) : no applicable method for 'as.xts' applied to an object of

Re: [R] Upper limit in nlsLM not working as expected

2012-10-19 Thread Martin Hehn
Thanks for the reply Berend, I am aware that I do not have to define the limits to Inf or -Inf, I just did this to make sure all other variables (besides 'w') in 'upper' have no limits. I can tolerate no upper limit as my peak is fitted well, but my actual data is a time series where the peak

Re: [R] to.yearly()

2012-10-19 Thread R. Michael Weylandt
Take a look at ?getSymbols which does not returne te time series by default. You want either to.yearly(IBM) or v1 = getSymbols(v, auto.assign = FALSE) to.yearly(v1) Michael On Friday, October 19, 2012, sheenmaria wrote: v=IBM library(quantmod) v v1=getSymbols(v) to.yearly(v1)

Re: [R] Mapping

2012-10-19 Thread Duncan Murdoch
On 12-10-18 6:11 PM, dorothy borowy wrote: I am a new user of R and am crunching through the system. I have reached an impasse with mapping; I want to make a bubble map and lay it over a grid that is composed of a standard x,y axis. Within this, are 16 (4x4) gridded blocks, numbered 1-16.

Re: [R] looping survdiff?

2012-10-19 Thread Andrews, Chris
sapply(seq(4,ncol(dat)), function(i) survdiff(Surv(time,completion==2)~dat[,i], data=dat, subset=group==3)$chisq) [1] 0.0944 4.4854 3.4990 Chris -Original Message- From: Charles Determan Jr [mailto:deter...@umn.edu] Sent: Thursday, October 18, 2012 3:04 PM To: r-help@r-project.org

Re: [R] help finding edge connecting two nodes

2012-10-19 Thread Rui Barradas
Hello, You should give a reproducible example showing us what you have tried, with an example dataset. Try the following. # A graph I've just drawn v - c(1,2,1,3,1,4,2,5,2,4,3,5,3,6,5,7,5,8,5,10,6,8,6,10,7,8,7,9,8,9) g - graph(v, directed = FALSE) plot(g, layout=layout.fruchterman.reingold)

[R] Which packages are incompatible with 64-bit R?

2012-10-19 Thread Alexander Shenkin
Hi folks, Despite the pain of migrating to 64-bit R (I have to install 64-bit Office also due to RODBC), I'm considering making the leap due to memory issues. Is there any place that lists packages that are 64-bit incompatible? Or, will I just have to march through all my packages and check

Re: [R] Which packages are incompatible with 64-bit R?

2012-10-19 Thread Duncan Murdoch
On 19/10/2012 8:10 AM, Alexander Shenkin wrote: Hi folks, Despite the pain of migrating to 64-bit R (I have to install 64-bit Office also due to RODBC), I'm considering making the leap due to memory issues. Is there any place that lists packages that are 64-bit incompatible? Or, will I just

Re: [R] Assessing overdispersion and using quasi model with lmer, possible?

2012-10-19 Thread Ben Bolker
swertie v_coudrain at voila.fr writes: I am trying to model data on species abundance (count data) with a poisson error distribution. I have a fixed and a random variables and thus needs a mixed model. I strongly doubt that my model is overdispersed but I don't know how to get the

Re: [R] speeding read.table

2012-10-19 Thread Gabor Grothendieck
On Thu, Oct 18, 2012 at 10:14 AM, Fisher Dennis fis...@plessthan.com wrote: Jason Are you suggesting grep in R or grep in the system? If the latter, this won't work because I need to implement this same procedure in Windows (sorry about not mentioning this), in which grep does not exist.

Re: [R] Upper limit in nlsLM not working as expected

2012-10-19 Thread nashjc
I think this might be what you want. Kate Mullen and I have been in correspondence over some edge cases where minpack.LM may not handle bounds appropriately. However, though nlmrt seems to do the job here, readers should note that R benefits hugely if we maintain some friendly competition (and

Re: [R] Which packages are incompatible with 64-bit R?

2012-10-19 Thread Alexander Shenkin
Thanks Duncan. Here's what I come up with. Anything obviously missing? I'd think there'd be more incompatibilities than just these few... In 32-bit: pkgs32 = available.packages(type=win.binary) In 64-bit: pkgs64 = available.packages(type=win.binary) pkgnames32 = pkgs32[,Package]

[R] Converting character values to time values when no date information is present XXXX

2012-10-19 Thread Dan Abner
Hi everyone, I am familiar with using the chron package to work with date/time values, but what about just time values with no date info present? What is the best tool to convert character values to time values when no date info is present? Thanks! Dan

Re: [R] Converting character values to time values when no date information is present XXXX

2012-10-19 Thread Gabor Grothendieck
On Fri, Oct 19, 2012 at 8:55 AM, Dan Abner dan.abne...@gmail.com wrote: Hi everyone, I am familiar with using the chron package to work with date/time values, but what about just time values with no date info present? What is the best tool to convert character values to time values when no

Re: [R] Looping survdiff

2012-10-19 Thread Terry Therneau
The number of recent questions from umn.edu makes me wonder if there's homework involved Simpler for your example is to use get and subset. dat - structure(.as found below var.to.test - names(dat)[4:6] #variables of interest nvar - length(var.to.test) chisq - double(nvar) for (i

Re: [R] Looping survdiff

2012-10-19 Thread Charles Determan Jr
Thank you for all your responses, I assure you this is not homework. I am a graduate student and my classes are complete. I am trying multiple different ways to analyze data and my lab requests different types of scripts to accomplish various tasks. I am the most computer savy in the lab so it

[R] Matrix to data.frame with factors

2012-10-19 Thread brunosm
Hi all, I have a matrix with 100 variables: each variable as a value of 0 or 1. What i want to do is convert this matrix to a data.frame but convert all the variables to factors (0 and 1) also. I know i can do this one variable a time but i have 100 variables... Any easy way of doing this??

Re: [R] bigmemory for dataframes?

2012-10-19 Thread Jan
Hi Allie, When you are working with the ff package, the counterpart of a data.frame is called an ffdf (ff data frame). It can handle the types you are talking about - factor, integer but characters will be stored as factors. So this means that your data types do not have to be of 1 specific type.

Re: [R] Re-projecting geotiff

2012-10-19 Thread Filoche
Thanks for the head-up Don. Regards, Phil -- View this message in context: http://r.789695.n4.nabble.com/Re-projecting-geotiff-tp4646616p4646736.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list

[R] replacing rows data.frame

2012-10-19 Thread evelyne
I create a data.frame using : alloc - data.frame(matrix(nrow=length(unique(mid2agi$gene)), ncol=8)) colnames(alloc) - c('agi', 'hit_len', 'q_len', 'identity', 'ratio', 'e', 'ok' ,'gene') alloc$gene - unique(mid2agi$gene) this results in: head(alloc) agi hit_len q_len identity ratio

[R] Egarch (1,1) with Student t distribution in R

2012-10-19 Thread Dheeraj Pandey
Hi I 'm new to R and wants to implement Egarch (1,1) with Student t distribution where I need to plot Std. dev series. Can you please help/provide me with the syntax/commands or any useful content? Dheeraj [[alternative HTML version deleted]]

Re: [R] Matrix to data.frame with factors

2012-10-19 Thread Rui Barradas
Hello, Try the following. x - matrix(sample(0:1, 12, TRUE), ncol = 4) y - data.frame(apply(x, 2, factor)) str(y) Hope this helps, Rui Barradas Em 19-10-2012 12:04, brunosm escreveu: Hi all, I have a matrix with 100 variables: each variable as a value of 0 or 1. What i want to do is convert

Re: [R] Which packages are incompatible with 64-bit R?

2012-10-19 Thread Duncan Murdoch
On 19/10/2012 8:51 AM, Alexander Shenkin wrote: Thanks Duncan. Here's what I come up with. Anything obviously missing? I'd think there'd be more incompatibilities than just these few... If you are on Windows, packages need to pass tests on both 32 and 64 bits to make it onto CRAN. So

Re: [R] Egarch (1,1) with Student t distribution in R

2012-10-19 Thread John Kerpel
Look at the package rugarch - it's the best. On Fri, Oct 19, 2012 at 7:52 AM, Dheeraj Pandey dheeraj.pan...@thesmartcube.com wrote: Hi I 'm new to R and wants to implement Egarch (1,1) with Student t distribution where I need to plot Std. dev series. Can you please help/provide me with the

Re: [R] Matrix to data.frame with factors

2012-10-19 Thread Bert Gunter
Well, strictly speaking, this is still doing it one variable at a time. The interpreted loop is hidden, but it's still happening. A loop free but clumsier approach is: y - data.frame(matrix(as.character(x),nrow = nrow(x))) ## Note also that the original column names will be lost and will have

Re: [R] Matrix to data.frame with factors

2012-10-19 Thread peter dalgaard
On Oct 19, 2012, at 16:07 , Rui Barradas wrote: Hello, Try the following. x - matrix(sample(0:1, 12, TRUE), ncol = 4) y - data.frame(apply(x, 2, factor)) str(y) Hope this helps, Another way, possibly more easily generalized: x - matrix(sample(0:1, 12, TRUE), ncol = 4) y -

Re: [R] Matrix to data.frame with factors

2012-10-19 Thread brunosm
Thanks a lot! -- View this message in context: http://r.789695.n4.nabble.com/Matrix-to-data-frame-with-factors-tp4646730p4646756.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list

Re: [R] For loop with i and j and multiple if statements... help!

2012-10-19 Thread ingaschwabe
Again, thank you all for the replies (and for the free R lesson!) You helped me a lot and I very appreciate it. I will work my self trough the for and apply section of my R manual again.. Thanks, Bye, inga -- View this message in context:

Re: [R] Matrix to data.frame with factors

2012-10-19 Thread brunosm
Obrigado Rui, é isso mesmo ;) -- View this message in context: http://r.789695.n4.nabble.com/Matrix-to-data-frame-with-factors-tp4646730p4646757.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list

[R] Axis Breaks with ggplot2

2012-10-19 Thread Edward Patzelt
R-help - I'm trying to create axis breaks similar to this : http://www.r-bloggers.com/wp-content/uploads/2010/08/bar-chart-natural-axis-split1.png . Is there a way to do this in R? Here's my code thus far: structure(list(condition = structure(c(2L, 1L, 3L), .Label = c(con, exp, unedit), class

Re: [R] Post Hoc tests for ANOVA

2012-10-19 Thread Richard M. Heiberger
Please look at the ?mmc example for two-way ANOVA in library(HH). If you don't already have HH you can get it with install.packages(HH) library(HH) ?mmc mmc uses the glht function in the multcomp package for its calculations and then draws the MMC graph. Rich On 10/19/12, Amartya

Re: [R] Post Hoc tests for ANOVA

2012-10-19 Thread rent0009
Amartya: This is probably more of a statistics question than an R question. I would go with the Tukey HSD, were I you as that is its intention. Is there anyone in your organization (school, company, etc) that does statistical consulting? I have had wonderful experience working with the

[R] factor score from PCA

2012-10-19 Thread ya
Hi everyone, I am trying to get the factor score for each individual case from a principal component analysis, as I understand, both princomp() and prcomp() can not produce this factor score, the principal() in psych package has this option: scores=T, but after running the code, I could

Re: [R] Matrix to data.frame with factors

2012-10-19 Thread arun
Hi, No problem. You can also try this: set.seed(1) mat1-matrix(sample(0:1,50,replace=TRUE),nrow=10,ncol=5)  dat1-as.data.frame(mat1)  dat2-do.call(data.frame,rapply(dat1,as.factor,classes=integer,how=replace)) # str(dat2) #'data.frame':    10 obs. of  5 variables: # $ X1: Factor w/ 2 levels 0,1:

Re: [R] likelihood function involving integration, error in nlm

2012-10-19 Thread stats12
Thanks for pointing that out. Made some modifications and it worked. -- View this message in context: http://r.789695.n4.nabble.com/likelihood-function-involving-integration-error-in-nlm-tp4646697p4646764.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] summation coding

2012-10-19 Thread cberry
djbanana karl79264...@gmail.com writes: Hi, I think I solved it myself by writing loops. What I meant is: are there in-built functions in R that calculate the following: a1(b2+...+b190) + a2(b1+b3+...+b190) + ... Following Rainer's setup: x - data.frame( a = sample( 1:10, 4 ), b =

[R] Centering labels on X-axis

2012-10-19 Thread YAddo
Dear all: I am trying to center labels on my plot with not much success. I have tried text(), mtext() but it's not working. I think I am using the wrong function for my task. Any help will be appreciated. My working codes. axis(1,

Re: [R] Kaplan-Meier plotting quirks

2012-10-19 Thread Michael Rentz
Terry: Thank you, that makes quite a bit of sense. In transposing the data to intervals (corresponding to trapping runs) it becomes quite clear that tag loss is very high up front, and has very good survival after the initial period. This is what I needed to know. I think I had a case of too

Re: [R] Upper limit in nlsLM not working as expected

2012-10-19 Thread Martin Hehn
Dear John, this appears to be one of the cases where your algorithm is favourable over the nlsLM one. The fitting is now a lot better with ssquared being lower compared to any other fit method I was comparing to. As I am relatively new to R, it still puzzles me that there are so many

Re: [R] factor score from PCA

2012-10-19 Thread Sarah Goslee
From ?princomp Arguments: scores: a logical value indicating whether the score on each principal component should be calculated. Value: scores: if ‘scores = TRUE’, the scores of the supplied data on the principal components. These are non-null only if ‘x’ was

Re: [R] replacing rows data.frame

2012-10-19 Thread Rui Barradas
Hello, Your problem comes from the fact that as new values are inserted in 'alloc' the column alloc$agi keeps changing (obvious!) therefore R can't know all the factor levels beforehand. Therefore the values inserted are the numeric codes of the original factor. Since your example doesn't

[R] how can i plot dotted regression line shaped with condition using ggplot

2012-10-19 Thread autumnlin
I am plotting ggplot smooth line. I would like to add dots to the regression line, the dots are shaped under different condition. p - ggplot(data, aes(x = x, y = y, shape = assign, linetype = factor(sex))) p0b - p+ scale_linetype_manual(breaks=c(0,1),

Re: [R] Centering labels on X-axis

2012-10-19 Thread Rui Barradas
Hello, Your working code needs a plot first: plot(1:5, xaxt = n) And there's no 'text' argument to axis(). As for the centering of axis labels, they're centered on my graphics device. Exactly what is happening to yours? sessionInfo() R version 2.15.1 (2012-06-22) Platform:

Re: [R] how can i plot dotted regression line shaped with condition using ggplot

2012-10-19 Thread Ista Zahn
I may be missing something, but if you want dots you need to ask for them with geom_point() Best, Ista On Fri, Oct 19, 2012 at 11:46 AM, autumnlin jialin...@gmail.com wrote: I am plotting ggplot smooth line. I would like to add dots to the regression line, the dots are shaped under different

[R] Creating a new by variable in a dataframe

2012-10-19 Thread ramoss
Hello, I have a dataframe w/ 3 variables of interest: transaction,date(tdate) time(event_tim). How could I create a 4th variable (last_trans) that would flag the last transaction of the day for each day? In SAS I use: proc sort data=all6; by tdate event_tim; run; /*Create last

Re: [R] Which package/function for solving weighted linear least squares with inequality and equality constraints?

2012-10-19 Thread Berend Hasselman
On 19-10-2012, at 20:00, Thomas Schu wrote: Dear All, Which package/function could i use to solve following linear least square problem? A over determined system of linear equations is given. The nnls-function may would be a possibility BUT: The solving is constrained with a

[R] Lattice bwplot: Adding mean with panel.points fails in vertical arrangement

2012-10-19 Thread Henning Wildhagen
Dear collegues, given a structure of data like this: ## Data ### set.seed(100) a - rnorm(60,10,3) s - c(rep(A,20),rep(B,20),rep(C,20)) p - c(rep(d,6),rep(e,6),rep(f,6),rep(g,6),rep(h,6)) df - data.frame(a,s,p) i would like to draw a lattice bwplot in vertical

Re: [R] Creating a new by variable in a dataframe

2012-10-19 Thread William Dunlap
Suppose your data frame is d - data.frame( stringsAsFactors = FALSE, transaction = c(T01, T02, T03, T04, T05, T06, T07, T08, T09, T10), date = c(2012-10-19, 2012-10-19, 2012-10-19, 2012-10-19, 2012-10-22, 2012-10-23, 2012-10-23, 2012-10-23, 2012-10-23,

[R] ggplot specify line type

2012-10-19 Thread autumnlin
http://r.789695.n4.nabble.com/file/n4646789/1.bmp hi is it possible to draw a graph like the attached one using ggplot? how should i code it in r? thanks. -- View this message in context: http://r.789695.n4.nabble.com/ggplot-specify-line-type-tp4646789.html Sent from the R help mailing list

[R] RColorBrewer

2012-10-19 Thread StatsandtheirPres
Hi there everyone! So I'm a student in college, taking a very basic Statistics course. We're using R for most of our assignments. I've hit a pretty big wall here. I'm attempting to create a heat map of the entire united states which corresponds to a set of percentages I have for each state. My

[R] Thanks for the GREAT help :) Re: how can I adjust the ranges of my y-axis in barplot?

2012-10-19 Thread Yakamu Yakamu
Hi Uwe, thank you very much for this great help, jsut perfect what I needed to know :) cheers, Yakamu --- On Wed, 10/3/12, Uwe Ligges lig...@statistik.tu-dortmund.de wrote: From: Uwe Ligges lig...@statistik.tu-dortmund.de Subject: Re: [R] how can I adjust the ranges of my y-axis in barplot? To:

[R] how can I make a legend that applies for all the barplots in one same page?

2012-10-19 Thread Yakamu Yakamu
Dear all, I would like to make 6 barplots in one page but with a legend that applies to all the barplots and would like to put it in the central-bottom of the page.   I know only how to make legend for individual barplot, but since all my barplots have the same type and would be better if i just

[R] multiple graphs, lapply and different titles

2012-10-19 Thread Flavio Barros
I have a list of data.frames, and i want to iterate over this list and generate graphs with the same title of the data.frame. I did the graphs with: lapply(anual, function(x) plot(x[,'chuva'], type='l', xlab= 'anos', ylab = 'Precicipatação(mm)', col='red')) where anual is list of data.frames. I

Re: [R] how can I make a legend that applies for all the barplots in one same page?

2012-10-19 Thread Greg Snow
First of all, in the command par(xpd=F), what is the value of F? If it is the default value of FALSE then that says to not plot anything outside of the plot region, so any attempts to put a legend in the outer margin will not plot anything. if F is TRUE (which is a recipe for disaster) then you

Re: [R] Creating a new by variable in a dataframe

2012-10-19 Thread ramoss
Thanks for all the help guys. This worked for me: all6 - arrange(all6, tdate,event_tim) lt - ddply(all6,.(tdate),tail,1) lt$last_trans -'Y' all6 -merge(all6,lt, by.x=c(tdate,event_tim), by.y=c(tdate,event_tim),all.x=TRUE) -- View this message in context:

Re: [R] Creating a new by variable in a dataframe

2012-10-19 Thread Flavio Barros
I think i have a better solution *## Example data.frame* d - data.frame(stringsAsFactors = FALSE, transaction = c(T01, T02, T03, T04, T05, T06, T07, T08, T09, T10),date = c(2012-10-19, 2012-10-19, 2012-10-19, 2012-10-19, 2012-10-22, 2012-10-23, 2012-10-23, 2012-10-23, 2012-10-23, 2012-10-23),time

Re: [R] Creating a new by variable in a dataframe

2012-10-19 Thread arun
Hi, May be this helps you: dat1-read.table(text= tdate  event_tim  transaction 1/10/2012   2   14 1/10/2012   4   28 1/10/2012   6   42 1/10/2012   8   14 2/10/2012   6   46 2/10/2012   9   64 2/10/2012   8   71 3/10/2012  3   85 3/10/2012   1   14 3/10/2012   4   28 9/10/2012   5   51

Re: [R] Creating a new by variable in a dataframe

2012-10-19 Thread arun
Hi, In addition to merge(), you can also use join() dat1-read.table(text= tdate  event_tim  transaction 1/10/2012   2   14 1/10/2012   4   28 1/10/2012   6   42 1/10/2012   8   14 2/10/2012   6   46 2/10/2012   9   64 2/10/2012   8   71 3/10/2012  3   85 3/10/2012   1   14 3/10/2012   4   28

Re: [R] how can i plot dotted regression line shaped with condition using ggplot

2012-10-19 Thread autumnlin
I would like to add specific point on to the regression line, like (x=1),shape=value(1) is it possible? -- View this message in context: http://r.789695.n4.nabble.com/how-can-i-plot-dotted-regression-line-shaped-with-condition-using-ggplot-tp4646773p4646797.html Sent from the R help mailing

[R] saving to docx

2012-10-19 Thread javad bayat
hi all, how can i saving R output to docx or Jpeg format? [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

Re: [R] how can i plot dotted regression line shaped with condition using ggplot

2012-10-19 Thread Ista Zahn
See ?annotate for help on adding individual points/labels/etc to a plot. Best, Ista On Fri, Oct 19, 2012 at 3:48 PM, autumnlin jialin...@gmail.com wrote: I would like to add specific point on to the regression line, like (x=1),shape=value(1) is it possible? -- View this message in

Re: [R] multiple graphs, lapply and different titles

2012-10-19 Thread David Winsemius
On Oct 19, 2012, at 12:30 PM, Flavio Barros wrote: I have a list of data.frames, and i want to iterate over this list and generate graphs with the same title of the data.frame. I did the graphs with: lapply(anual, function(x) plot(x[,'chuva'], type='l', xlab= 'anos', ylab =

Re: [R] ggplot specify line type

2012-10-19 Thread Brian Diggs
On 10/19/2012 11:42 AM, autumnlin wrote: http://r.789695.n4.nabble.com/file/n4646789/1.bmp hi is it possible to draw a graph like the attached one using ggplot? Yes how should i code it in r? Use a geom_point() where the shape aesthetic is mapped to the grouping variable and also add a

Re: [R] saving to docx

2012-10-19 Thread David Winsemius
On Oct 19, 2012, at 12:54 PM, javad bayat wrote: hi all, how can i saving R output to docx or Jpeg format? There are some packages with functions to write to Word formats, but the one I know of only runs on Windows, so I have not bothered remembering its name. The sos package offers nice

Re: [R] saving to docx

2012-10-19 Thread Daróczi Gergely
Hi Javad, saving R output to jpeg depends on what you want to save. For example saving an `lm` object to an image would be fun :) But you could export that quite easily to e.g. docx after installing Pandoc[1] and pander[2] package. You can find some examples in the README[3]. Best, Gergely [1]

Re: [R] how R implement qnorm()

2012-10-19 Thread Sheng Liu
Thanks, again! Sorry for my misleading expression, I only knew the value is inquired from a polynomial approximation, but I have no idea how it is done in such a great detail. It's a great lesson for people like me who want a deep understanding of the basics. Sheng On Thu, Oct 18, 2012 at 11:46

Re: [R] Question about survdiff in for-loop.

2012-10-19 Thread Thomas Lumley
On Fri, Oct 19, 2012 at 8:02 PM, Sando chocosa...@daum.net wrote: Hi everyone!! I have dataset composed of a numbers of survival analyses. ( for batch survival analyses by using for-loop) . Here are code !! ### dim(svsv) Num_t-dim(svsv) Num-Num_t[2] # These are predictors !!

Re: [R] saving to docx

2012-10-19 Thread David Winsemius
On Oct 19, 2012, at 2:48 PM, Daróczi Gergely wrote: Hi Javad, saving R output to jpeg depends on what you want to save. For example saving an `lm` object to an image would be fun :) But you could export that quite easily to e.g. docx after installing Pandoc[1] and pander[2] package. You

[R] Newly installed version; can't run lm function

2012-10-19 Thread Michael Grant
New installation seems to have behavior I cannot figure out. Here is illustrative sequence where I load a small data set (test) from Crawley's files and try to run a simple linear model and get an error message. Oddly, R reports that the variable 'test$ozone' is numeric while, after attaching

Re: [R] Newly installed version; can't run lm function

2012-10-19 Thread Jorge I Velez
Hi Michael, Try fit - lm(ozone~garden, data = test) summary(fit) See ?lm for more details. HTH, Jorge.- On Sat, Oct 20, 2012 at 8:26 AM, Michael Grant wrote: New installation seems to have behavior I cannot figure out. Here is illustrative sequence where I load a small data set (test)

Re: [R] Newly installed version; can't run lm function

2012-10-19 Thread David Winsemius
On Oct 19, 2012, at 2:26 PM, Michael Grant wrote: New installation seems to have behavior I cannot figure out. Here is illustrative sequence where I load a small data set (test) from Crawley's files and try to run a simple linear model and get an error message. Oddly, R reports that the

Re: [R] Newly installed version; can't run lm function

2012-10-19 Thread Rolf Turner
You have an object named ozone kicking around in your workspace/global environment. This is apparently not of mode numeric and it is masking the ozone object (column) from the attached data frame test. Simply doing ls() would have told you this. Presumably you also got a warning about this

Re: [R] help finding edge connecting two nodes

2012-10-19 Thread Gábor Csárdi
On Fri, Oct 19, 2012 at 2:50 PM, Dhaval Adjodah nuclear...@gmail.com wrote: [...] Your way works best! Another way I found from stackoverflow (see the post at http://stackoverflow.com/questions/12964332/igraph-edge-between-two-vertices/12980550#12980550) was to convert the graph into an

Re: [R] plot.new() and grid functions in multipage pdfs

2012-10-19 Thread Ali Tofigh
On Wed, Oct 17, 2012 at 4:08 PM, ilai ke...@math.montana.edu wrote: On Wed, Oct 17, 2012 at 11:10 AM, Ali Tofigh alix.tof...@gmail.com wrote: my problem is that I usually have no choice but to mix grid and base graphics. What does that have to do with the answer you got ? did you even try it