Displaying 20 results from an estimated 4000 matches similar to: "How to match vector with a list ?"
2004 Nov 04
3
keep dimension of a sub matrix
Hi,
is there any way to keep a sub matrix dimension?
exemple :
i1<-1; i2<-1
j1<-2; j2<-3;
ret <-matrix(1,4,4)[i1:i2,j1:j2] ;
dim(ret) is NULL because the submatrix single col or single row is coerce to a vector automaticaly.
How can i bypass this cast : submatrix->vector ???????
Thank you.
---------------------------------
[[alternative HTML version
2006 Nov 22
1
how to merge these dataframes
Hi,
Having 3 dataframes with different row numbers, but equal column names
(see below) I want to merge them by Var1 so I've tried:
merge(j1,j2,j3,by="Var1")
merge(j,j1,j2,by=names("Var1"))
But always got the same message:
Erro en fix.by(by.x, x) : 'by' must specify column(s) as numbers, names
or logical
What I'm doing wrong?
Thanks,
Antonio
j1
2008 Sep 16
1
Car.proper C[] matrix
I am hoping someone can help translate some WinBUGS code into R code. I
would like to use R to create the C[] matrix required for a car.proper
model in WinBUGS, but I am having a difficult time negotiating the
coding. The C matrix provides normalized weights for each pair of
spatial areas. So the WinBUGS example is as follows:
# of the weight matrix with elements Cij. The first J1 elements
2007 Mar 09
1
Applying some equations over all unique combinations of 4 variables
#I have a data set that looks like this. A bit more
complicated actually with
# three factor levels but these calculations need to
be done on one factor at a
#I then have a set of different rates that are applied
#to it.
#dataset
cata <- c( 1,1,6,1,1,2)
catb <- c( 1,2,3,4,5,6)
doga <- c(3,5,3,6,4, 0)
data1 <- data.frame(cata, catb, doga)
rm(cata,catb,doga)
data1
# start rates
#
2002 Feb 22
3
Cent. Mov. Ave
Dear R People:
Here is an interesting question(I think)
Suppose I want to calculate Centered Moving Averages; i.e.
x[1] <- ( sum(y[1:12]) )/12
x[2] <- ( sum(y[2:13]) )/12
and so on.
Of course, this is easily done through loops. However, I have
been trying to do this more elegantly, but have failed. I have
tried things like
j1 <- 1:109
j2 <- 12:120
x[1:109] <- ( sum( y[j1:j2])
2006 Jun 07
2
help with combination problem
hello:
I have 3 data.frame objects.
First df object:
Of dim (149,31). Columns 2:31 are marked as T1..T14
and N1..N16.
Name T1 T2 N1 T3 N2 N3 N4 T4
mu1 10 10 9 10 9 9 8 10
mu2 11 11 9 11 9 9 9 11
...
muN 12 12 9 11 9 9 8 12
Second df object:
of Dim (50000,31). Columns 2:31 are maked as T1...T14
and N1..N16.
2016 Sep 17
7
Benchmark LNT weird thread behaviour
Hi James/Chris,
You guys have done this before, so I'm guessing you can help me
understand what's going on.
If my buildbot config is:
jobs=2,
nt_flags=['--cflag', '-mcpu=cortex-a15', '--use-perf', '--threads=1',
'--build-threads=4']
It uses -j4 for build, -j2 for running the tests:
2015 Jan 20
6
[LLVMdev] Basic AliasAnalysis: Can GEPs with the same base but different constant indices into a struct alias?
Hi all,
This is covered by (struct-path aware) TBAA, but BasicAA disagrees.
See the attached testcase, where it prevents us from removing the
redundant load.
For arbitrary GEPs, we can't decide based on constant indices (because
of e.g., &A[0][1] and &A[1][0], with *A a one-element array). BasicAA
has some logic to "try to distinguish something like &A[i][1] against
2001 Apr 15
2
data manipulation in R
Dear List:
I have a data manipulation problem that I was unable
to solve in R. I did it in SQL, and it may be that
the solution in R is to do it in SQL, but I wondered
if people could imagine a vector-based solution.
Imagine a list A[i] of observers who observe some set
of events B[j]. Each observer i may observe one or
more events, and each event j may have been observed
by one or more
2017 Jun 01
3
Reversing one dimension of an array, in a generalized case
Here is an alternative approach using apply(). Note that with apply() you are reversing rows or columns not indices of rows or columns so apply(junk, 2, rev) reverses the values in each column not the column indices. We actually need to use rev() on everything but the index we are interested in reversing:
f2 <- function(a, wh) {
dims <- seq_len(length(dim(a)))
dims <-
2011 Oct 06
3
Wide to long form conversion
I have some data 'myData' in wide form (attached at the end), and
would like to convert it to long form. I wish to have five variables
in the result:
1) Subj: factor
2) Group: between-subjects factor (2 levels: s / w)
3) Reference: within-subject factor (2 levels: Me / She)
4) F: within-subject factor (2 levels: F1 / F2)
5) J: within-subject factor (2 levels: J1 / J2)
As this is the
2017 Jun 01
0
Reversing one dimension of an array, in a generalized case
??
> z <- array(1:24,dim=2:4)
> all.equal(f(z,3),f2(z,3))
[1] "Attributes: < Component ?dim?: Mean relative difference: 0.4444444 >"
[2] "Mean relative difference: 0.6109091"
In fact,
> dim(f(z,3))
[1] 2 3 4
> dim(f2(z,3))
[1] 3 4 2
Have I made some sort of stupid error here? Or have I misunderstood
what was wanted?
Cheers,
Bert
Bert Gunter
2004 Oct 15
2
combine many .csv files into a single file/data frame
Dear R users,
I have a few hundred .csv files which I need to put
together (full outer joins on a common variable) to do a
factor analysis. Each file may contain anywhere from a few
hundred to a few thousand rows. What would be the most
efficient way to do this in R? Please include some sample
code if applicable.
Thank you,
b.
2011 Aug 31
2
Classifying values by interval
Greetings All!
As is often the case on this list, the answer may well
be under my nose but I can't see it!
I am looking for a "smart" way to do the following.
Say I have a vector of values, X. I set up bins" for X,
say with breaks at B = c(b1,b2,...,b11) covering the
range of X, i.e. bins numbered 1:10. The value x is in
bin i if B[i] < x <= B[i+1]
What I seek is a
2012 Feb 15
2
[LLVMdev] Performance problems with FORTRAN allocatable arrays
I've noticed that LLVM does a bad job of optimizing array indexing
code for FORTRAN arrays declared using the ALLOCATABLE keyword.
For example if you have something like the following:
DOUBLE PRECISION,ALLOCATABLE,DIMENSION(:,:,:,:) :: QAV
...
ALLOCATE( QAV( -2:IMAX+2,-2:JMAX+2,-2:KMAX+2,ND) )
...
DO L = 1, 5
DO K = K1, K2
DO J = J1, J2
DO I = I1, I2
II = I +
2013 May 24
0
[LLVMdev] Thumb call relocation for the Runtime dynamic linker (RuntimeDyldELF.cpp)
Hi Jonas,
> here is a patch to add Thumb call relocation to the dynamic linker. I would be happy if you could commit it to the SVN.
Thanks very much for working on this. It looks like a good starting-point, but there are a couple of issues with the patch at the moment.
First, it only handles RelValue up to 22 bits (depending on how you count) in size. But on ARMv6T2 onwards the J1 and J2
2006 Apr 18
4
ISDN in Japan?
Hi all,
general query here --- I'm about to set up an asterisk box for use in Japan
but can't figureout if it's all ISDN there or what?
I have gathered so far that the two major providers, NTT and KVH both offer
ISDN lines with .......INS1500 and maybe INS64 protocols?
Not sure...
But I'm seeing stuff about J1 vs. T1/E1 ....
so does that mean I can't use a Digium card it
2017 Jun 01
2
Reversing one dimension of an array, in a generalized case
My error. Clearly I did not do enough testing.
z <- array(1:24,dim=2:4)
> all.equal(f(z,1),f2(z,1))
[1] TRUE
> all.equal(f(z,2),f2(z,2))
[1] TRUE
> all.equal(f(z,3),f2(z,3))
[1] "Attributes: < Component ?dim?: Mean relative difference: 0.4444444 >"
[2] "Mean relative difference: 0.6109091"
# Your earlier example
> z <- array(1:120, dim=2:5)
>
2006 Oct 03
2
strverscmp, scandir, alphasort and versionsort
Hello,
These are implementations of strverscmp, scandir, alphasort and
versionsort, and some test cases for them.
I know these aren't in POSIX, but they're useful, nonetheless, and
someone else might be interested in them.
Regards,
Luciano Rocha
--
lfr
0/0
-------------- next part --------------
/* ----------------------------------------------------------------------- *
*
*
2009 Jul 30
4
edit.row.names taking row names from the edited dataframe
Hi all,
I am struggling to work out how to use the rownames from an edited dataframe
rather than the row names from the original dataframe. In my data set i'm
trying to extract several rows of data on particular individuals, i don't
doubt i'm using the long way round but what i have in the way of a script is
this:
##selecting the IDs from the dataframe individually