search for: myvec

Displaying 20 results from an estimated 31 matches for "myvec".

2007 Sep 16
1
programming question
Dear list, I have a vector of numbers, let's say: myvec <- c(2, 8, 24, 26, 51, 57, 58, 78, 219) My task is to reduce this vector to non-reducible numbers; small numbers can cross-out some of the larger ones, based on a function let's say called reduce() If I apply the function to the first element 2, my vector gets shorted to: > (myvec &lt...
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 above is triggering some undefined behaviour that I’m not aware of. Other architect...
2011 Aug 31
1
formatting a 6 million row data set; creating a censoring variable
..., "id"), class = "data.frame", row.names = c(NA, -20L)) # here is plyr solution with idata.frame library(plyr) imyData <- idata.frame(myData) timeData <- idata.frame(ddply(imyData, .(id,mygroup), summarize, mytime = length(mygroup))) makeCensor <- function(x) { myvec <- rep(0,length(x)) lastInd <- length(myvec) myvec[lastInd] = 1 myvec } plyrSolution <- ddply(timeData, "id", transform, censor = makeCensor(mygroup)) # here is a data table solution # use makeCensor function from above library(data.table) mydt <- data.table(myDa...
2008 Jun 23
2
Writing Vector to a File
Dear experts, I try not to trouble the list again after this question. I want to print this vector into a file > myvec [1] --Control --Control --Control --Control --Control HBA2 HBA1 [8] HBA1 --Control HBB --Control HBB HBA1 MBP [15] --Control HBA1 HBA2 HBB PTGDS GAPDH UBC [22] --Control GAPDH TPT1 HUWE1 PRM1 CKM OPHN1 [29] GAPDH...
2007 Jan 30
6
jump in sequence
Dear list, This should be a simple one, I just cannot see it. I need to generate a sequence of the form: 4 5 6 13 14 15 22 23 24 That is: starting with 4, make a 3 numbers sequence, jump 6, then another 3 and so on. I can create a whole vector with: myvec <- rep(rep(c(F, T, F), rep(3, 3)), 3) Then see which are TRUE: which(myvec) [1] 4 5 6 13 14 15 22 23 24 I'd like to avoid creating the whole vector if possible; for very large ones it can be time consuming. There should be a way to only create the proper indexes... Thanks for any hint...
2003 Feb 20
3
outliers/interval data extraction
Dear R-users, I have two outliers related questions. I. I have a vector consisting of 69 values. mean = 0.00086 SD = 0.02152 The shape of EDA graphics (boxplots, density plots) is heavily distorted due to outliers. How to define the interval for outliers exception? Is <2SD - mean + 2SD> interval a correct approach? Or should I define 95% (or 99%) limit of agreement for data interval,
2015 May 04
2
[LLVMdev] Incorrect code generated for arm64
...- 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,regular,pure_instructions > .globl _getVec3 > .align 2 > _getVec3: ; @getVec3 > ; BB#0:...
2012 Oct 31
1
ffdfindexget from package ff
I'm having trouble getting ffdfindexget to work right in Windows. Even the most trivial of examples gives me problems. > myVec = ff(1:5) > another = ff(10:14) > littleFrame = ffdf(myVec, another) > posVec = ff(c(2, 4), vmode = 'integer') > ffdfindexget(littleFrame, posVec) Error in if (any(B < 1)) stop("B too small") : missing value where TRUE/FALSE needed In addition: Warning message: In...
2011 Apr 05
1
do not execute newline command
Hi R-users, To automate the creation of scripts, I converted the code (example below) into a character string and wrote the object to a file: Repeat <- " myvec <- c(1:12) cat('vector= ', myvec, '\n') " write (Repeat, 'yourpath/test.R') the problem is that one line of the code is a "cat" command. In the output file (i.e. test.R), the newline symbol gets executed and I don't want that. Any idea on how to do t...
2011 Jan 19
1
Printing "pretty' vectors in Sweave
...print a nice looking vector in Sweave. c <- 1:4 I want to see (1, 2, 3, 4) in TeX. . If I use paste(c, ",", sep="") I get "1," "2," "3," "4," If use cat(c, sep=",") I can't seem to assign it to an object, 1,2,3,4> myvec <- cat(c, sep=",") 1,2,3,4> myvec NULL and if I bypass the object assignment and put "My vector is (\Sweave{cat(c, sep=",")}). " prints out "My vector is (). " Suggestions? Robin Jeffries MS, DrPH Candidate Department of Biostatistics UCLA 530-624-0...
2009 Dec 20
1
How to put text outside an xyplot?
...th the code below. I tried to put some text to the right of the color key. I worked with grid.text and also viewport(), but couldn't achieve this. I know this should be simple, but I just couldn't figure out how to do it. How does this work? Cheers, Marius library(lattice) library(grid) myvec=1:10 data=data.frame(x=myvec,y=myvec) mygray=function(l) gray(seq(0.2,0.8,length=l)) colors=level.colors(data[1:10,2],at=do.breaks(c(1,10),10),col.regions=mygray) colorvec=colors[1:10] #trellis.device(postscript,color=F,horizontal=F,onefile=F) xyplot(data[,2]~data[,1],aspect=1, panel=function(...)...
2012 Jun 15
0
argument "x" is missing, with no default - Please help find argument x
..., ntrees=ntrees) { nfolds<- 10 # shuffle the numbers and divide into 10 groups numberOfRows<-dim(ml.frame)[1] lengthOfDiv<-numberOfRows/nfolds shuffled<-sample(c(1:numberOfRows), numberOfRows, replace=F) rownumber<-split(shuffled, 1:nfolds) #combine mymean into my vec myvec<-foreach (i = 1:length(rownumber), .combine="rbind") %dopar% bottomloop(i, mtry = mtry, rownumber=rownumber, ntrees=ntrees, shuffled=shuffled) #print(myvec) return(myvec) } toploop <- function (ntrees=ntrees, ml.frame=ml.frame) { require(foreach) require(ggplot2) require(...
2007 Sep 21
3
Q: appending to non-existent vector?
This is a real newbie question. What makes it worse is that I know I've seen the answer somewhere, but I can no longer find it. If I have a loop that is supposed to generate a vector piecemeal, adding an element each time through the loop, what do I do to stop it failing the first time around the loop, when the vector doesn't yet exist (so I can't use the append() function)?
2007 Mar 01
7
count the # of appearances...
Hi there, is there a possibility to count the number of appearances of an element in a vector ? i mean of any given element.. deliver all elements which are exactly xtimes in this vector ? thx in advance !!
2013 Nov 21
1
[PATCH] suggestions for R-lang manual
...ot; be returned by "typeof()" ? Regarding the "Recycling rules" section, -One exception is that when adding vectors to matrices, a warning is not -given if the lengths are incompatible. - at c Is that a bug? - was this a bug that was fixed? I see the following behavior: > myvec <- 1:3 > mymat <- matrix(1:12, ncol=2) > myvec <- 1:5 > myvec + mymat [,1] [,2] [1,] 2 9 [2,] 4 11 [3,] 6 13 [4,] 8 15 [5,] 10 12 [6,] 7 14 Warning message: In myvec + mymat : longer object length is not a multiple of shorter object length >...
2011 Aug 24
3
Efficient way to Calculate the squared distances for a set of vectors to a fixed vector
I am pretty new to R. So this may be an easy question for most of you. ? I would like to calculate the squared distances of a large set (let's say 20000) of vectors (let's say dimension of 5) to a fixed vector. ? Say I have a data frame MY_VECTORS with 20000 rows and 5 columns, and one 5x1 vector y. I would like to efficiently calculate the squared distances?between each of the 20000
2013 Oct 15
2
A 'good' way to build a matrix from a sequence of integers?
# I understand that a good way to build a vector from a sequence of integers, # is to use syntax like this: myvec = c(1:99) # Here is the 'short' version of my question: # I want to understand a 'good' way to build a matrix from a sequence of integers. # If that question is not clear, here is a longer version: # Here is what I did for a 1D-matrix: # I pick the sequence 1:3 # I build a vecto...
2011 Aug 16
0
[LLVMdev] Problem I have to run a llvm module pass from main function
I need to integrate my module pass with someone else's flow. My pass should be run inside the main() of their flow to generate the information needed for other functions. My pass is declared as: MyVec: public ModulePass { ... } I used to build it into a loadable module for "opt" and it works. Right now, in the main function, I call the MyVec pass with the new method: main() { ... llvm::ModulePass* V = new MyVec(); V->runOnModule(M); ... } But the linking process reports: llvm[0]:...
2010 Mar 10
1
How can I sort a character type vector?
Dear All, I want to sort a character type vector. the vector is [1] 4 5 6 8 9 11 Y 1 13 15 16 20 X 2 3 10 14 19 XY 7 12 18 17 22 [25] 21 and I want to sort 1-22 X Y XY or 1-22 X XY Y. How can I do that? Thanks,
2011 Dec 21
2
unique combinations
Hi there, I have a vector and would like to create a data frame, which contains all unique combination of two elements, regardless of order. myVec <- c(1,2,3) what expand.grid does: 1,1 1,2 1,3 2,1 2,2 2,3 3,1 3,2 3,3 what I would like to have 1,1 1,2 1,3 2,2 2,3 3,3 Can anybody help?