Displaying 20 results from an estimated 7000 matches similar to: "Merging vectors"
2011 Dec 28
2
Loops and vector operations
Dear all,
this is my first post and I?m very new at R, I don?t know if somebody can
help with an issue.
I?m doing some exercices and I don?t know if for example I can convert this
for in an operation with vectors:
for (i in 2:n){
if (ES[i-1]==0 && sprd[i-1]>mediaSDP[i-1] && sprd[i]<=mediaSDP[i]) {ES[i]
<- -1} else
if((ES[i-1]==-1 || ES[i-1]==-15) &&
2012 Mar 06
1
Extracting data from a zoo by date
Dear all,
I know that it is a silly question, but I have a zoo object like this:
valor1 valor2
01/02/08 36.7381 17.0097
01/03/08 36.9296 16.8331
01/04/08 35.6934 16.3539
01/07/08 35.3539 16.3791
01/08/08 36.3811 16.9340
01/09/08 37.9220 17.6655
The name is nuevo.zoo and I need to extract the data for a giving day, for
example for 01/03/08 and for the
2005 Aug 03
3
prcomp eigenvalues
Hello,
Can you get eigenvalues in addition to eigevectors using prcomp? If so how?
I am unable to use princomp due to small sample sizes.
Thank you in advance for your help!
Rebecca Young
--
Rebecca Young
Graduate Student
Ecology & Evolutionary Biology, Badyaev Lab
University of Arizona
1041 E Lowell
Tucson, AZ 85721-0088
Office: 425BSW
rlyoung at email.arizona.edu
(520) 621-4005
2007 Sep 29
1
templates with same name before extension are cached
Hi all,
I was just wondering if this is the intended behavior. Here is my setup:
controller
def index
respond_to do |f|
f.xml { render :xml => true }
f.html { render :layout => :none }
end
end
In my views I have a file for each type
index.herb
index.xerb
The first request I send is cached and interferes with the other one.
For example, if I send an xml request
2007 Jul 10
1
Lattice: vertical barchart
barchart(Titanic, stack=F) produces a very nice horizontal barchart.
Each panel has four groups of two bars.
barchart(Titanic, stack=F, horizontal=F) doesn't produce the results I
would have expected, as it produces this warning message:
Warning message:
y should be numeric in: bwplot.formula(x = as.formula(form), data =
list(Class = c(1,
And it results in each panel having 22 groups of
2005 Oct 19
3
diag() problem
Hi
I have a matrix "u", for which diag() gives an error:
u <- structure(c(5.42334674128216, -2.31319389204264, -5.83059042218476,
-1.64112369640695, -2.31319389212801, 3.22737617646609,
1.85200668021569,
-0.57102273078531, -5.83059042231881, 1.85200668008156,
11.9488923894962,
-3.5525537165941, -1.64112369587405, -0.571022730886046,
-3.55255371755604,
2014 Mar 14
3
Sys::Virt integration into other event loops
Hi all,
I’m trying to integrate Perl’s Sys::Virt into an already existing AnyEvent program.
I’m accustomed to writing things like this:
use EV;
use AnyEvent;
use AnyEvent::Handle;
my $h = AnyEvent::Handle->new(fh => $fh, …);
$h->on_read(sub { … });
EV::run; ## start the event loop
I can add some code in the on_read() handler and every time the $fh has something to read, it will fire
2007 Jun 01
2
Getting names of objects passed with "..."
Is there a tidy way to get the names of objects passed to a function via the
"..." argument?
rbind/cbind does what I want:
test.func1 <- function(...) {
nms <- rownames(rbind(..., deparse.level=1))
print(nms)
}
x <- "some stuff"
second <- "more stuff"
test.func1(first=x, second)
[1] "first" "second"
The usual
2015 May 12
2
Why is the diag function so slow (for extraction)?
>>>>> Steve Bronder <sbronder at stevebronder.com>
>>>>> on Thu, 7 May 2015 11:49:49 -0400 writes:
> Is it possible to replace c() with .subset()?
It would be possible, but I think "entirely" wrong.
.subset() is documented to be an internal function not to be
used "lightly" and more to the point it is documented to *NOT*
1999 Aug 18
2
diag()
I would like to suggest a slight modification to diag(). In the case
where x is a matrix with both row names and column names the same, it
would be reasonable if the resulting vector also had those names. I often
use diag() on variance matrices, where this modification is helpful.
The modification requires replacing
if (is.matrix(x) && nargs() == 1)
return(c(x)[1 +
2011 Feb 19
1
Accessing Package NEWS (NEWS.Rd)
Okay. So, after having spent quite some time never really tracking down
why my package NEWS files were unacceptable to readNEWS(), I
noticed that there was recent (to me anyway) development that allowed
the NEWS to be done as an Rd file. Sweet! A more standard format...
I converted a NEWS file in one of my unreleased packages to Rd format.
checkNEWS() gave it a thumbs up.
But then it went south.
2015 May 05
3
Why is the diag function so slow (for extraction)?
Looks like the c(x)[...] bit used to be as.matrix(x)[...]. Not sure
why the change was made many years ago, but this was before names were
handled explicitly. It would definitely be better to not force the
duplicate, at least in the case where we are sure c() and [ would not
dispatch.
Best,
luke
On Mon, 4 May 2015, peter dalgaard wrote:
>
>> On 04 May 2015, at 19:59 , franknarf
2008 May 08
3
Setting matrix dimnames in a list
Hey All,
I was wondering if I could solicit a little input on what I'm trying to
do here. I have a list of matrices, and I want to set their dimnames,
but all I can come up with is this:
x <- matrix(1:4,2)
y <- matrix(5:8,2)
z <- list(x,y)
nm <- c("a","b")
nms <- list(nm,nm)
z <- lapply(z,function(x)dimnames(x)<-nms)
As you can see, this
2015 May 13
1
Why is the diag function so slow (for extraction)?
As kindly pointed out to me (oh my decaying gray matter), is.object()
is better suited for this test;
$ svn diff src/library/base/R/diag.R
Index: src/library/base/R/diag.R
===================================================================
--- src/library/base/R/diag.R (revision 68345)
+++ src/library/base/R/diag.R (working copy)
@@ -23,9 +23,11 @@
stop("'nrow' or
2007 Mar 20
1
Error in nlme with factors in R 2.4.1
Hi,
the following R lines work fine in R 2.4.0, but not in R 2.4.1 or any devel versions of R
2.5.0 (see below for details).
library(drc) # to load the dataset 'PestSci'
library(nlme)
## Setting starting values
sv <- c(0.43355869, 2.49963220, 0.05861799, 1.73290589, 0.38153146, 0.24316978)
## No error
m1 <-
nlme(SLOPE ~ c + (d-c)/(1+exp(b*(log(DOSE)-log(e)))),
fixed =
2005 Sep 27
2
Integration with NMS AG-E1/T1
I want to replace a custom PBX, that is infront on a IVR system based on OLD NMS AG-E1 Card.
The Cards is configurated with CAS Digitalmode, someone can give me some info about Digim Cards CAS configuration i need a conversion Table?
I wanto to don't touch configuration on winbox, i want only replace HWPBX box with asterisk.
Diagram
Telco E1 ===>Proprietary PBX========(CAS)===>IVR
2012 Jun 15
2
strings concatenation and organization (fast)
Hello,
What is the fastest way to do this? I has to be done quite a few times.
Basically I have sets of 3 numbers (as characters) and sets of 3 dashes and
I have to store them in named columns. The order of the sets and the column
name they fall under is important. The actual numbers and the pattern/order
of the sets should be considered random/unpredictable.
Sample data:
vec =
2003 May 21
2
moving onto returning a data.frame?
I've been studying some of the code and I'm still a little shakey on the
proper method for returning a data.frame from a C function (which is my
ultimate goal here). I've started some code that I've "stolen" from the
archives and I'm running into crashes, etc. I've been trying to gleen some
insight from the src/main/scan.c file and didn't find many comments in
2009 Feb 03
1
Automatic creation of columns in zoo object
Hello, everyone
I have a question.
Assume I have the following zoo object:
me.la <- structure(c(1524.75, 1554.5, 1532.25, 1587.5, 1575.25, 1535.5,
1550, 1493.5, 1492.5, 1472.25, 1457.5, 1442.75, 1399, 1535.75,
1565.25, 1543.5, 1598.5, 1586.5, 1547, 1561.5, 1504.75, 1503.75,
1483.75, 1468.75, 1453.75, 1410, 1546.75, 1575.25, 1554, 1609,
1597.5, 1558.5, 1573, 1516.25, 1515.5, 1495, 1480, 1465,
2007 Feb 27
1
Function to do multiple named lookups faster?
Hi,
I apologize if this topic has been discussed - I could not figure out
a good search phrase for this question.
I have a named vector x, with multiple (duplicate) names, and I would
like to obtain a (shorter) vector with non-duplicate names in which
the values are the means of the values of the duplicated indexes in x.
My best (fastest) solution to this was this code:
nms <- names( x )