Displaying 20 results from an estimated 2000 matches similar to: "problem with merging two matrices"
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...
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
2008 Jun 13
1
x86 SSE* Pointer Favors
Dear Statisticians--- This is not even an R question, so please
forgive me. I have so much ignorance in this matter that I do not
know where to begin. I hope someone can point me to documentation
and/or a sample.
I want to compute a covariance as quickly as non-humanly possible on
an Intel core processor (up to SSE4) under linux. Alas, I have no
idea how to engage CPU vectorization. Do I need
2009 Apr 03
1
Hello! I got error in C - R
Hello,
My name is Ick Hoon Jin and I am Ph. D. student in Texas A & M Univ..
When I run the C embedded in R in the Linux system, I confront the
following error after 6,000 iteration. By googling I found this error is
from the problem in C.
*** caught segfault ***
address (nil), cause 'memory not mapped'
My C code is following:
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
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 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
2010 Jan 30
2
parsing files for plot
Hi,
I have many files containing one column of data. I like to use the scan
function to parse the data. Next I like to bind to a large vector.
I try this like:
count<-1
files <- 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.
2013 Sep 08
0
Fwd: Bienvenido a la lista de distribución R-help-es
por favor
como se calculan las probabilidades para conformar el segundo vector
SI.Distr, en este ejemplo puse la existente en SARS2003
#Análisis paso a paso
rm(list = ls())
#existe información de la incidencia de casos de una enfermedad
incidencia <-c (1,0,0,0,0,0,0,0,2,1,1,0,1,2,0,2,0,2,2,2,3, 1, 2, 0,2,
0, 1, 1, 2, 1, 1, 2, 3, 0, 1, 2, 0, 2, 1, 3, 1, 6, 3, 3,7, 4,
4, 3, 6,
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", or "[un]subscribe"
(in
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
2008 Jan 08
1
plotting help request II
Dear all,
meanwhile 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
2009 Aug 18
2
Embedding lists in matrices and matrices in lists
Hi,
I'm new to programming, new to R and even new to mailing lists so please
be patient with me. I need to manage many matrices generated by an R
program. These matrices have different dimensions and I'd like to group
them somehow. The best way would be to have a big matrix (let's call it
database) where every element database[x,y] consists of a list of
matrices that all have the
2012 Mar 30
1
avoiding expression evaluation when calling a function
Another question on functions - I have something that looks like
plotter<-function(i){
temp.i<-rwb[rwb$vector1 <=(i*.10),]
with(temp.i, plot(vector2, vector3, main=(i*.10),))
mod<-lm(vector3~vector3-1,data=temp.i)
r2<-summary(mod)$adj.r.squared
rsqrd[i]<-r2
legend("bottomright", legend=signif(r2), col="black")
abline(mod)
rsqrd<<-rsqrd
}
I'd
2009 Feb 26
0
How do I retrieve column and row names after comparing two matrices?
Hello, I have two matrices as shown below:
Matrix 1
ID AB1 BC1 CD1 ...
name1 1,1 2,1 0,2 ...
name2 2,0 1,2 1,2 ...
name3 0,2 1,1 2,0 ...
name4 2,0 0,2 0,2 ...
Matrix 2
ID AB2 BC2 CD2 ...
name1 1,1
2007 May 04
2
Get the difference between two matrices with different length
Hello,
I have got two matrices with different length. The matrices have 3
columuns. The first two are coordinates. The third is a measurement.
Now I want to get a subtraction between every single value of the
third column (between matrix1 and matrix2), but only if the two
first coordinates in matrix1 and matrix2 are the same.
I tried "FUN=?" in aggregate and ave, but I don't know
2010 Oct 23
1
bind matrices by row
Hi R-users
I have a series of matrices and I would like to bind them together by
column using a loop (i.e. not writing cbind(matrix1,
matrix2,matrix3....)). The reason is because in my real data set I have
a very large number of matrices.
Example:
matrix1 <- matrix (1:12,4,3)
matrix2 <- matrix (13:24,4,3)
matrix3 <- matrix (25:36,4,3)
matrix4 <- matrix (37:48,4,3)
2012 Sep 19
4
correlating matrices
Hi,
thank you for taking the time and reading my question. My question is
twofold:
1. I have several matrices with variables and one matrix with water levels.
I want to predict the water level with the data in the other matrices.
Basically,
* mod<-lm(matrix1 ~ matrix2+matrix3)*
( What looks like a minus is meant to be the wiggly minus.)
Of course I could dissemble the matrices and paste
2011 Jul 29
3
Problems with ks.test()
Hi,
I got two data point vectors. Now I want to make a ks.test(). I you print
both vectors you will see, that they fit pretty fine. Here is a picture:
http://www.jochen-bauer.net/downloads/kstest-r-help-list-plot.png
As you can see there is one histogram and moreover there is the gumbel
density
function plotted. Now I took to bin-mids and the bin-height for vector1 and
computed the
2005 Sep 27
1
Simulate phi-coefficient (correlation between dichotomous vars)
Newsgroup members,
I appreciate the help on this topic.
David Duffy provided a solution (below) that was quite helpful, and came
close to what I needed. It did a great job creating two vectors of
dichotomous variables with a known correlation (what I referred to as a
phi-coefficient).
My situation is a bit more complicated and I'm not sure it is easily
solved. The problem is that I must