search for: myvector

Displaying 20 results from an estimated 40 matches for "myvector".

2012 Mar 10
2
Window on a vector
Dear all, I have a large vector (lets call it myVector) and I want to plot its value with the logic below yaxis<-myVector[1] yaxis<-c(xaxis,mean(myvector[2:3]) yaxis<-c(xaxis,mean(myvector[4:8]) yaxis<c(xaxis,mean(myvector[9:16]) yaxis<c(xaxis,mean(myvector[17:32]) this has to stop when the new ..... yaxis<c(xaxis,mean(myvector[1024...
2013 Aug 27
1
R Language Newbie
Hi, set.seed(29) myVector<- rnorm(100) ?seq(1,100,by=2) # [1]? 1? 3? 5? 7? 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49 #[26] 51 53 55 57 59 61 63 65 67 69 71 73 75 77 79 81 83 85 87 89 91 93 95 97 99 myVector[seq(1,100,by=2)] rev(myVector) ?sum(myVector>0) #[1] 46 #or ?table(myVector>0) # #F...
2007 Dec 18
6
All anchored series from a vector?
>From: Johannes Graumann <johannes_graumann at web.de> >Date: 2007/12/18 Tue PM 04:40:37 CST >To: r-help at stat.math.ethz.ch >Subject: [R] All anchored series from a vector? lapply(1:length(myvector) function(.length) { c(myvector[1}:myvector[.length]) }) but test it because i didn't. >Hi all, > >What may be a smart, efficient way to get the following result: > >myvector <- c("A","B","C","D","E") >myseries <- mir...
2012 Feb 26
6
loop for a large database
Yes, I am a newbie. I have a data.frame (MyTable) of 1445846 rows and 15 columns with character data. And a character vector (MyVector) of 473491 elements. I want simply to get a data.frame with the count of how many times each element of MyVector appears in MyTable. I've tried a loop with : for (i in 1 : length (myvector)) sum (MyTable== i) but it crashes my computer. I've also tried something like x <- 1 : le...
2008 Nov 06
2
Fwd: SWIG with R and C++ STL
...essage ---------- From: charlie <charlie.xia.fdu@gmail.com> Date: Tue, Nov 4, 2008 at 1:55 PM Subject: SWIG with R and C++ STL To: swig-user@lists.sourceforge.net Hi all, I am new to SWIG. I encountered some problem when I try to SWIG to R some C++ modules. Here is the details. I got "myvector.i" and "myvector.h" as my two input files, the contends are: ---myvector.i----- %module myvector %{ #include "myvector.h" %} %include "std_vector.i" namespace std { %template(IntVector) vector<int>; %template(DoubleVector) vector<double>; };...
2009 Feb 15
1
Overloading in R
...to write a new class that reimplements the vector class. As a test of my overloading I decided to try and and call t.test on two vectors which were objects of my class rather than the default class. The overloaded length I wrote seems to work correctly. I used setMethod("length", "myvector", ...) setMethod("mean", "myvector", ...) setMethod("var", "myvector", ...) and created an object myv <- new("myvector",...) and when I called t.test(myv, myv) it first failed in the line mx <- mean(x) with the error that "x is...
2006 Apr 04
2
Selecting out certain values from a MATRIX
I have two objects, one matrix and one vector. I want to use my vector to subset certain values out of my matrix. For example: I want to tell R, to select out all rows in myMatrix into a new myMatrix2 IF that corresponding row is less than a 0.5 in myVector. So: myMatrix = a matrix of 8000 by 20 myVector = vector of 8000 myMatrix2 = a matrix of < 8000 by 20 (based on selection criteria in myVector) I hope this makes sense.. [[alternative HTML version deleted]]
2006 Mar 06
4
Contingency table and zeros
Hello, Let's assume I have a vector of integers : > myvector <- c(1, 2, 3, 2, 1, 3, 5) My purpose is to obtain the cumulative distribution of these numerical data, i.e. something like : value nb_occur. <=1 2 <=2 4 <=3 6 <=4 6 <=5 7 For this, I create a table with ; > mytable <- table(myvector) 1 2 3 5 2 2 2 1 Ho...
2008 Aug 22
1
grep, gsub and metacharacters
Hello, I have an expression that I want to substitute for something else. myvector<-c("ajkhfkiuwe","Variable(kg/min)") if I use the following code to extract "variable(kg/min)" and substitute it for "va" gsub(myvector[grep("var", myvector, ignore=T)], "va", myvector) grep identifies the element of the vector that...
2011 Sep 30
3
is member
Dear all, I have a vector with number that some of them are part of the   seq(1,800,4). How can I check which of the numbers belong to the seq(1,800,4)   LEt's say that is called myvector the vector with the numbers. Is there in R something like this? is.member(myvector,seq(1,800,4))   I would like to thank you in advance for your help   B.R Alex [[alternative HTML version deleted]]
2012 Jan 16
3
list: index of the element, that is TRUE
Dear People, I have got the following example for a vector and the index of the TRUE element: Myvector <- c(FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,TRUE) which(Myvector) Now I would like to find out the same for a list: Mylist <- list(FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,TRUE) ... Does anyone know how to do this? Thank you very much in advance, Marion [[alternative HTML version d...
2009 Aug 25
3
Regular expression to define contents between parentheses
Hello dear R-helpers, I haven't been able to figure out of find a solution in the R-help archives about how to delete all the characters contained in groups of parenthesis. I have a vector that looks more or less like this: myvector<-c("something (80 km/h, sd) & more (6 kg/L,sd)", "somethingelse (48 m/s, sd) & moretoo (50g/L , sd)") I want to extract all the strings that are not contained in parenthesis, the goal would be to obtain the following new vector: subvector<-c("something &...
2012 Mar 14
1
check for data in a data.frame and return correspondent number
...red-j 9.3749 appearance ground-n red-j 10.2167 appearance sea-n red-j 10.8200 appearance sky-n red-j 9.2831 area chicken-n red-j 8.2838 area color-n and a MyVector which includes also (but not only) the data in the 3rd column: " appearance blood-n" " appearance ground-n" "appearance sea-n" "as_adj_as fire-n"...
2008 Jul 10
2
Finding Values that Occur Most Often in a Vector
Hi, Is there a way to do it? For example I have the following vector: > print(myvector) > [1] -295.8045 -295.8045 -295.8045 -295.8045 -325.4754 -295.8045 -295.8045 [8] -295.8045 -413.2099 -295.8045 I want it to return -295.8045, which occur most often. - Gundala Viswanath Jakarta - Indonesia
2008 Aug 11
4
how can I do this sum?
Hi, Suppose I have a vector in real number (x1, x2, x3, x4, x5, x6) My question is how I can get x5*x3*x1 + x6*x4*x2 ? Thanks a lot. Dot. -- View this message in context: http://www.nabble.com/how-can-I-do-this-sum--tp18931693p18931693.html Sent from the R help mailing list archive at Nabble.com.
2009 May 28
1
custom sort?
Sounds simple but haven't been able to find it in docs: is it possible to sort a vector using a user-defined comparison function? Seems it must be, but "sort" doesn't seem to provide that option, nor does "order" sfaics -- View this message in context: http://www.nabble.com/custom-sort--tp23770565p23770565.html Sent from the R help mailing list archive at Nabble.com.
2011 Sep 29
1
multiplying list with vector
hello everybody, i have got a question about lists: i have got the following commands: mylist <- list("v1"=c(1,2,2,1),"v2"=c(2,2,2,1),"v3"=c(1,1,1,1)) myvector <- c(100,10000,1000000) now i would like to multiply each element of the list with the corresponding element of the vector, that is to say: v1*100 v2*10000 v3*1000000 i only could think of lapply which can only be used to multiply each element of the list with the same number, i think. thank y...
2009 May 28
1
custom sort?
Sounds simple but haven't been able to find it in docs: is it possible to sort a vector using a user-defined comparison function? Seems it must be, but "sort" doesn't seem to provide that option, nor does "order" sfaics -- View this message in context: http://www.nabble.com/custom-sort--tp23770565p23770565.html Sent from the R help mailing list archive at Nabble.com.
2008 Jun 23
2
Pairwise Partitioning of a Vector
Hi, How can I partitioned an example vector like this > print(myvector) [1] 30.9 60.1 70.0 73.0 75.0 83.9 93.1 97.6 98.8 113.9 into the following pairwise partition: PAIR1 part1 = 30.9 part2 = 60.1 70.0 73.0 75.0 83.9 93.1 97.6 98.8 113.9 PAIR2 part1 = 30.9 60.1 part2 = 70.0 73.0 75.0 83.9 93.1 97.6 98.8 113.9 ....
2009 Nov 24
4
Method
Hello, i would like to ask you another question. Is exist anymethod to vectors that tells me the last element?That is to say,I have a vector, I want to return the position of last element. I hope having explained. A greeting, Ignacio. -- View this message in context: http://old.nabble.com/Method-tp26493442p26493442.html Sent from the R help mailing list archive at Nabble.com.