Displaying 20 results from an estimated 1000 matches similar to: "Efficiently reading random lines form a large file"
2007 Apr 17
2
Use of argument '...'
Dear R list,
I've read the function writing sections on both "An introduction to R" and "R language Definition" manuals but still don't understand why the following gives an error message:
fun <- function(x, ...) x + y
fun(1, y=2)
I get:
Error in fun(1, y = 2) : object "y" not found
I'd appreciate any help in understanding this.
R version 2.4.1
2006 Jul 31
2
math symbols and text with mtext()
Dear R users,
Two questions:
1) Is there a way to simplify the mtext() line below ?
beta=c(1,-1)
m=5
plot(1)
mtext( bquote(paste( beta == .(paste( "(", paste(beta, collapse=", "), ")" )) )), outer=TRUE,line=-3)
2) How do I get the embedded carriage return "\n" below to work, i.e for the text that follows it to appear on the next line?
beta=c(1,-1)
m=5
2006 Sep 13
2
Retrieving value computed in inner function call
Dear R users,
Consider the following example function:
f = function(a,b) {
g = function(x) a*x + b
h = function(x) g(x)^2 + x^2
opt = optimize(h,lower = -1, upper = 1)
x.min = opt$minimum
h.xmin = opt$objective
g.xmin = g(x.min)
return(c(x.min, h.xmin, g.xmin))
}
In my real problem the function that plays the role of "g" is costly
to compute. Now, to
2007 Jun 19
3
Controlling text and strip arrangement in xyplot
I've searched the archives and read the xyplot help but can't figure
out the 2 lattice questions below?
Consider:
library(lattice)
DF <- data.frame(x=rnorm(20), y=rnorm(20), g1=rep(letters[1:2], 10),
g2=rep(LETTERS[1:2], each=10),
g3=rep(rep(letters[3:4],each=5),2))
xyplot(y ~ x | g1 + g2, groups=g3, data=DF)
1) Is there a way to get one strip per row and column
2006 Jun 23
1
numeric variables converted to character when recoding missing values
Dear R helpers,
I have a data frame where missing values for numeric variables are coded as
999. I want to recode those as NAs. The following only partially succeeds
because numeric variables are converted to character in the process:
df <- data.frame(a=c(999,1,999,2), b=LETTERS[1:4])
is.na(df[2,1]) <- TRUE
df
a b
1 999 A
2 NA B
3 999 C
4 2 D
is.numeric(df$a)
[1] TRUE
2006 Mar 23
1
YAML inconsistencies...
I figured I''d post here before submitting a ticket, but I''m seeing some
confusing stuff when dealing with YAML now. I was using it to freeze
objects in my database, and so i had some data already around to mess with.
I upgraded both Ruby (1.8.3 -> 1.8.4) and Rails ( -> 1.1RC1) and this junk
started. I''ve outlined the problem in two pastes, which I''ll
2010 Mar 16
2
Is there a way to edit a specific line in a function (e.g: doing function->text->edit->function) ?
Hello,
Let's say we have the following function:
foo <- function(x)
{
line1 <- x
line2 <- 0
line3 <- line1 + line2
return(line3)
}
And that we want to change the second line to be:
line2 <- 2
How would you do that?
The two ways I know of are either to use
fix(foo)
And change the function.
Or to just write the function again.
Is there
2016 Sep 30
2
[PATCH] customize: Add --append-line.
This appends a single line to a file, with some cleverness
involving guessing the right line endings to use.
Also adds a test.
---
builder/test-virt-builder.sh | 57 +++++++++++++++++++++++++++++++++++-
customize/Makefile.am | 2 ++
customize/append_line.ml | 70 ++++++++++++++++++++++++++++++++++++++++++++
customize/append_line.mli | 20 +++++++++++++
customize/customize_run.ml
2006 Mar 25
2
Textilize problems with line breaks
I''m having a problem formatting some text. I have a textarea that I
input my text into, which will then be put into an e-mail and sent out.
The problem I am having is when there is a single line break.
Multiple line breaks work fine (hitting enter twice), but single line
breaks don''t seem to work properly.
Take the following input:
Line1.
Line2.
Line3.
Line4.
Using
2003 Jul 27
2
continuous independent variable in lme
Dear All,
I am writing to ask a clarification on what R, and in particular lme, is
doing.
I have an experiment where fly wing area was measured in 4 selection lines,
measured at 18 and 25 degrees. I am using a lme model because I have three
replicated per line (coded 1:12 so I need not use getGroups to creat an
orederd factor).
The lines are called: "18"; "25";
2004 Jun 28
2
Would this work?
I am trying to implement a rollover of extensions.
exten => 3000,1,GotoIf($[${line1} = Congestion]?3:2)
exten => 3000,2,Dial(${line1},15,rt)
exten => 3000,3,GotoIf($[${line2} = Congestion]?5:4)
exten => 3000,4,Dial(${line2},15,rt)
exten => 3000,5,GotoIf($[${line3} = Congestion]?7:6)
exten => 3000,6,Dial(${line3},15,rt)
exten => 3000,7,GotoIf($[${line4} = Congestion]?1:8)
2007 May 25
1
Speeding up resampling of rows from a large matrix
I'm trying to:
Resample with replacement pairs of distinct rows from a 120 x 65,000
matrix H of 0's and 1's. For each resampled pair sum the resulting 2
x 65,000 matrix by column:
0 1 0 1 ...
+
0 0 1 1 ...
_______
= 0 1 1 2 ...
For each column accumulate the number of 0's, 1's and 2's over the
resamples to obtain a 3 x 65,000 matrix G.
For those
2004 Mar 10
1
coreutils-4.5.3-28 causing duplication?
Here's a bit of a strange one. I hunted through the ocfs-users archives,
but didn't see any mention of this, so here goes...
Using coreutils 4.5.3-27 on RHAS 3, the utilities perform as expected
against non-OCFS volumes:
$ rpm -q coreutils
coreutils-4.5.3-27
# cat a 3 line test file. Works as expected
$ cat /var/tmp/file
line1
line2
line3
# copy that file. Works as expected
$ cp
2006 Aug 04
2
expression() - Superscript in y-axis, keeping line break in string
I've tried several different ways to accomplish this, but as yet to no
avail. My y-axis for a plot has a rather long label, and thus I have
been using "/n" to break it into two lines. However, to make it
technically correct for publication, I also need to use superscript in
the label. For example:
par(oma=c(0,0,2,0),mar=c(5,6,0.25,2),lheight=1)
plot(1:10,
2015 Jul 02
0
multiple sip trunks with the same ITSP
HI LIST CAN U HELP ME
If there are multiple sip trunks with the same ITSP then an incoming call
is arbitarily matched to the last peer with the same host IP address. This
is not a serious problem because the DID is still correct but it does have
many insidious effects due to the incorrect channel name
Example
register=myaccount1 at sip.myitsp.com/line1
register=myaccount2 at
2014 Jun 12
1
regression bug with getParseData and/or parse in R-3.1.0
Hi,
With R-3.1.0 I get:
> getParseData(parse(text = "{1}", keep.source = TRUE))
line1 col1 line2 col2 id parent token terminal text
7 1 1 1 3 7 9 expr FALSE
1 1 1 1 1 1 7 '{' TRUE {
2 1 2 1 2 2 3 NUM_CONST TRUE 1
3 1 2 1 2 3 5 expr FALSE
4 1 3 1
2009 Sep 23
2
[LLVMdev] DebugFactory
On Wed, Sep 23, 2009 at 2:27 PM, Talin <viridia at gmail.com> wrote:
> On Wed, Sep 23, 2009 at 1:51 PM, Dan Gohman <gohman at apple.com> wrote:
>>
>> On Sep 22, 2009, at 4:49 PM, Talin wrote:
>>>
>>> // Calculate the size of the specified LLVM type.
>>> Constant * DebugInfoBuilder::getSize(const Type * type) {
>>> Constant * one =
2007 Oct 07
0
Break [SEC=UNCLASSIFIED]
Hi,
You can exit out of the 'identify()' routine by either:
right-click > 'stop'
Or
click on 'stop > stop locator' in the top-left of the plot window.
The script should continue with line1, line2 etc.
Cheers Joe
Joe Crombie
Information and Risk Sciences
Bureau of Rural Science
Canberra Australia
p: +61 2 6272 5906
e: joe.crombie at brs.gov.au
2016 Jun 09
1
for loop example
> From: Indunil Jayasooriya <indunil75 at gmail.com>
> > >
> > > [root at centos67 loop]# cat file1
> > > firstname1
> > > firstname2
> > >
> > > [root at centos67 loop]# cat file2
> > > lastname1
> > > lastname2
> > >
> > > I need a OUTPUT like this
> > >
> > >
> > >
2005 Mar 14
1
Legend Line Size
Hello all,
When I view or print the below plot on my Linux machine under R 2.0.1 I
see a nice thick solid and dashed line with a legend. However, while the
lines are distinguishable, the legend is not. That is, the short (solid)
line next to "line1" and the short (dashed) line next to "line2" seem to
have the exact same length. What I would like to do is to expand the
legend