Re: [R] fast rowCumsums wanted for calculating the cdf

2010-10-15 Thread William Dunlap
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Joshua Wiley Sent: Friday, October 15, 2010 12:23 AM To: Gregor Cc: r-help@r-project.org Subject: Re: [R] fast rowCumsums wanted for calculating the cdf Hi, You might look

Re: [R] delete data row

2010-10-17 Thread William Dunlap
I had been thinking of: x - c(1, (2^(0.5))^2 , 3, 5, (2^(0.5))^2 , 3, 1) y - 2 x[-which(zapsmall(x-y) == 0)] [1] 1 3 5 3 1 Using which() to convert logicals into integer subscripts is almost always unnecessary and often wrong. In this case it fails when no x is close to y, because

Re: [R] aggregate with cumsum

2010-10-18 Thread William Dunlap
Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Gabor Grothendieck Sent: Monday, October 18, 2010 7:03 AM To: Bond, Stephen Cc: r-help@r-project.org Subject: Re: [R]

Re: [R] delete data row

2010-10-18 Thread William Dunlap
to logicals. VisTRUE2 - function(x) !is.na(x) x Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com -Original Message- From: Joshua Wiley [mailto:jwiley.ps...@gmail.com] Sent: Sunday, October 17, 2010 6:27 PM To: David Winsemius Cc: William Dunlap; R-help@r-project.org Subject: Re

Re: [R] ascii or regex code for alt-enter for Excel

