similar to: Using subset() in a user-defined function

Displaying 20 results from an estimated 6000 matches similar to: "Using subset() in a user-defined function"

2007 May 29
1
Partially reading a file (particularly)
Hello, I am trying to figure out if there exists some R command that allows one to be particularly selective when reading a file. I'm dealing with large fixed-width data sets that look like 539001.. 639001.. 639001.. ... 539002.. 639002.. ... Presently, I am using read.fwf to read an entire file, but I am interested only in reading those records beginning with 5. I have been unable to
2008 Jan 28
1
Grouping data via an index
Hello r-help, I have a lengthy vector of data (with values anywhere from 1-200), and another index vector of 'groups' representing values 0-2, 3-5, 6-8, ... of length 67. The index vector has the structure (1, 4, 7, ... , 196, 199), where each value is the midpoint of each respective group. I'm trying to convert the data vector such that values falling into each group are changed to
2007 Sep 13
1
Collapsing data frame; aggregate() or better function?
Hello r-help, I am trying to collapse or aggregate 'some' of a data frame. A very simplified version of my data frame looks like: > tester trip set num sex lfs1 lfs2 1 313 15 5 M 2 3 2 313 15 3 F 1 2 3 313 17 1 M 0 1 4 313 17 2 F 1 1 5 313 17 1 U 1 0 And I want to omit sex from the picture and just get an addition of num,
2015 May 09
4
[LLVMdev] [LSR] hoisting loop invariants in reverse order
Hi, I was tracking down a performance regression and noticed that LoopStrengthReduce hoists loop invariants (e.g., the initial formulae of indvars) in the reverse order of how they appear in the loop. This reverse order creates troubles for the StraightLineStrengthReduce pass I recently add. While I understand ultimately SLSR should be able to sort independent candidates in an optimal order,
2010 Feb 10
1
How to solve: Error in * unused argument(s) ?
Hi all, For some reason, I would like to use functions bellow (see example code bellow), but instead I get the following error message: *Error in foo2(...) : unused argument(s) (arg3 = 3)* #--------------------- # example code #--------------------- foo1 <- function(arg1,...) { print(arg1) foo2(...) foo3(...) } foo2 <- function(arg2) { print(arg2) } foo3 <- function(arg3) {
2017 Jun 06
3
Force argument to have quotes
I am writing a program where non-technical R users will read in a config file and the config file will then parse the arguments found within the config and pass them to respective functions. I'm having trouble (efficiently) writing a piece of code to retain quotation marks around the argument which requires it as input, as found in the example function below, myFuncton1. Below is a minimal,
2004 Jan 04
2
Voicemail Out call
There was a post in the 'wiki' for an application to provide an outcall when there is a voicemail is left on asterisk. I am having a problem that this application will only work if the caller presses the pound sign at the end of recording. As most people just hang up, this application isn't working. Can any offer suggestions to accomplish this out call?
2007 Sep 06
1
labelling specific points xyplot
Hello R-helpers, I'm trying to add labels to points in xyplot graphs, but I want lo label only those points which have a certain level of my grouping variable, and have encountered a few problems. An example dataframe that goes with the following code is at the end of this message. 1st step, adding labels (from another column in the dataframe) to my chosen points : I've figures this
2017 Jun 06
0
Force argument to have quotes
Harold: As a general rule, if you are using eval(parse(...)) you are doing it poorly in R; cf library("fortunes") fortune(106) Why is something like this not suitable: fun1 <- function(a1,a2,a3 = c("hi","by")) { cat(a3,a1+a2,"\n") } > fun1 (1,2) hi by 3 > fun1(1,2, a3 = "whoopee") whoopee 3 ... or, if you want to include the
2009 Jul 24
9
getting extra characters with printf(copyin(a, b))
Hi, I have a situation where a DTrace script is printing out extra characters, despite the copyin() call giving a specific length. Can anyone think of why this might be? It''s fine the first time all of the probes fire, but on a second run of my generating operations, I get junk in there. For example: set setop length 5, FOUND KEY, STORED set setop length 5, FOUND KEY, STORED get
2009 Dec 04
1
User's function
Hello, All, I want to write a function to do some works based on the arguments. For example, bind some variables (arguments) as this: myfunction <- function(arg1, arg2, arg3, ?) { x <- cbind(arg1, arg2, arg3, ?) } myfunction(arg1, arg2, arg3, ?) The function can automatically determine the number of arguments and bind them, which means if I assign 2 arguments, the function can bind
2007 Apr 19
3
[RFC, PATCH 1/5] Paravirt_ops full patching.patch
Add 5-argument handling for paravirt ops patching of PAE functions. Signed-off-by: Zachary Amsden <zach@vmware.com> diff -r dbe11208916f include/asm-i386/paravirt.h --- a/include/asm-i386/paravirt.h Thu Apr 19 11:40:55 2007 -0700 +++ b/include/asm-i386/paravirt.h Thu Apr 19 12:04:16 2007 -0700 @@ -308,10 +308,9 @@ unsigned paravirt_patch_insns(void *site * return value handling from
2007 Apr 19
3
[RFC, PATCH 1/5] Paravirt_ops full patching.patch
Add 5-argument handling for paravirt ops patching of PAE functions. Signed-off-by: Zachary Amsden <zach@vmware.com> diff -r dbe11208916f include/asm-i386/paravirt.h --- a/include/asm-i386/paravirt.h Thu Apr 19 11:40:55 2007 -0700 +++ b/include/asm-i386/paravirt.h Thu Apr 19 12:04:16 2007 -0700 @@ -308,10 +308,9 @@ unsigned paravirt_patch_insns(void *site * return value handling from
2005 Feb 11
1
Problem with # Transfer from queue
Hi I'm having trouble # transfering queue calls. in extensions.conf I have: [macro-queue] ; ; Places caller in queue ; ${ARG1} - Queue name to place caller in. ; ${ARG2} - Voicemail Extention ; ${ARG3} - Caller ID to Set. exten => s,1,DBget(temp=nm/on) ; Get Night key, if not existing,goto 102 exten => s,2,Playback(custom/500/10) exten => s,3,SetCallerID(${ARG3}) exten =>
2012 Mar 01
2
Rscript example
Hi there, I am trying to find an example how to use Rscript Let's suppose I want to pass 3 arguments (I don't want [options] and -e [expressions] as described in help) *on the command line myRscript.R -arg1=value1 -arg2=value2 -arg3=value3 *In the script #! /path/to/Rscript args = commandArgs(TRUE); >From what I see args is just a string, do I do things correctly ? -- View this
2012 Apr 26
6
print table on plot
Hello, I would like to be able to plot an array on a plot, something like: |arg1 | arg2 | arg3 val1| 0.9 | 1.1 | 2.4 val2| 0.33 | 0.23 | -1.4 val3| hello| stop | test I know Rwave is good to report but don't want to use it. ? Is there a package that allow quick and dirty plot of dataframes like this ? Thanks a lot -- View this message in context:
2012 Sep 04
2
[PATCH] valgrind: Support for ioctls used by Xen toolstack processes.
Please CC as I''m not subscribed to valgrind-developers. Under Xen the toolstack is responsible for managing the domains in the system, e.g. creating, destroying, and otherwise manipulating them. To do this it uses a number of ioctls on the /proc/xen/privcmd device. Most of these (the MMAPBATCH ones) simply set things up such that a subsequenct mmap call will map the desired guest
2013 Oct 28
2
[LLVMdev] loop vectorizer says Bad stride
Verifying function running passes ... LV: Checking a loop in "bar" LV: Found a loop: L0 LV: Found an induction variable. LV: We need to do 0 pointer comparisons. LV: Checking memory dependencies LV: Bad stride - Not an AddRecExpr pointer %13 = getelementptr float* %arg2, i32 %1 SCEV: ((4 * (sext i32 {(256 + %arg0),+,1}<nw><%L0> to i64)) + %arg2) LV: Src Scev: {((4 * (sext
2007 May 30
3
Dial plan inquiry using GotoIf()
Hi all, I'm looking for some rudimentary insight on GotoIf() which seems to be failing on me in my dial plan. All I basically wish to do is block a particular caller. Sounds easy enough, but my ternary operator/plan currently is not properly being implemented. Can anyone spot where I'm being a momo? All extensions get forwarded to the following macro: [macro-forward] ; arg1 = phone
2013 Dec 06
1
Paging in waves.
I've been working on writing a subroutine to page groups of phones at once and I'm having some difficulty. My goal is to have a user call an extension, I record the page they wish to play, I then page out that recorded file to the phones in groups. [sub-masspage] exten => s,1,NoOP same => n,Answer same => n,Set(filename=$PAGE) same => n,Wait(1) same =>