search for: vector1

Displaying 20 results from an estimated 32 matches for "vector1".

Did you mean: vector
2008 Nov 08
4
missing value where TRUE/FALSE needed
Hello dear R people, for my MSc thesis I need to program some functions, and some of them simply do not work. In the following example, I made sure both vectors have the same length (10), but R gives me the following error: Error in if (vector1[i] == vector2[j]) { : missing value where TRUE/FALSE needed I googled for possible solutions, but I did not find a good explanation for this... The code: test <- function() { vector1 <- sample(1:100,10) vector2 <- sample(1:100,10) for (i in vector1) {...
2012 Jul 30
4
A "matching problem"
Dear all, I was encountering with a typical Matching problem and was wondering whether R can help me to solve it directly. Let say, I have 2 vectors of equal length: vector1 <- LETTERS[1:6] vector2 <- letters[1:6] Now I need to match these 2 vectors with all possible ways like: (A,B,C,D,E) & (a,b,c,d,e) is 1 match. Another match can be (A,B,C,D,E) & (b,a,c,d,e), however there cant be any duplication. Is there any direct way to doing that in R? Thanks...
2005 Jun 20
3
vectorisation suggestion
Hi All, I am counting the number of occurrences of the terms listed in one vector in another vector. My code runs: for( i in 1:length(vector3)){ vector3[i] = sum(1*is.element(vector2, vector1[i])) } where vector1 = vector containing the terms whose occurrences I want to count vector2 = made up of a number of repetitions of all the elements of vector1 vector3 = a vector of NAs that is meant to get the result of the counting My problem is that vector1 is about 60000 terms, and vect...
2005 Sep 09
2
Simulate phi-coefficient
Looking for help with the following problem. Given a sample of zeros and ones, for example: > VECTOR1<-rep(c(1,0),c(15,10)) > VECTOR1 [1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 How would I create a new sample (VECTOR2) also containing zeros and ones, in which the phi-coefficient between the two sample vectors was drawn from a population with a known phi-coefficient value?...
2002 Jan 16
4
faster vector subtraction??
hi is there a faster way to do this? i <- 1 for(x in vector1) for(y in vector2) { m[[i]] <- (x - y) i <- i + 1 } regards soren -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help"...
2010 Jan 30
2
parsing files for plot
...lt;- list.files() # all files in the working directory for(i in files) { tmp <- scan(i) assign(files[count], tmp) count<-count+1 } This part works! Now I like to plot the data in a boxplot. Usually I do this from individual vectors like: comb <- data.frame(dat = c(vector1, vector2 ......), ind = c(rep('vector1', length(vector1)).......)) boxplot(dat ~ ind, data = comb) But how do I do this i a loop? I know the vector names (according to the filenames in the working directory), but I do not how to access them in my R code after having assigned the names. I...
2003 Aug 26
3
matching-case sensitivity
Hi All, I am trying to match two character arrays (email lists) using either pmatch(), match() or charmatch() functions. However the function is "missing" some matches due to differences in the cases of some letters between the two arrays. Is there any way to disable case sensitivity or is there an entirely better way to match two character arrays that have identical entries but written
2008 Jun 13
1
x86 SSE* Pointer Favors
...ot; correct? Does SSE* understand NaN? Should I rely on gcc autodetection of the vectorized meaning of my code, or are there specific libraries that I should call? What I want to learn about is as simple as it gets: typedef double Double; // or whatever SSE* needs as close equivalent Double vector1[N], vector2[N]; // then fill them with stuff. vector3= vector_mult(vector1,vector2, N); vector4= sum(vector1, N); I just need a pointer and/or primer. PS: If someone knows of a superfast vectorized implementation of Gentleman's WLS algorithm, please point me to it, too. I am still usin...
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...
2012 Mar 14
1
list factoring
...would try it this route instead!... I appreciate the reading Thank you. If i have: matrix: > var1 var2 var3 > cell1 x x x > cell2 x x x > cell3 x x x > > cell4 > > . > . > . > . > cell100 and: vector1 <- c("cell1, "cell5",cell19", "cell50", "cell70") your_data$mycells <- factor(your_data$cells %in% vector1, c("Special", "NotSpecial")) So my output will be something like: [25] Special Special Special Special Special...
2009 Apr 03
1
Hello! I got error in C - R
...) : (Y)) void SecondMH(int *n, int *X, int *length_X, double *theta_new, int *n_para, double *out); int MH_Result(double *theta_new, int n_para, int *M1, int *M2, int n); double Count_Edges(int *X, int n); double Cal_GWD(int *X, int n); int Cal_Degree(int *M3, int n); double Inner_Product( double *vector1, double *vector2, int length); int rdtsc(); void SecondMH(int *n, int *X, int *length_X, double *theta_new, int *n_para, double *out) { int i, j, a, k; int *M1, *M2; M1 = (int *)calloc(*length_X, sizeof(int)); M2 = (int *)calloc(*length_X, sizeof(int)); for(i = 1; i < *n; i++) { for(j...
2013 Sep 04
3
Fwd: Bienvenido a la lista de distribuciĆ³n R-help-es
Hola Jose, si CONCATENAR significa APILAR, es decir, concantenar verticalmente, por decirlo de algun modo, podrias hacerlo con rbind(): nuevovector <- rbind(vector1,vector2) Si ademas quieres que cada valor de los vectores originales sea identificado en el nuevovector, puedes usar: nuevovector <- stack(vector1,vector2) en este ultimo caso se agrega una columna adicional tipo factor, con el nombre de la columna de los vectores originales. lo demas no lo...
2000 Jun 17
2
R 1.1.0 for Windows
Windows binaries at CRAN (bin/windows/Windows-NT/base) have been updated to R-1.1.0. See below for a list of Windows-specific changes. We thanks all the people who checked over pre-test versions. guido masarotto (for the R-core team) Windows-specific changes to R ============================= There is now a GUI preferences editor on the Edit menu in Rgui. A data entry editor is now
2000 Jun 17
2
R 1.1.0 for Windows
Windows binaries at CRAN (bin/windows/Windows-NT/base) have been updated to R-1.1.0. See below for a list of Windows-specific changes. We thanks all the people who checked over pre-test versions. guido masarotto (for the R-core team) Windows-specific changes to R ============================= There is now a GUI preferences editor on the Edit menu in Rgui. A data entry editor is now
2002 May 02
2
General "moving" functions
...y just started writing my own R functions. However, I need some help for something which I'm sure is quite straight forward. I want to write a function that will allow me to calculate "moving results" for a given vector. Ideally, the function will be of the form foo<-function(vector1, funcname, lag) { } for example, if I use arguments : funcname = mean lag = 10 Then foo will return a vector of 10 day moving average Many Thanks _________________________________________________________________ -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-....
2012 Mar 13
2
sort list
Hello can anyone help please? i read two words "cell1", "cell2" into a list. I want to turn this list into a factor. > cell_data <-list(c('cell1','cell2')) > cell_data [[1]] [1] "cell1" "cell2" > factor_list <- factor(cell_data) Error in sort.list(y) : 'x' must be atomic for 'sort.list' Have you called
2008 Jan 08
1
plotting help request II
...le i found out how to handle the coordinate thing and plot the lines like i like. the remaining problem is, i need something like names.arg does in barplot for my plot. my plot connects several dots with several lines. and now i like characters as the names of the intersects of the x-axis. vector1=c(a,b) vector2=c(c,d) # this vector makes sure the yellow line starts at x=2 x=c(2,3) plot(vector,type="b",col="blue",xlim=c(1,4),ylim=c(20,150)) lines(x,fc,col="yellow") does anybody know how to label the x-axis 1st quarter 2nd quarter 3rd quarter and 4th quarte...
2007 Jun 20
2
Computing time differences
Dear R users, I have a problem computing time differences using R. I have a date that are given using the following format: 20080620.00, where the 4 first digits represent the year, the next 2 ones the month and the last 2 ones the day. I would need to compute time differences between two vectors of this given format. I tried around trying to change this format into any type of time serie
2011 Nov 02
1
problem with merging two matrices
Dear all, I hope you can forgive me my stupid questions, but I am a very new R user (; So, this is my question: I have two matrices, those are: matrix1 <- matrix(cbind(vector1, vector2), 1,2, dimnames = list(c("values"), c("T value", "p value"))) matrix2 <- matrix(dcbind,2,6,dimnames = list(c("x", "y"), c("Min",...
2008 Mar 19
3
How to remove double for loop?
Hello everyone. I use double for loops to fill in matrices, but there are surely better (and computationally faster) ways to perform that task. Could someone show me, given the following example of a double for loop, how this could be done? It is much easier to learn by examples. Val <- matrix(0, nrow=n+1, ncol=n+1) for( i in 0:n){ for(j in 0:i){ Val[j+1, i+1] <- u^j*d^(i-j)