[R] rbind.data.frame drops attributes for factor variables

2011-11-10 Thread Sammy Zee
Hi all, When I use rbind() or rbind.data.frame() to add a row to an existing dataframe, it appears that attributes for the column of type "factor" are dropped. I see the following post with same problem. However i did not see any reply to the following posting offering a solution. Could someone pl

Re: [R] Web based R-help not a list

2011-11-10 Thread P.B. Lecavalier
On 11/10/2011 02:32 PM, Cem Girit wrote: Hello David, I am terribly sorry. I could never imagine that my naive questions could offend an experienced R-user such as you so much that he would publicly declare that he is no longer going to help me in the future! Wow; I did not

[R] Errors in SIAR

2011-11-10 Thread Alex DJ
Help! model1 <- siarmcmcdirichletv4(data, source, tef, concdep=0, 50, 5) Error in matrix(1, ncol = (numsources + numiso) * numgroups, nrow = (siardata$iterations - : invalid 'ncol' value (too large or NA) In addition: Warning message: In Ops.ordered((numsources + numiso), numgroup

[R] beanplot without log scale?

2011-11-10 Thread Twila Moon
Is it possible to force beanplot not to use a log scale? I want to be able to create multiple beanplots of different data on the same specified y-axis. When I try to force a ylim, I get the following... > beanplot(reg5vel,ylim=(c(0,12000))) log="y" selected Warning message: In plot.window(xlim =

Re: [R] Generating the Ctrl-M character

2011-11-10 Thread Jeff Newmiller
No need to get defensive... I couldn't tell whether you remembered the details. This is starting to go OT, though. As to handing "\n" as expected, in the context of generating text files for their native platforms they do act "as expected". However, in the context of people writing binary char

[R] Odp: Error in matrix, not ordered vectors or numerical value, and SIAR.

2011-11-10 Thread Petr PIKAL
Hi > Help! > > model1 <- siarmcmcdirichletv4(data, source, tef, concdep=0, 50, 5) > > Error in matrix(1, ncol = (numsources + numiso) * numgroups, nrow = > (siardata$iterations - : > invalid 'ncol' value (too large or NA) > In addition: Warning message: > In Ops.ordered((numsources

Re: [R] Listing tables together from random samples from a generated population?

2011-11-10 Thread Dennis Murphy
Hi: There are two ways you could go about this: lists or arrays. It's pretty easy to generate an array, a little more work to get the list. I'm assuming the objective is to extract a chi-square statistic from each table, so I'll show a couple of ways to do that, too. library('plyr') ## Start wit

Re: [R] plotting a function with given formula in ggplot2

2011-11-10 Thread Dennis Murphy
Hi: Borrowing from this thread, courtesy of Brian Diggs: http://groups.google.com/group/ggplot2/browse_thread/thread/478f9e61d41b4678/ed323c497db61156?lnk=gst&q=stat_function#ed323c497db61156 ...here's a small reproducible example: ddf <- data.frame(x = 1:10, y = 0.4 + 0.6 * (1:10) + rnorm(10))

Re: [R] Generating the Ctrl-M character

2011-11-10 Thread David Winsemius
On Nov 10, 2011, at 11:55 PM, Jeff Newmiller wrote: Wow, Deadpan David. How about using the escape sequence "\r"? So shoot me. It wasn't documented in a manner that I recognized in the places I looked. ?character ?Syntax ?Constants And I did look at ?Quotes where "\r" is listed but did

Re: [R] Web based R-help not a list

2011-11-10 Thread David Winsemius
On Nov 10, 2011, at 7:38 PM, Barry Rowlingson wrote: On Thu, Nov 10, 2011 at 7:32 PM, Cem Girit wrote: Somebody suggested "Stackoverflow" problems as well. These could all be avoided. I think you misunderstood the mention of 'Stackoverflow'. This is a solution, not a problem! StackOverf

Re: [R] barplot names.arg

2011-11-10 Thread Diviya Smith
The documentation for bar plots includes - names.arga vector of names to be plotted below each bar or *group of bars*. If this argument is omitted, then the names are taken from the names attribute of height if this is a vector, or the column names if it is a matrix Thanks for your suggestion. Ho

Re: [R] Generating the Ctrl-M character

2011-11-10 Thread Jeff Newmiller
Wow, Deadpan David. How about using the escape sequence "\r"? Keep in mind that Ctrl-M is used as the end-of-line character on some operating systems, so accomplishing this may not be portable, and you didn't specify your operating system. On the three main platforms (*nix, Windows/DOS, and Mac

Re: [R] barplot names.arg

2011-11-10 Thread R. Michael Weylandt
I'm not sure you can do that data aggregation in barplot directly (a quick skim doesn't reveal anything in the documentation that suggests it to me, thought I might have missed it) though I think this does what you are talking about: barplot(sapply(unique(rownames(mdat)), function(n) colSums(mdat[

Re: [R] Generating the Ctrl-M character

2011-11-10 Thread David Winsemius
On Nov 10, 2011, at 9:35 PM, Ashim Kapoor wrote: Dear R-helpers, I want to append a Ctrl-M character to a string and then save it to a text file. mystring<-"This is a test." # How do I add a Ctrl-M to it in the end ?? cat(mystring,file="testfile") > cntrl_m <- intToUtf8(13) > cat(cnt

Re: [R] How to compute time interval?

2011-11-10 Thread Jeff Newmiller
You forgot to provide code to work with. There are multiple ways to deal with time in R, but we don't know how you are doing it. --- Jeff NewmillerThe . . Go Live... DCN:Basic

Re: [R] How to compute time interval?

2011-11-10 Thread Lao Meng
as.numeric() is work Settled! 2011/11/11 Lao Meng > t2-t1 is ok,but only can get"Time difference of 786 days",but I wanna get > the "786" only.How can I do then? > > Thanks! > > > 2011/11/11 Lao Meng > >> time1 = 2008-03-09 >> time2 = 2010-9-10 >> >> How to compute how many years between time1

Re: [R] How to compute time interval?

2011-11-10 Thread Lao Meng
t2-t1 is ok,but only can get"Time difference of 786 days",but I wanna get the "786" only.How can I do then? Thanks! 2011/11/11 Lao Meng > time1 = 2008-03-09 > time2 = 2010-9-10 > > How to compute how many years between time1 and time2? > > Thanks! > > best > > [[alternative HTML versio

[R] Generating the Ctrl-M character

2011-11-10 Thread Ashim Kapoor
Dear R-helpers, I want to append a Ctrl-M character to a string and then save it to a text file. mystring<-"This is a test." # How do I add a Ctrl-M to it in the end ?? cat(mystring,file="testfile") Many thanks, Ashim [[alternative HTML version deleted]] _

[R] How to compute time interval?

2011-11-10 Thread Lao Meng
time1 = 2008-03-09 time2 = 2010-9-10 How to compute how many years between time1 and time2? Thanks! best [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the

Re: [R] Why does length("") == 1?

2011-11-10 Thread David Winsemius
On Nov 10, 2011, at 7:36 PM, Worik R wrote: Thanks. Thinking like a C programmer again You are thinking of something else: > length(NULL) [1] 0 W On Fri, Nov 11, 2011 at 1:27 PM, Peter Langfelder < peter.langfel...@gmail.com> wrote: On Thu, Nov 10, 2011 at 4:17 PM, Worik R wrote:

[R] barplot names.arg

2011-11-10 Thread Diviya Smith
Hello there, I have a question regarding bar plots. I am trying to plot the data from the following matrix as a barplot - # input data mdat <- matrix(c(0.1,0.9,0.9,0.1,0.5,0.5,0.45,1-0.45,0.6,0.4,0.8,0.2), nrow = 6, ncol=2, byrow=TRUE, +dimnames = list(c("Mon", "Mon", "Tues", "Tue

Re: [R] (no subject)

2011-11-10 Thread jim holtman
Is this possibly FAQ 7.31? Print your matrix with options(digit=20) to see better what the values are. You might also look at 'all.equal'. On Thu, Nov 10, 2011 at 7:05 PM, Rui Esteves wrote: > Hello. > > I have this matrix: > > cy            [,1]       [,2]       [,3]       [,4]       [,5]    

[R] online recursive lssvm r package

2011-11-10 Thread Waverley @ Palo Alto
Hi, I am looking for a R package which can do online recursive training, e.g. online recursive LSSVM algorithm. Can some one help? Thanks. Waverley. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.

[R] Building a statically-linked extension?

2011-11-10 Thread Tyler Pirtle
Hi there, I'm writing an R extension that has a C component that relies on two third party libraries that I'm bundling with the extension. I'd like to statically link my resulting extension so that I can rely on the bundled versions of the libraries I'm distributing, so there's two questions - 1

Re: [R] Web based R-help not a list

2011-11-10 Thread Barry Rowlingson
On Thu, Nov 10, 2011 at 7:32 PM, Cem Girit wrote: > Somebody suggested "Stackoverflow" problems as > well. These could all be avoided. I think you misunderstood the mention of 'Stackoverflow'. This is a solution, not a problem! StackOverflow (www.stackoverflow.com) is a question-and-answer we

Re: [R] Why does length("") == 1?

2011-11-10 Thread Worik R
Thanks. Thinking like a C programmer again W On Fri, Nov 11, 2011 at 1:27 PM, Peter Langfelder < peter.langfel...@gmail.com> wrote: > On Thu, Nov 10, 2011 at 4:17 PM, Worik R wrote: > > It seems obvious to me that the empty string "" is length 0. > > You are using the wrong function to fin

Re: [R] Why does length("") == 1?

2011-11-10 Thread Peter Langfelder
On Thu, Nov 10, 2011 at 4:17 PM, Worik R wrote: > It seems obvious to me that the empty string "" is length 0. You are using the wrong function to find the length of a character string. length() returns the length of the object, and length of (non-NULL) scalars is always 1. If you want the numbe

Re: [R] Why does length("") == 1?

2011-11-10 Thread Steve Taylor
"" is a character vector with one element in it. ?nchar ?length >>> From: Worik R To:r-help Date: 11/Nov/2011 1:21p Subject: [R] Why does length("") == 1? It seems obvious to me that the empty string "" is length 0. cheers Worik [[alternative HTML version deleted]] __

Re: [R] Stack trace?

2011-11-10 Thread William Dunlap
You asked > Will traceback() work in the error routine specified in tryCatch? No, for two reasons. First, R's traceback(), unlike S+'s in certain circumstances, does not create the stack trace. It just prints it, based on the value of some structure that the standard error processor creates. You

[R] Why does length("") == 1?

2011-11-10 Thread Worik R
It seems obvious to me that the empty string "" is length 0. cheers Worik [[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 http://www.R-proje

[R] (no subject)

2011-11-10 Thread Rui Esteves
Hello. I have this matrix: cy[,1] [,2] [,3] [,4] [,5] [,6] [1,] 1.000 1.000 -0.5164570 -0.5164087 -0.4004139 -0.4003719 [2,] 1.000 1.000 -0.5164570 -0.5164087 -0.4004139 -0.4003719 [3,] -0.5164570 -0.5164570 1.000 1.000 -0

[R] ticks at the Y axis

2011-11-10 Thread Luís F
Dear Mailing list, I am trying to produce a simple xy plot but overlapping at the y-axis the y-values of each point. The problem is that I don't know the x-coordinate corresponding to the y-axis to plot the y-points. For each plot I have manually "calculated" the x-coordinate but was wondering wh

Re: [R] Named components in a list

2011-11-10 Thread William Dunlap
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf Of JulioSergio > Sent: Thursday, November 10, 2011 2:59 PM > To: r-h...@stat.math.ethz.ch > Subject: Re: [R] Named components in a list > > Jeff Newmiller dcn.davis.ca.us> writes:

Re: [R] optim seems to be finding a local minimum

2011-11-10 Thread Ben Bolker
Rolf Turner xtra.co.nz> writes: > > On 11/11/11 08:55, Dimitri Liakhovitski wrote: > > Bert, > > that's exactly where I started. I found optim in the first paragraph > > under "General Purpose Continuous Solvers" and used bounded BFGS for a > > constrained optimization for a situation with more

Re: [R] Named components in a list

2011-11-10 Thread JulioSergio
Jeff Newmiller dcn.davis.ca.us> writes: > > >Well, Bert, then the manual where I found the example must be wrong. It > >is: > > > >http://cran.r-project.org/doc/manuals/R-intro.html#Constructing-and- modifying- > >lists > > > >And textually it says: > > > >Lists, like any subscripted object, can

Re: [R] 2^k*r experimental design and anova

2011-11-10 Thread Kevin Wright
Maybe of interest (uses the FrF2 package) http://www.stat.umn.edu/~gary/classes/5303/handouts/fractional.pdf Kevin On Thu, Nov 10, 2011 at 7:41 AM, Giovanni Azua wrote: > Hello, > > Can anyone point me to an online tutorial or book containing the easiest > way to do ANOVA over the result data

Re: [R] Named components in a list

2011-11-10 Thread William Dunlap
That is a misleading example. It should say that the name 'matrix' is ignored or use Lst["matrix"] <- list(Mat). (And not all objects can be extended by subscripting. E.g., you cannot extend the number of rows of a matrix with mat[nrow(mat)+1, ] <- 1:ncol(mat). vectors may be extended by subscr

Re: [R] Named components in a list

2011-11-10 Thread Jeff Newmiller
Inline below ... --- Jeff NewmillerThe . . Go Live... DCN:Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Researc

Re: [R] Listing tables together from random samples from a generated population?

2011-11-10 Thread Jean V Adams
You could try something like this: tables <- lapply(seq(100), function(i) table(.y[sample(nrow(.y), 200), ])) Then you could conduct the chi-squared tests chisqs <- lapply(tables, chisq.test) and save the values .z <- sapply(chisqs, "[[", "statistic") Jean --- Simon Kis

Re: [R] plotting a function with given formula in ggplot2

2011-11-10 Thread Curiouslearn
Thanks Rainer. I did not know about dput(). Here is the data. mom_hs <- c(1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1,

Re: [R] Named components in a list

2011-11-10 Thread JulioSergio
Bert Gunter gene.com> writes: > > Inline Below. Well, Bert, then the manual where I found the example must be wrong. It is: http://cran.r-project.org/doc/manuals/R-intro.html#Constructing-and-modifying- lists And textually it says: Lists, like any subscripted object, can be extended by speci

[R] performance of adaptIntegrate vs. integrate

2011-11-10 Thread baptiste auguie
Dear list, [cross-posting from Stack Overflow where this question has remained unanswered for two weeks] I'd like to perform a numerical integration in one dimension, I = int_a^b f(x) dx where the integrand f: x in IR -> f(x) in IR^p is vector-valued. integrate() only allows scalar integrands,

Re: [R] optim seems to be finding a local minimum

2011-11-10 Thread Rolf Turner
On 11/11/11 08:55, Dimitri Liakhovitski wrote: Bert, that's exactly where I started. I found optim in the first paragraph under "General Purpose Continuous Solvers" and used bounded BFGS for a constrained optimization for a situation with more than 1 parameters. Again, not being an engineer / mat

Re: [R] grid.pack and grid.frame bewilder me

2011-11-10 Thread Paul Murrell
Hi On 11/11/2011 7:00 a.m., cheung zihong wrote: Hello R friends, I get quite confused in using the grid graphic function grid.pack( ) and grid.frame ( ). Here is a simple example: library(grid) grid.frame(name="frame1") grid.pack("frame1",rectGrob(width=unit(0.5,"npc"), height=unit(0.5,

[R] Listing tables together from random samples from a generated population?

2011-11-10 Thread Simon Kiss
. HI there, I'd like to show demonstrate how the chi-squared distribution works, so I've come up with a sample data frame of two categorical variables y<-data.frame(gender=sample(c('Male', 'Female'), size=10, replace=TRUE, c(0.5, 0.5)), tea=sample(c('Yes', 'No'), size=10, replace=TRUE, c(

Re: [R] Named components in a list

2011-11-10 Thread William Dunlap
R may surprise you here, but it is self-consistent. What would you expect from the following? > x <- c(one=1,two=2,3,four=4) > x one two four 1234 > x[c("two", "five")] <- c(twentytwo=22, fiftyfive=55) > x one two four five 1 2234 55 'x[

Re: [R] unable to load Hmisc in R 2.14.0

2011-11-10 Thread Brian Diggs
On 11/10/2011 11:32 AM, Jacob Wegelin wrote: On my MacBook Pro (OS 10.6.8), after updating to R version 2.14.0 (2011-10-31) and reinstalling the Hmisc package, I am unable to load the Hmisc library. Hmisc was working *before* I updated R. Any idea what's wrong? Likely the same problem as dis

Re: [R] Named components in a list

2011-11-10 Thread Bert Gunter
Inline Below. -- Bert On Thu, Nov 10, 2011 at 11:50 AM, JulioSergio wrote: > Sarah Goslee gmail.com> writes: > > > > > Hi, > > > > > You probably want: > > L["NewName"] <- "something" > > or one of the many potential variants. > > > > Thanks, Sara, > That works! > However, following the idea th

Re: [R] Web based R-help not a list

2011-11-10 Thread Cem Girit
Hello David, I am terribly sorry. I could never imagine that my naive questions could offend an experienced R-user such as you so much that he would publicly declare that he is no longer going to help me in the future! Wow; I did not know that using R-Help like this is a cult

[R] plotting a function with given formula in ggplot2

2011-11-10 Thread Curiouslearn
Hi All, I have a scatter plot produced using ggplot2 and I want to add the regression line to this scatter plot. I suppose I can use geom_smooth() to do this, but for the sake of learning ( I am new both to R and ggplot2), I want to try and add it as a function (something that curve() does in the

Re: [R] optim seems to be finding a local minimum

2011-11-10 Thread Dimitri Liakhovitski
Bert, that's exactly where I started. I found optim in the first paragraph under "General Purpose Continuous Solvers" and used bounded BFGS for a constrained optimization for a situation with more than 1 parameters. Again, not being an engineer / mathematician - would greatly appreciate any pointer

[R] Error in matrix, not ordered vectors or numerical value, and SIAR.

2011-11-10 Thread Alex DJ
Help! model1 <- siarmcmcdirichletv4(data, source, tef, concdep=0, 50, 5) Error in matrix(1, ncol = (numsources + numiso) * numgroups, nrow = (siardata$iterations - : invalid 'ncol' value (too large or NA) In addition: Warning message: In Ops.ordered((numsources + numiso), numgroups) :

Re: [R] Named components in a list

2011-11-10 Thread JulioSergio
Sarah Goslee gmail.com> writes: > > Hi, > > You probably want: > L["NewName"] <- "something" > or one of the many potential variants. > Thanks, Sara, That works! However, following the idea that the syntactic notation L[i] means a sublist of L, again the syntactic notation L[i] <- list(N

Re: [R] R to automate scatter plots

2011-11-10 Thread R. Michael Weylandt
I think you are off in the order of calls: you need to open the pdf and then do all the plots so that they get pushed to the pdf. The blank plot call won't do anything particularly helpful. If you use pdf() after most of the plot commands they go to your default device which is usually printing to

Re: [R] optim seems to be finding a local minimum

2011-11-10 Thread Bert Gunter
Refer to the CRAN "Optimization" task view, please. That is a much more appropriate place to begin than posting a query here. All numerical optimizers only produce local optima. -- Bert On Thu, Nov 10, 2011 at 11:24 AM, Dimitri Liakhovitski < dimitri.liakhovit...@gmail.com> wrote: > Just to add

[R] unable to load Hmisc in R 2.14.0

2011-11-10 Thread Jacob Wegelin
On my MacBook Pro (OS 10.6.8), after updating to R version 2.14.0 (2011-10-31) and reinstalling the Hmisc package, I am unable to load the Hmisc library. Hmisc was working *before* I updated R. Any idea what's wrong? Details below. install.packages("Hmisc", dependencies=TRUE) trying URL 'h

Re: [R] optim seems to be finding a local minimum

2011-11-10 Thread Dimitri Liakhovitski
Just to add: I also experimented with the starting parameters (par) under optim, especially with the second one. I tried 1, 10, 100, 1000, etc. When I tried 100,000,000 then I got a somewhat better solution (but still not as good as in Excel). However, under message it said: "ERROR: ABNORMAL_TERM

Re: [R] Named components in a list

2011-11-10 Thread Sarah Goslee
Hi, On Thu, Nov 10, 2011 at 1:55 PM, JulioSergio wrote: > I'm studying lists and I came to an example where > >> L > $name > [1] "Fred" > > $wife > [1] "Mary" > > $no.children > [1] 4 > > $child.ages > [1] 4 7 9 > > then following the instructions to extend the list with a new component, I > exec

[R] Named components in a list

2011-11-10 Thread JulioSergio
I'm studying lists and I came to an example where > L $name [1] "Fred" $wife [1] "Mary" $no.children [1] 4 $child.ages [1] 4 7 9 then following the instructions to extend the list with a new component, I executed: > L[5] <-list(NewName="something") and the new list I got was: > L $name [1

Re: [R] counting columns that match criteria

2011-11-10 Thread Dennis Murphy
Hi: Here's a toy example: # Default var names are V1-V20: u <- as.data.frame(matrix(rpois(100, 3), ncol = 20)) u <- transform(u, ngt1 = apply(u[, c('V1', 'V4', 'V9', 'V15')], 1, function(x) sum(x > 1)) ) u HTH, Dennis On Thu, Nov 10, 2011 at 7:24 AM, JL Villanueva wrote: > Hi, > > I am a l

[R] optim seems to be finding a local minimum

2011-11-10 Thread Dimitri Liakhovitski
Hello! I am trying to create an R optimization routine for a task that's currently being done using Excel (lots of tables, formulas, and Solver). However, otpim seems to be finding a local minimum. Example data, functions, and comparison with the solution found in Excel are below. I am not experie

Re: [R] R to automate scatter plots

2011-11-10 Thread R. Michael Weylandt
It's usually encouraged to reply to the list as well for threading/archive reasons. (And because occasionally your first respondent will say something wrong and require correction -- I was called out just this morning...oops) Yes, you seem to be using it right to add a title to the plot but you ha

Re: [R] newbie's question : xyplot legend with a white background

2011-11-10 Thread Dennis Murphy
Hi: Add a background = 'color' argument to key(): library('lattice') xyplot(1~1, panel = function(x,y, ...) { panel.xyplot(x,y) panel.abline(v=seq(0,1.4,by=0.1)) panel.abline(h=seq(0,1.4,by=0.1)) } ,key = list (x=0.2, y=0.8

[R] R package for segmentation with both continuous and categorical input variables XXXX

2011-11-10 Thread Dan Abner
Hello everyone, Can anyone suggest a decently documented (with good examples in the documentation) R package/function that performs segmentation (cluster, mixture modeling) of a population using both continuous and categorical input variables? Thank you, Dan [[alternative HTML version d

Re: [R] efpFunctional construction (strucchange package)

2011-11-10 Thread Achim Zeileis
On Thu, 10 Nov 2011, bonda wrote: Hello, to understand better how efpFunctional works, I'm trying to construct my own functionals. But concerning already existing functionals I have some questions. With maxBB it is clear: functional = list(comp = function(x) max(abs(x)), time = max), with ran

[R] Gibbs sampler

2011-11-10 Thread Gyanendra Pokharel
I have the following code, gibbs <-function(m,theta = 0.25, lambda =0.55, n =1){ alpha <- 1.5 beta <- 1.5 gamma <- 1.5 x<- array(0,c(m+1, 3)) x[1,1] <- theta x[1,2] <- lambda x[1,3]<- n for(t in 2:(m+1)){ x[t,1] <- rbinom(1, x[t-1,3], x[t-1,1]) x[t,2]

Re: [R] counting columns that match criteria

2011-11-10 Thread Jorge I Velez
Hi JL, How about the following? rowSums(d >1) # d is your data Best, Jorge.- On Thu, Nov 10, 2011 at 10:24 AM, JL Villanueva <> wrote: > Hi, > > I am a little new in R but I'm finding it extremely useful :) > > Here's my tiny question: > > I've got a table with a lot of columns. What I am in

Re: [R] counting columns that match criteria

2011-11-10 Thread jim holtman
try this: > x Col1 Col2 Col3 Col4 11111 22111 34141 43333 > apply(x, 1, function(a) sum(a > 1)) [1] 0 1 2 4 > x$count <- apply(x, 1, function(a) sum(a > 1)) > x Col1 Col2 Col3 Col4 count 11111 0 221

Re: [R] Error with Source()

2011-11-10 Thread jim holtman
You have a syntax error in your script. Take a look around line 884 On Thu, Nov 10, 2011 at 9:27 AM, ftonini wrote: > Hi everybody, > > I started to receive a weird message in R that I have never seen > before...also I haven't found anything on google or on this forum about it. > Whenever I use

Re: [R] Error in Summary.factor(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 4L, : max not meaningful for factors

2011-11-10 Thread Alex DJ
> The data set has 101 values, what can I use instead of letters? Why do you need to use letters? AFAIK this was only illustration what could be root of the error message. If the function requires ordered factor you can use your.ordered.factor <- ordered(your.unordered.factor) I do not remem

Re: [R] Error in Summary.factor(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 4L, : max not meaningful for factors

2011-11-10 Thread Alex DJ
When you put (fo) what do you mean? With ordered variable am now getting this error message: model1 <- siarmcmcdirichletv4(data, source, tef, concdep=0, 50, 5) Error in matrix(1, ncol = (numsources + numiso) * numgroups, nrow = (siardata$iterations - : invalid 'ncol' value (too larg

[R] request for post

2011-11-10 Thread LAXMI KANT TIWARI
please post my query in your mailing list -- LAXMI KANT TIWARI Andaman and Nicobar Space Application Cell PCCF'S Office, Van Sadan, Haddo - 744102 Port Blair, Andaman and Nicobar Islands, India Ph:+913192234430 Mobile:+919531839311 Alternate email: tiwari21...@itc.nl

[R] grid.pack and grid.frame bewilder me

2011-11-10 Thread cheung zihong
Hello R friends, I get quite confused in using the grid graphic function grid.pack( ) and grid.frame ( ). Here is a simple example: library(grid) grid.frame(name="frame1") grid.pack("frame1",rectGrob(width=unit(0.5,"npc"), height=unit(0.5,"npc"), gp=gpar(col="red"))) what I expect is a rectan

Re: [R] ggplot2 - regression statistics how to display on plot

2011-11-10 Thread Dennis Murphy
Hi: Here's an example of how one might do this in a specific example using geom_text(). # Some fake data: df <- data.frame(x = 1:10, y = 0.5 + (1:10) + rnorm(10)) # Fit a linear model to the data and save the model object: mod <- lm(y ~ x, data = df) # Create a list of character strings - the f

[R] newbie's question : xyplot legend with a white background

2011-11-10 Thread PtitBleu
Hello, Sorry in advance for adding a silly question on this forum but I haven't found the right keywords to find a solution to this basic problem. I'm just looking a way to have a white background behind the legend to hide the grid. Thanks in advance. The silly example for my silly question:

[R] counting columns that match criteria

2011-11-10 Thread JL Villanueva
Hi, I am a little new in R but I'm finding it extremely useful :) Here's my tiny question: I've got a table with a lot of columns. What I am interested now is to evaluate how many of 4 columns have a value greater than 1. I think it can be done with subset() but it will take a very long conditio

[R] Error with Source()

2011-11-10 Thread ftonini
Hi everybody, I started to receive a weird message in R that I have never seen before...also I haven't found anything on google or on this forum about it. Whenever I use the command source(...) to point to one of my scripts, I get the following message: Error in source("myfunctions.R") : myfuncti

[R] efpFunctional construction (strucchange package)

2011-11-10 Thread bonda
Hello, to understand better how efpFunctional works, I'm trying to construct my own functionals. But concerning already existing functionals I have some questions. With maxBB it is clear: functional = list(comp = function(x) max(abs(x)), time = max), with rangeBB: functional = list(time = funct

[R] Error with Source()

2011-11-10 Thread ftonini
Hi everybody, I started to receive a weird message in R that I have never seen before...also I haven't found anything on google or on this forum about it. Whenever I use the command source(...) to point to one of my scripts, I get the following message: Error in source("myfunctions.R") : myfuncti

Re: [R] Removing outliers

2011-11-10 Thread Filipe Ferminiano Rodrigues
Thanks for the answer, but I already fixed the problem. The problem was in selecting the row and column of the matrix. The program fixed is: for(i in 1:length(dados)){ q3=quantile(dados*[,i]*, probs=.75) q2=quantile(dados*[,i]*, probs=.50) q1=quantile(dados*[,i]*, probs=.25) d=q3-q1 for(i2 in 1:le

Re: [R] Help with gam

2011-11-10 Thread Paula McGee
From: Uwe Ligges mailto:ligges_at_statistik.tu-dortmund.de?Subject=Re:%20[R]%20Help%20with%2 0gam> > Date: Wed, 11 May 2011 19:08:38 +0200 On 11.05.2011 17:22, Zsolt Macskasi wrote: > Hi, > > I am a brand new user of R

Re: [R] Help: sqlSave Error

2011-11-10 Thread Jeff Newmiller
The error seems clear enough to me... sqlSave is trying to create the table but it already exists. Some possible directions you could take: 1) Do your work on a particular instance of the table within a single transaction and rollback at the end. 2) Delete the table before you run sqlSave. 3) E

Re: [R] Upgrade R?

2011-11-10 Thread Kevin Burton
The problem with this documentation is two-fold. One it seems to concentrate on building from source which I don't need. Two it doesn't address the upgade. I have a number of packages and so I need to do what has been suggested and install the latest version *first*. Then copy the libraries (packag

Re: [R] library(qpcR) cbind.na

2011-11-10 Thread Sarah Goslee
Well, that's your problem. You need to upgrade to the latest version of R, and the latest version of qpcR. It's no wonder things found in the current version don't work correctly in software that's over two years old. Sarah On Thu, Nov 10, 2011 at 11:43 AM, Evgenia wrote: > I have windows 7 >

Re: [R] Upgrade R?

2011-11-10 Thread Kevin Burton
I know they can coexist. It all works fine with both versions installed. But with limited resources I would like to uninstall the previous version (for me it is 2.13.1). Choosing uninstall from the 'Control Panel' results in the error listed at the beginning of this thread. From: Bert Gunter [m

Re: [R] 2^k*r experimental design and anova

2011-11-10 Thread Nicole Marie Ford
Sounds like you are hypotesis testing. you can try "an R companion to applied regression" 2nd edition 2011 by john fox and sanford weisberg. effects package does interactions quite well. - Original Message - From: "Giovanni Azua" To: r-help@r-project.org Sent: Thursday, November 10, 2

Re: [R] library(qpcR) cbind.na

2011-11-10 Thread Evgenia
I have windows 7 and below is information about R and loading library(qpcR) R version 2.9.1 (2009-06-26) Copyright (C) 2009 The R Foundation for Statistical Computing ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain con

Re: [R] Upgrade R?

2011-11-10 Thread Bert Gunter
The advice below is wholly unnecessary, and, in fact, various versions of R can coexist without problems (and are designed to do so). I just upgraded to 2.14.0 on Windows via the simple binary install process, copied old libraries over (unnecessary if you do not wish to keep old versions around --

Re: [R] Title for a group of plots?

2011-11-10 Thread Muhammad Rahiz
Perhaps something like this? par(oma=c(0,0,2,0)) par(mar=c(1,1,1,1)) par(mfcol=c(3,1)) plot(rnorm(10)) mtext("title") plot(rnorm(10)) plot(rnorm(10)) -- Muhammad Rahiz On Thu, 10 Nov 2011, Kevin Burton wrote: I can get multiple plots on a page like: op <- par(mfcol = c(3, 1)) What I w

Re: [R] Upgrade R?

2011-11-10 Thread jose Bartolomei
Hi,Don't know if this will help you but...In my short experience and following the guidelines you should first uninstall R. http://cran.r-project.org/doc/manuals/R-admin.html#Installing-R-under-Windows Unistall it from the Windows control panel. The old R version libraries file will be kept on

Re: [R] Title for a group of plots?

2011-11-10 Thread Sarah Goslee
Try ?mtext for information on how to plot into the outer margin of a group of plots. Sarah On Thu, Nov 10, 2011 at 11:07 AM, Kevin Burton wrote: > I can get multiple plots on a page like: > > > > op <- par(mfcol = c(3, 1)) > > > > What I was wondering is if there is a way to have a title for the

Re: [R] Title for a group of plots?

2011-11-10 Thread Bert Gunter
?mtext (Note the "outer argument) -- Bert On Thu, Nov 10, 2011 at 8:07 AM, Kevin Burton wrote: > I can get multiple plots on a page like: > > > > op <- par(mfcol = c(3, 1)) > > > > What I was wondering is if there is a way to have a title for the whole > page? I can specify the title for each

[R] Title for a group of plots?

2011-11-10 Thread Kevin Burton
I can get multiple plots on a page like: op <- par(mfcol = c(3, 1)) What I was wondering is if there is a way to have a title for the whole page? I can specify the title for each individual plot like: plot(xxx, main=".") But I would like a 'title' for the group of plots. Is this pos

Re: [R] A question on Programming

2011-11-10 Thread R. Michael Weylandt
Dr Murdoch, You're absolutely correct -- my apologies. Michael On Thu, Nov 10, 2011 at 10:44 AM, Duncan Murdoch wrote: > On 10/11/2011 10:28 AM, R. Michael Weylandt wrote: >> >> Yes, there will be some reduction in speed: >> >> E.g., >> >> >  system.time(replicate(1e5, (function() sum(1:10))())

Re: [R] A question on Programming

2011-11-10 Thread Duncan Murdoch
On 10/11/2011 10:28 AM, R. Michael Weylandt wrote: Yes, there will be some reduction in speed: E.g., > system.time(replicate(1e5, (function() sum(1:10))())) user system elapsed 0.696 0.022 0.729 > system.time(replicate(1e5, sum(1:10))) user system elapsed 0.292 0.006 0

Re: [R] A question on Programming

2011-11-10 Thread jim holtman
You can always runs a quick test. Here a loop is repeated 10M times and the cost of the function call adds 344 ns; is this significant in your case? Probably not for the modularity that is gained. For your 10,000 loops, it would add 3.44 ms to the overall run (less than an blink of the eye). >

Re: [R] Upgrade R?

2011-11-10 Thread John Kane
You might want to try Revo Uninstaller. Reportedly it hunts down and kills just about anything connected to a program that you want to uninstall. I have only used it once but it seems to work. There is a free and a paid version. I have the free one. --- On Thu, 11/10/11, Kevin Burton wrot

Re: [R] A question on Programming

2011-11-10 Thread Joshua Wiley
Hi Christofer, Any speed reduction should be relatively small, and the advantage in terms of easily maintainable, clearly understandable code will be enormous. If the function you make from the code does not have any methods and you are concerned about a slow down related to your loop repeatedly

Re: [R] A question on Programming

2011-11-10 Thread R. Michael Weylandt
Yes, there will be some reduction in speed: E.g., > system.time(replicate(1e5, (function() sum(1:10))())) user system elapsed 0.696 0.022 0.729 > system.time(replicate(1e5, sum(1:10))) user system elapsed 0.292 0.006 0.306 But it's not much: 3 tenths of a second for 10,000 ca

Re: [R] A question on Programming

2011-11-10 Thread Sarah Goslee
Hi, On Thu, Nov 10, 2011 at 10:07 AM, Christofer Bogaso wrote: > Dear all. Let say I have a group of codes which will be used in many places > in my overall R-code files. These group of codes will be used within a > for-loop (with a big length, like 1 times) and also many other places > outsi

  1   2   >