Displaying 20 results from an estimated 103 matches for "vec2".
Did you mean:
vec
2012 Aug 24
6
updating elements of a vector sequentially - is there a faster way?
I would like to know whether there is a faster way to do the below
operation (updating vec1).
My objective is to update the elements of a vector (vec1), where a
particular element i is dependent on the previous one. I need to do this on
vectors that are 1 million or longer and need to repeat that process
several hundred times. The for loop works but is slow. If there is a faster
way, please let
2010 Jul 12
2
findInterval and data resolution
Hello Wise Ones...
I need a clever way around a problem with findInterval. Consider:
vec1 <- 1:10
vec2 <- seq(1, 10, by = 0.1)
x1 <- c(2:3)
a1 <- findInterval(x1, vec1); a1 # example 1
a2 <- findInterval(x1, vec2); a2 # example 2
In the problem I'm working on, vec* may be either integer or numeric, like
vec1 and vec2. I need to remove one or more sections of this vector; for
ins...
2001 Nov 01
1
Erratic behaviour of sammon()
...ing.
I noticed some erratic behaviour in sammon(). Running sammon on
two nearly identical sets of data results in very different
results. Below is an example. I create an initial configuration
with cmdscale() and store it into 'vec1'. I write this to file,
and read it back in again to 'vec2'. According to cor() on the
three columns of 'vec1' and 'vec2', they are identical. However,
if I use sammon() with initialising from 'vec1' or 'vec2', I get
different results. (SAMMON() is a wrapper function).
This I did on a Linux machine (R version 1.3.1):...
2004 Jul 09
3
Problem with bwplot
Try factor(vec2) in your bwplot() call.
-----Original Message-----
From: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch]On Behalf Of Ernesto Jardim
Sent: Friday, July 09, 2004 9:41 AM
To: Mailing List R
Subject: [R] Problem with bwplot
Hi,
I'm ploting some box-and-whisker...
2009 Jul 27
1
how to use do.call together with cbind and get inside a function
Dear R-helpers:
I have a question related to using do.call to call cbind and get.
#the following works
vec1 <- c(1,2)
vec2 <- c(3,4)
ColNameVec <- c('vec1','vec2')
mat <- do.call("cbind",lapply(ColNameVec,get))
mat
#put code above into a function then it does not work
#before doing so, first remove vec1 and vec2 from global environment
rm(vec1,vec2)
test <- function()
{
vec1 <...
2013 Apr 18
1
vectors with equal values
Hi,
Try:
?vec1<-c(1,1,1,1,1,1,1,1,1)
if(all(vec1==1)) "xxxxxxxxx" else? "yyyyyyyyyyy"
#[1] "xxxxxxxxx"
?vec2<-c(rep(1,4),2)
?if(all(vec2==1)) "xxxxxxxxx" else? "yyyyyyyyyyy"
#[1] "yyyyyyyyyyy"
#or
if(length(unique(vec1))==1) "xxxxxxxxx" else? "yyyyyyyyyyy"
#[1] "xxxxxxxxx"
? if(length(unique(vec2))==1) "xxxxxxxxx" else? "yyyyyy...
2007 Aug 23
0
indexing and regression testing
...PL2-QA, a GPL2 clone that obliges users to participate in some kind of regression testing (to be defined).
Best regards
Jens Oehlschl?gel
P.S.
> # some timings using timefactor(regtest)
> library(rindex)
>
> Vec1 <- c(NA, paste('a', 1:1000000, sep=""))
> Vec2 <- c(paste('a', 1:1000000, sep=""), NA)
> iVec1 <- index(Vec1, verbose=TRUE)
user.self sys.self elapsed
sort 7.85 0.01 7.86
tree 0.00 0.00 0.00
> iVec2 <- index(Vec2, verbose=TRUE)
finalized tree
user.self sys.self elapsed
sort...
2008 Dec 30
2
[LLVMdev] Folding vector instructions
...create 'select' instruction, and create 'insert-element'
instruction.
<code>
llvm::Value * Instructions::min(llvm::Value *in1, llvm::Value *in2)
{
std::vector<llvm::Value*> vec1 = extractVector(in1); // generate LLVM
extract element
std::vector<llvm::Value*> vec2 = extractVector(in2);
Value *xcmp = m_builder.CreateFCmpOLT(vec1[0], vec2[0], name("xcmp"));
Value *selx = m_builder.CreateSelect(xcmp, vec1[0], vec2[0],
name("selx"));
Value *ycmp = m_builder.CreateFCmpOLT(vec1[1], vec2[1], n...
2010 Aug 24
3
multiple assignments ?
Simple one, have read and googled, still no luck!
I want to create several empty vectors all of the same length.
I would like multiple empty vectors (vec1, vec2, vec3) and want to create them all in one line.
I've tried
vec1,vec2,vec3 <- vector(length=5)
and
c(vec1,vec2,vec3) <- vector(length=5)
and several other attempts but nothing seems to work ... suggestions?
Thanks
Jim
===============================
Dr. Jim Maas
University of East An...
2008 May 12
1
lexicographic comparison of two vectors
Is there any built-in way to lexicographically compare two vectors of
the same length in R? The textbook algorithm could be coded as follows:
lex.cmp <- function (vec1,vec2) {
for (j in 1:length(vec1)) {
if (vec1[j] < vec2[j]) { return(-1) }
if (vec1[j] > vec2[j]) { return(1) }
}
return(0)
}
Thanks,
Gabriel
2015 May 04
2
[LLVMdev] Incorrect code generated for arm64
Hi all,
I’ve narrowed down a problem in my code to the following test case:
- - - -
typedef struct {float v[2];} vec2;
typedef struct {float v[3];} vec3;
vec2 getVec2();
vec3 getVec3()
{
vec2 myVec = getVec2();
vec3 res;
res.v[0] = myVec.v[0];
res.v[1] = myVec.v[1];
res.v[2] = 1;
return res;
}
- - - -
Compiling this with any level of optimization for arm64 gives incorrect code, unless my test case...
2013 Jun 18
1
transform 3 numeric vectors empty of 0/1
Dear all,
Without a loop, I would like transform 3 numeric vectors empty of 0/1 of
same length
Vec1 : transform 1 to A and 0 to ""
Vec2 : transform 1 to B and 0 to ""
Vec3 : transform 1 to C and 0 to ""
to obtain only 1 vector Vec who is the paste of the 3 vectors (Ex : ABC,
BC, AC, AB,...)
Any idea ?
Thank you for your help
--
Michel ARNAUD
2010 Feb 02
1
Finding the difference between two vectors
Hello everyone,
I have two vectors having only one element different:
vector1 vector2
vector1
TWC TWC
TWC
VFC TWX
NA
VIA/B VFC
VFC
2013 Feb 17
1
addition in the initial question
Dear Elisa,
Try this:
vec1<-c(33,18,13,47,30,10,6,21,39,25,40,29,14,16,44,1,41,4,15,20,46,32,38,5,31,12,48,27,36,24,34,2,35,11,42,9,8,7,26,22,43,17,19,28,23,3,49,37,50,45)
vec2<-vec1[1:26]
names(vec2)<-LETTERS[1:26]
label1<-unlist(lapply(mapply(c,lapply(seq(0,45,5),function(x) x),lapply(seq(5,50,5),function(x) x),SIMPLIFY=FALSE),function(i) paste(i[1],"<x<=",i[2],sep="")))
?dat1<-data.frame(vec2,class=cut(vec2,breaks=seq(0,50,5),label...
2008 Sep 20
1
lower and upper limits in integrate as vectors
...values
"integrand" <- function(z)
{
return(z * z)
}
i do this with a for-loop
for(i in 2:4)
{
z <- integrate(integrand, i-1, i)$value
cat("z", z, "\n")
}
to speed up the computation for many values i tried vectors
in integrate to do this.
vec1<-1:3
vec2<-2:4
integrate(Vectorize(integrand), vec1, vec2)$value
but here it seems the integration works only for the first values of
vec1 and vec2.
If you have any advice how i can to this computations with vectors or
something like that, i would be very thankful,
best regards
Andreas
2013 Mar 22
2
A question on function return
Hello again,
Let say I have following user defined function:
fn <- function(x, y) {
Vec1 <- letters[1:6]
Vec2 <- 1:5
return(list(ifelse(x > 0, Vec1, NA), ifelse(y > 0, Vec2, NA)))
}
Now I have following calculation:
> fn(-3, -3)
[[1]]
[1] NA
[[2]]
[1] NA
> fn(3, -3)
[[1]]
[1] "a"
[[2]]
[1] NA
Here I can not understand why in the second case, I get only the first
element &...
2006 Apr 15
1
Removing Rows/Records from a Table
I would like to selectively remove rows from a table.
I had hoped that I could create a table and
selectively add rows with something like
> NewTable<-table(nrow=100, ncol=4)
> NewTable[1,]<-OldTable[10,]
but that doesn't work. The former call gives
> NewTable
ncol
nrow 4
100 1
while the latter call gives a table the length of
OldTable. Making a matrix, m, with the
2011 Jun 03
2
Arules: R Crashes when running eclat with tidLists=TRUE
...------------------------------------------------------------------*/
static void _report_R (int *ids, int cnt, int supp, int *tal, void *data)
{
(...)
if (flags & OF_LIST) {
vec1 = (int*)realloc(ruleset->trnb, size1 *sizeof(int));
if (!vec1) {
if (vec) free(vec);
if (vec2) free(vec2);
_cleanup(); error(msg(E_NOMEM));}
ruleset->trnb = vec1;
}
(...)
if (flags & OF_LIST) { /* if to list the transactions, */
h = ruleset->trtotal;
if (supp < 0) { /* if bit vector representation */
for (i = 0; i < tacnt; i++) {...
2009 Feb 25
2
: record which entry in one file doesn't appear in a different file
Hi dear list,
If anybody could help me, it would be great!
I have two files:
File 1 is a list (one column and around 100000 rows)
File 2 is a list with all the names from file one and a few more (one
column and more than 100000 rows)
What I want is to add a column in file 2 that says which name appeared
in file 1 and which doesn't (yes and no would work as a code)
It's very important to
2015 May 04
2
[LLVMdev] Incorrect code generated for arm64
...my codebase that return small (length 2 or 3) Vector types - generally in headers so they can be inlined an optimized well - but I’d definitely like to understand the root cause of this one so I can be on the lookout for any other similar failures.
Simon
>
> typedef struct {float v0, v1;} vec2;
> typedef struct {float v0, v1, v2;} vec3;
>
> vec2 getVec2();
>
> vec3 getVec3()
> {
> vec2 myVec = getVec2();
>
> vec3 res;
> res.v0 = myVec.v0;
> res.v1 = myVec.v1;
> res.v2 = 1;
> return res;
> }
>
> .section __TEXT,__text,regula...