2010-10-20 Thread William Dunlap
I think Excel wants a \n for newlines in a text cell entry but \r\n to separate rows of a csv file. You may have to open the file in binary mode and put in the \r\n at line ends by hand to achieve this from R, as it tranlates all \ns to \r\ns when writing them to a file. (\n is not the same as

Re: [R] ascii or regex code for alt-enter for Excel

2010-10-20 Thread William Dunlap
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of William Dunlap Sent: Wednesday, October 20, 2010 10:47 AM To: Duncan Murdoch; Mark Kimpel Cc: r-help@r-project.org Subject: Re: [R] ascii or regex code for alt-enter for Excel I think Excel wants a \n

Re: [R] Conversion of S+ libraries

2010-10-22 Thread William Dunlap
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of bill.venab...@csiro.au Sent: Thursday, October 21, 2010 5:33 PM To: glenn.tre...@ilim.com; r-help@r-project.org Subject: Re: [R] Conversion of S+ libraries It would

Re: [R] printing a variable during a loop

2010-10-22 Thread William Dunlap
If you are using the Windows GUI you can turn 'output buffering' on and off by either typing Ctrl-W or by using the MiscOutput Buffering menu item. When output buffering is off you may not need to add flush.console() to your code. Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com

Re: [R] Conditional looping over a set of variables in R

2010-10-22 Thread William Dunlap
You were a bit vague about the format of your data. I'm assuming all columns were numeric and the entries are one of 0, 1, and NA (missing value). I made a little function to generate random data of that format for testing purposes: makeData - function (nrow = 1500, ncol = 140, pMissing = 0.1)

Re: [R] lm looking for weights outside of the user-defined function

2010-10-22 Thread William Dunlap
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of David Winsemius Sent: Friday, October 22, 2010 6:25 AM To: Dimitri Liakhovitski Cc: r-help Subject: Re: [R] lm looking for weights outside of the user-defined function On

Re: [R] lm looking for weights outside of the user-defined function

2010-10-23 Thread William Dunlap
From: David Winsemius [mailto:dwinsem...@comcast.net] Sent: Friday, October 22, 2010 9:43 PM To: William Dunlap Cc: Dimitri Liakhovitski; r-help Subject: Re: [R] lm looking for weights outside of the user-defined function On Oct 22, 2010, at 12:17 PM, William Dunlap wrote

Re: [R] building lme call via call()

2010-10-25 Thread William Dunlap
Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Vito Muggeo (UniPa) Sent: Monday, October 25, 2010 9:16 AM To: r-h...@stat.math.ethz.ch Subject: [R] building lme call

Re: [R] runtime on ising model

2010-10-28 Thread William Dunlap
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of David Winsemius Sent: Thursday, October 28, 2010 9:20 AM To: Michael D Cc: r-help@r-project.org Subject: Re: [R] runtime on ising model On Oct 28, 2010, at 11:52 AM,

Re: [R] density() function: differences with S-PLUS

2010-11-02 Thread William Dunlap
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Nicola Sturaro Sommacal (Quantide srl) Sent: Tuesday, November 02, 2010 3:05 AM To: r-help@r-project.org Subject: [R] density() function: differences with S-PLUS Hello!

Re: [R] smooth: differences between R and S-PLUS

2010-11-03 Thread William Dunlap
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Nicola Sturaro Sommacal (Quantide srl) Sent: Wednesday, November 03, 2010 10:41 AM To: r-help@r-project.org Subject: [R] smooth: differences between R and S-PLUS Hi! I am

Re: [R] density() function: differences with S-PLUS

2010-11-04 Thread William Dunlap
From: mailingl...@sturaro.net [mailto:mailingl...@sturaro.net] On Behalf Of Nicola Sturaro Sommacal (Quantide srl) Sent: Thursday, November 04, 2010 2:36 AM To: William Dunlap Subject: Re: [R] density() function: differences with S-PLUS

Re: [R] count occurrence and distance of characters in string

2010-11-04 Thread William Dunlap
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Immanuel Sent: Thursday, November 04, 2010 4:54 PM To: Charles C. Berry Cc: r-help@r-project.org Subject: Re: [R] count occurrence and distance of characters in string Hey,

Re: [R] how to work with long vectors

2010-11-05 Thread William Dunlap
The following cover_per_3 uses sorting to solve the problem more quickly. It still has room for improvement. cover_per_3 - function (data) { n - length(data) o - rev(order(data)) sdata - data[o] r - rle(sdata)$lengths output - numeric(n) output[o] - rep(cumsum(r), r)

Re: [R] how to work with long vectors

2010-11-05 Thread William Dunlap
Of William Dunlap Sent: Friday, November 05, 2010 9:58 AM To: Changbin Du Cc: r-help@r-project.org Subject: Re: [R] how to work with long vectors The following cover_per_3 uses sorting to solve the problem more quickly. It still has room for improvement. cover_per_3 - function (data

Re: [R] Hashing and environments

2010-11-06 Thread William Dunlap
I would make make an environemnt called wfreqsEnv whose entry names are your words and whose entry values are the information about the words. I find it convenient to use [[ to make it appear to be a list (instead of using exists(), assign(), and get()). E.g., the following enters the 100,000

Re: [R] How to eliminate this for loop ?

2010-11-09 Thread William Dunlap
Note that for long vectors the OP's code would go much faster if he preallocated the output vector a to its eventual length. I.e., start with a - numeric(N) instead of a - c() I defined 2 functions that differed only in how a was initialized f0 - function(b, c) { N - length(c)

Re: [R] Populating then sorting a matrix and/or data.frame

2010-11-11 Thread William Dunlap
Peter, Your example doesn't work for me unless I set options(stringsAsFactors=TRUE) first. (If I do set that, then all columns of 'results' have class character, which I doubt the user wants.) results - data.frame() n = 10 for(i in 1:n){ +a = LETTERS[i]; +b = i; +c = 3*i + 2 +

Re: [R] Populating then sorting a matrix and/or data.frame

2010-11-11 Thread William Dunlap
You are right, I mistyped it. Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com -Original Message- From: John Kane [mailto:jrkrid...@yahoo.ca] Sent: Thursday, November 11, 2010 1:58 PM To: Peter Langfelder; r-help@r-project.org; William Dunlap Subject: Re: [R] Populating

Re: [R] error message: is

2010-11-12 Thread William Dunlap
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Kathrin Linsler Sent: Friday, November 12, 2010 5:22 AM To: r-help@r-project.org Subject: [R] error message: is Hello. using the lm command, I always receive the error

Re: [R] Extracting from data.frame

2010-11-14 Thread William Dunlap
Use df[1,,drop=FALSE] if you want the output to be a data.frame, no matter how many columns df has. The effective default value for drop is TRUE if the output has a single column. This does not depend on whether or not you subscripted rows or columns or both. Bill Dunlap Spotfire, TIBCO

Re: [R] Defining functions inside loops

2010-11-15 Thread William Dunlap
You could make f[[i]] be function(t)t^2+i for i in 1:10 with f - lapply(1:10, function(i)local({ force(i) ; function(x)x^2+i})) After that we get the correct results f[[7]](100:103) [1] 10007 10208 10411 10616 but looking at the function doesn't immdiately tell you what 'i' is in the

Re: [R] Computing Rolling Average

2010-11-16 Thread William Dunlap
Have you tried filter()? filter(a, rep(1,7)/7) Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Ray Brownrigg Sent: Tuesday, November 16, 2010 12:05 PM To:

Re: [R] Vectors out of lists?

2010-11-17 Thread William Dunlap
wdunlap tibco.com From: Eduardo de Oliveira Horta [mailto:eduardo.oliveiraho...@gmail.com] Sent: Tuesday, November 16, 2010 4:15 PM To: David Winsemius Cc: Phil Spector; r-help@r-project.org; www...@gmail.com; William Dunlap

Re: [R] Vectors out of lists?

2010-11-17 Thread William Dunlap
Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of William Dunlap Sent: Wednesday, November 17, 2010 9:42 AM To: Eduardo de Oliveira Horta Cc: r-help@r-project.org

Re: [R] [beginner] simple keyword to exit script ?

2010-11-21 Thread William Dunlap
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Henrik Bengtsson Sent: Sunday, November 21, 2010 8:17 AM To: David Winsemius Cc: r-help; madr Subject: Re: [R] [beginner] simple keyword to exit script ? Better is probably

Re: [R] density at particular values

2010-11-21 Thread William Dunlap
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Shant Ch Sent: Saturday, November 20, 2010 6:34 PM To: David Winsemius Cc: r-help@r-project.org Subject: Re: [R] density at particular values David, I did look at ?density

Re: [R] the first. from SAS in R

2010-11-23 Thread William Dunlap
I often use code like Curt's encapsulated in the following isFirstInRun function: isFirstInRun - function(x,...) { lengthX - length(x) if (lengthX == 0) return(logical(0)) retVal - c(TRUE, x[-1]!=x[-lengthX]) for(arg in list(...)) { stopifnot(lengthX ==

Re: [R] help: program efficiency

2010-11-25 Thread William Dunlap
If the input vector t is known to be ordered (or if you only care about runs of duplicated values, not all duplicated values) the following is pretty quick nodup3 - function (t) { t + (sequence(rle(t)$lengths) - 1)/100 } If you don't know if the the input will be ordered then ave() will do

Re: [R] help: program efficiency

2010-11-26 Thread William Dunlap
-Original Message- From: William Dunlap Sent: Thursday, November 25, 2010 9:31 AM To: 'randomcz'; r-help@r-project.org Subject: RE: [R] help: program efficiency If the input vector t is known to be ordered (or if you only care about runs of duplicated values, not all duplicated

Re: [R] FW: how to use by() ?

2010-11-29 Thread William Dunlap
- From: William Dunlap [mailto:wdun...@tibco.com] Sent: Monday, November 29, 2010 10:02 AM To: Jim Moon Subject: RE: [R] how to use by() ? m1$major_allele - with(m1, ifelse(Freq1==MAF, Al1, Al2)) Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com -Original Message

Re: [R] how to force a table to be square?

2010-07-22 Thread William Dunlap
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Liat Sent: Thursday, July 22, 2010 8:41 AM To: r-help@r-project.org Subject: Re: [R] how to force a table to be square? Thanks Peter! that worked, and was so easy. LOL. I

Re: [R] how to force a table to be square?

2010-07-22 Thread William Dunlap
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Wu Gong Sent: Thursday, July 22, 2010 9:44 AM To: r-help@r-project.org Subject: Re: [R] how to force a table to be square? Hi William, I'm curious about that you used d[]

Re: [R] How to fix slope and estimate intercept

2010-07-22 Thread William Dunlap
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Jun Shen Sent: Thursday, July 22, 2010 10:30 AM To: R-help Subject: [R] How to fix slope and estimate intercept Dear all, Is there anyway I can fix slope in some value and

Re: [R] gapped sequence data summary

2010-07-26 Thread William Dunlap
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of jd6688 Sent: Monday, July 26, 2010 9:23 AM To: r-help@r-project.org Subject: [R] gapped sequence data summary Id cat1 location item_values p-values sequence a111 1

Re: [R] Meaning of proc.time()

2010-07-29 Thread William Dunlap
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Christofer Bogaso Sent: Thursday, July 29, 2010 7:51 AM To: jim holtman Cc: r-h...@stat.math.ethz.ch Subject: Re: [R] Meaning of proc.time() Ok, but what are user CPU and

Re: [R] simple table/matrix problem

2010-07-30 Thread William Dunlap
Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Robin Hankin Sent: Friday, July 30, 2010 6:40 AM To: r-help@r-project.org Subject: [R] simple table/matrix problem

Re: [R] Convert an expression to a function

2010-08-02 Thread William Dunlap
I prefer to treat expressions as language objects as much as possible instead of converting them to text strings, using gsub() on the text strings, and then parsing the modified text strings. The following uses text processing to convert variable names like b3 to calls like b[3] but otherwise

Re: [R] Need help on upper.tri()

2010-08-03 Thread William Dunlap
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Nikhil Kaza Sent: Tuesday, August 03, 2010 8:56 AM To: Ron Michael Cc: r-help@r-project.org Subject: Re: [R] Need help on upper.tri() try using Matrix package instead

Re: [R] Extract values from data frame in R

2010-08-09 Thread William Dunlap
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Erik Iverson Sent: Sunday, August 08, 2010 11:27 PM To: Alexander Eggel Cc: r-help@r-project.org Subject: Re: [R] Extract values from data frame in R On 08/09/2010 01:16 AM,

Re: [R] Fwd: List of lists ?

2010-08-10 Thread William Dunlap
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Carlos Petti Sent: Tuesday, August 10, 2010 6:12 AM To: r-help@r-project.org Subject: [R] Fwd: List of lists ? -- Forwarded message -- From: Carlos Petti

Re: [R] matrix problem

2010-08-10 Thread William Dunlap
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of zhenjiang xu Sent: Tuesday, August 10, 2010 11:03 AM To: R-help@r-project.org Subject: [R] matrix problem Hi, I have a file like this: 1 2 0.1 2 3 0.2 3 1 0.3 And I

Re: [R] Median abline how-to ?

2010-08-12 Thread William Dunlap
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of David martin Sent: Thursday, August 12, 2010 7:42 AM To: r-h...@stat.math.ethz.ch Subject: [R] Median abline how-to ? Hi, I'm newbie with R and don't really know how to add a median line to each of

Re: [R] time of serialization

2010-08-15 Thread William Dunlap
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Saptarshi Guha Sent: Sunday, August 15, 2010 9:23 AM To: R-help@r-project.org Subject: [R] time of serialization Hello, I have question about the overhead in lapply. x is a

Re: [R] print numbers

2010-08-16 Thread William Dunlap
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of array chip Sent: Monday, August 16, 2010 2:54 PM To: Wu Gong; r-help@r-project.org Subject: Re: [R] print numbers Thank you all for the suggestions. They all worked. Now,

Re: [R] predict.lm, matrix in formula and newdata

2010-08-17 Thread William Dunlap
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Stephan Kolassa Sent: Tuesday, August 17, 2010 5:25 AM To: R-help@r-project.org Subject: [R] predict.lm, matrix in formula and newdata Dear all, I am stumped at what should

Re: [R] Can't read/write to _nonfi

2010-08-19 Thread William Dunlap
Min, For S+-specific questions the S-news mailing list would be better. s-n...@wubios.wustl.edu Unlike R, S+ stores its data objects in files, one file per object. The ___nonfi (___nonfiles) file contains a mapping for object names to file names, for those objects whose names cannot be

Re: [R] Aggregate Help

2010-08-20 Thread William Dunlap
Ken, Your error message Error in aggregate.date.frame(as,dat.frame(x), ...): arguments must have same length would arise if you called the 'Date' variable 'date'. R is a case-sensitive language: 'date' is a function object (with length 1) and 'Date' is the variable in your data.frame

Re: [R] Recursion problem

2010-08-22 Thread William Dunlap
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Shant Ch Sent: Saturday, August 21, 2010 9:04 PM To: r-help@r-project.org Subject: [R] Recursion problem Hi, I wanted to compute the value of the function ifn at

Re: [R] how to implement string pattern extraction in R

2010-08-22 Thread William Dunlap
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Waverley @ Palo Alto Sent: Sunday, August 22, 2010 3:51 PM To: r-help Subject: Re: [R] how to implement string pattern extraction in R Thanks for the reply to pointing me to

Re: [R] How to obtain seed after generating random number?

2010-08-24 Thread William Dunlap
The following will attach (as an attribute) the current global value of .Random.seed to the value of the evaluated 'expr' argument. If you supply the initial.Random.seed argument then it will use that when evaluating the expression (and also attach it to the result) so you can repeat the

Re: [R] Quick GREP challenge

2010-08-26 Thread William Dunlap
Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Dimitri Shvorob Sent: Thursday, August 26, 2010 3:16 AM To: r-help@r-project.org Subject: [R] Quick GREP challenge

Re: [R] Non-standard sorts on vectors

2010-08-26 Thread William Dunlap
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of chipmaney Sent: Thursday, August 26, 2010 3:00 PM To: r-help@r-project.org Subject: [R] Non-standard sorts on vectors I have a dataset I need to sort:

Re: [R] different interface to by (tapply)?

2010-08-30 Thread William Dunlap
Have you tried aggregate or plyr's ddply? by() is meant for functions that return such complicated return values that automatically combining them is not feasible (e.g., lm()). aggregate() works for functions that return scalars or simple vectors and returns a data.frame. ddply is part of a

Re: [R] Change plot order in lattice xyplot

2010-09-08 Thread William Dunlap
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Sam Albers Sent: Wednesday, September 08, 2010 9:42 AM To: r-help@r-project.org Subject: Re: [R] Change plot order in lattice xyplot Prior to creating a plot I usually just

Re: [R] 'par mfrow' and not filling horizontally

2010-09-08 Thread William Dunlap
Try par(pty=s). Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of ted.hard...@manchester.ac.uk Sent: Wednesday, September 08, 2010 12:01 PM To: r-h...@stat.math.ethz.ch

Re: [R] Help on simple problem with optim

2010-09-09 Thread William Dunlap
You can record all arguments and return values of the calls that optim(par,fn) makes to fn with a function like the following. It takes your function and makes a new function that returns the same thing but also records information it its environment. Thus, after optim is done you can see its

Re: [R] boxplot knowing Q1, Q3, median, upper and lower whisker value

2010-09-10 Thread William Dunlap
is.nan(bd.coerce(as.bdVector(c(1.0, N -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Brian Diggs Sent: Thursday, September 09, 2010 12:41 PM To: David A. Cc: R-help Subject: Re: [R] boxplot knowing Q1, Q3, median,upper and

Re: [R] adding zeroes after old zeroes in a vector ??

2010-09-10 Thread William Dunlap
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of skan Sent: Friday, September 10, 2010 12:33 PM To: r-help@r-project.org Subject: Re: [R] adding zeroes after old zeroes in a vector ?? Hi I'll study your answers. I

Re: [R] Can I monitor the iterative/convergence process while using Optim or MaxLik?

2010-09-14 Thread William Dunlap
You can also save the objective (or gradient) function arguments and values in datasets so you can later plot or print them. E.g., the following lets you avoid hand editing the objective function to do this. If you wanted to track the gradient, replace th c(VALUE,val) with rbind(VALUE,val).

Re: [R] Can I monitor the iterative/convergence process whileusing Optim or MaxLik?

2010-09-14 Thread William Dunlap
To: William Dunlap Cc: Greg Snow; r-help@r-project.org Subject: Re: RE: [R] Can I monitor the iterative/convergence process whileusing Optim or MaxLik? Bill, I am not able to get this to work for tracking inside the gradient function: trackFn - function (fn) { # return function like

Re: [R] Problem with cat() == A related question

2010-09-16 Thread William Dunlap
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Peng, C Sent: Thursday, September 16, 2010 5:39 AM To: r-help@r-project.org Subject: Re: [R] Problem with cat() == A related question The question is wehter cat() can print

Re: [R] get top n rows group by a column from a dataframe

2010-09-16 Thread William Dunlap
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Tan, Richard Sent: Thursday, September 16, 2010 8:39 AM To: r-help@r-project.org Subject: [R] get top n rows group by a column from a dataframe Hi, is there an R function like

Re: [R] convert to csv file

2010-09-17 Thread William Dunlap
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of lord12 Sent: Friday, September 17, 2010 9:02 AM To: r-help@r-project.org Subject: Re: [R] convert to csv file I get an error message: Error in file(file, ifelse(append,

Re: [R] Sorting and subsetting

2010-09-20 Thread William Dunlap
Richard Tan asked a very similar question last week ('get top n rows group by a column from a dataframe'). You could use ave() to make a sequence-number-within-group vector and choose rows with a small enough value there: tmp[ave(integer(nrow(tmp)), tmp$index, FUN=seq_along)=N, ] If there are

Re: [R] Doing operations by grouping variable

2010-09-21 Thread William Dunlap
Have you tried using ave()? group - rep(1:5,each=5) variable - log(1:25) d - data.frame(group, variable) d$scaled - d$variable/with(d, ave(variable, group, FUN=max)) Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com -Original Message- From: r-help-boun...@r-project.org

Re: [R] Doing operations by grouping variable

2010-09-22 Thread William Dunlap
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Seth W Bigelow Sent: Tuesday, September 21, 2010 4:22 PM To: bill.venab...@csiro.au Cc: r-help@r-project.org Subject: Re: [R] Doing operations by grouping variable Aah, that

Re: [R] make changes in existing vector with the apply function?

2010-09-27 Thread William Dunlap
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Jonas Sundberg Sent: Monday, September 27, 2010 1:43 AM To: r-help@r-project.org Subject: [R] make changes in existing vector with the apply function? Hi, I'm trying to make

Re: [R] Regular expressions: offsets of groups

2010-09-28 Thread William Dunlap
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Michael Bedward Sent: Tuesday, September 28, 2010 12:46 AM To: Titus von der Malsburg Cc: r-help@r-project.org Subject: Re: [R] Regular expressions: offsets of groups What

Re: [R] Source awareness?

2010-10-06 Thread William Dunlap
Over the years I've seen lots of requests concerning how to conveniently call scripts from other scripts. The S (R S+) language is oriented towards functions, not scripts (or macros), and many of the requests are for things easy to do in functions (or packages of functions) but not in scripts.

Re: [R] Adding a time variable prior to using reshape

2010-10-06 Thread William Dunlap
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of peter dalgaard Sent: Wednesday, October 06, 2010 7:22 AM To: Henrique Dallazuanna Cc: r-help@r-project.org; Andre Easom Subject: Re: [R] Adding a time variable prior to using

Re: [R] Odp: Vector replace 0 elements without using a loop

2010-10-07 Thread William Dunlap
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Petr PIKAL Sent: Thursday, October 07, 2010 12:13 AM To: rivercode Cc: r-help@r-project.org Subject: [R] Odp: Vector replace 0 elements without using a loop Hi

Re: [R] incorrect number of levels

2010-10-08 Thread William Dunlap
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Chagaris, Dave Sent: Friday, October 08, 2010 12:04 PM To: r-help@r-project.org Subject: [R] incorrect number of levels I have a data set 382 rows and 63 columns. One of

Re: [R] Pasting function arguments and strings

2010-10-13 Thread William Dunlap
Is this the sort of thing you are looking for? f - function(testName, dataset, ...) { + testFunc - match.fun(paste(testName, _test, sep=)) + testFunc(dataset, ...) + } m_test - function(x) the m test p_test - function(x) the p test f(m, 17) [1] the m test Bill Dunlap

Re: [R] Memory not mapped when using .C, problem in Mac but not in Linux

2010-10-13 Thread William Dunlap
This often happens when your C code uses memory that it did not allocate, particularly when it reads or writes just a little beyond the end of a memory block. On some platforms or if you are lucky there is unused memory between blocks of allocated memory and you don't see a problem. Other

Re: [R] Memory not mapped when using .C, problem in Mac but not in Linux

2010-10-13 Thread William Dunlap
From: David [mailto:david.mailli...@gmail.com] Sent: Wednesday, October 13, 2010 11:13 AM To: William Dunlap Cc: r-help@r-project.org Subject: Re: [R] Memory not mapped when using .C,problem in Mac but not in Linux

Re: [R] Summary

2009-09-29 Thread William Dunlap
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Henrique Dallazuanna Sent: Tuesday, September 29, 2009 9:57 AM To: Ashta Cc: R help Subject: Re: [R] Summary Try this: sapply(xc, summary) This fails if there are NA's

Re: [R] Equivalent for Matematica function Which...

2009-09-29 Thread William Dunlap
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Jarek Jasiewicz Sent: Tuesday, September 29, 2009 11:36 AM To: Erik Iverson Cc: R-help@r-project.org Subject: Re: [R] Equivalent for Matematica function Which... well

Re: [R] Rounding error in seq(...)

2009-09-30 Thread William Dunlap
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Martin Batholdy Sent: Wednesday, September 30, 2009 12:18 PM To: Duncan Murdoch Cc: r help Subject: Re: [R] Rounding error in seq(...) hum, can you explain that a little

Re: [R] Condition to factor (easy to remember)

2009-09-30 Thread William Dunlap
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Douglas Bates Sent: Wednesday, September 30, 2009 12:42 PM To: Dieter Menne Cc: r-help@r-project.org Subject: Re: [R] Condition to factor (easy to remember) On Wed, Sep 30,

Re: [R] How to get duplicated items in a vector?

2009-10-01 Thread William Dunlap
Bill Dunlap TIBCO Software Inc - Spotfire Division wdunlap tibco.com -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Peng Yu Sent: Thursday, October 01, 2009 7:42 PM To: r-h...@stat.math.ethz.ch Subject: [R] How to get

Re: [R] break up a string into strings with a fixed length

2009-10-02 Thread William Dunlap
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of jim holtman Sent: Friday, October 02, 2009 5:09 AM To: Gabor Grothendieck Cc: r-help@r-project.org; J Chen Subject: Re: [R] break up a string into strings with a fixed length

Re: [R] split-apply question

2009-10-02 Thread William Dunlap
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of hadley wickham Sent: Friday, October 02, 2009 6:07 AM To: jim holtman Cc: r-help@r-project.org; Kavitha Venkatesan Subject: Re: [R] split-apply question On Fri, Oct 2, 2009

Re: [R] Stranger Behavior -maybe not

2009-10-03 Thread William Dunlap
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Antonio Paredes Sent: Saturday, October 03, 2009 5:53 PM To: r-help@r-project.org Subject: [R] Stranger Behavior -maybe not Hello everyone, When I run a for loop I noticed

Re: [R] gsub - replace multiple occurences with different strings

2009-10-05 Thread William Dunlap
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Martin Batholdy Sent: Monday, October 05, 2009 7:34 AM To: r help Subject: [R] gsub - replace multiple occurences with different strings Hi, I search a way to replace

Re: [R] sort (all columns of) a matrix

2009-10-08 Thread William Dunlap
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Bert Gunter Sent: Thursday, October 08, 2009 11:41 AM To: 'Erik Iverson'; 'Kajan Saied'; r-help@r-project.org Subject: Re: [R] sort (all columns of) a matrix Right. My guess

Re: [R] sort (all columns of) a matrix

2009-10-08 Thread William Dunlap
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of William Dunlap Sent: Thursday, October 08, 2009 12:01 PM To: Bert Gunter; Erik Iverson; Kajan Saied; r-help@r-project.org Subject: Re: [R] sort (all columns of) a matrix

Re: [R] field index given name.

2009-10-12 Thread William Dunlap
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of tdm Sent: Monday, October 12, 2009 12:22 AM To: r-help@r-project.org Subject: Re: [R] field index given name. Thanks - would never have guessed that. I eventually got the

Re: [R] crosstabulation and unlist function

2009-10-12 Thread William Dunlap
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of eugen pircalabelu Sent: Monday, October 12, 2009 1:06 PM To: David Winsemius Cc: R-help Subject: Re: [R] crosstabulation and unlist function Hello, First of all, thank you

Re: [R] Counting

2009-10-13 Thread William Dunlap
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Ashta Sent: Tuesday, October 13, 2009 5:20 AM To: R help Subject: [R] Counting *Hi all, * *Assume that I have the following data set with tow variables and I want

Re: [R] Getting indeices of intersecting elements.

2009-10-14 Thread William Dunlap
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Praveen Surendran Sent: Wednesday, October 14, 2009 9:15 AM To: r-help@r-project.org Subject: [R] Getting indeices of intersecting elements. Hi, Is there a command to get

Re: [R] tapply() and using factor() on a factor

2009-10-15 Thread William Dunlap
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Alexander Peterhansl Sent: Thursday, October 15, 2009 2:50 PM To: r-help@r-project.org Subject: [R] tapply() and using factor() on a factor Dear List, Shouldn't

Re: [R] Cannot calculate mean() for double vector

2009-10-16 Thread William Dunlap
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Reuben Bellika Sent: Friday, October 16, 2009 11:02 AM To: r-help@r-project.org Subject: Re: [R] Cannot calculate mean() for double vector OK. It looks like I just have

Re: [R] how to get rid of 2 for-loops and optimize runtime

2009-10-19 Thread William Dunlap
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Ian Willems Sent: Monday, October 19, 2009 6:50 AM To: 'r-help@r-project.org' Subject: [R] how to get rid of 2 for-loops and optimize runtime Short: get rid of the loops I

Re: [R] Counting

2009-10-20 Thread William Dunlap
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Peter Ehlers Sent: Tuesday, October 20, 2009 8:48 AM To: Ashta Cc: R help Subject: Re: [R] Counting How about unch - aggregate(x2==x1, by = list(x1=x1), FUN = sum) chgd - aggregate(x2!=x1, by =

Re: [R] how to get rid of 2 for-loops and optimize runtime

2009-10-20 Thread William Dunlap
-Original Message- From: Ian Willems [mailto:ian.will...@uz.kuleuven.ac.be] Sent: Tuesday, October 20, 2009 6:46 AM To: William Dunlap; r-help@r-project.org Subject: RE: [R] how to get rid of 2 for-loops and optimize runtime Hi William, Your programs works perfect and very fast

  1   2   3   4   5   6   7   8   9   10   >