由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Statistics版 - How to avoid if statement in R
相关主题
R 求助两组时间序列的比较
R: matrix to vectordata clustering by vector correlation distance
R Matrix 初级问题Predict values of vectors generated by black box functions
请教R - 关于mean如何把一个correlation matrix 按照一个table 输入一个 databas (转载)
rbind或者cbind时候,vector的长度不一样怎么办呢?求助用R出现怪问题。
two vectors' coefficient of determinationQuestions about Support Vector Machine in R
新手问个R里vectorization的问题555 一道简单的积分换元问题 求教
Approximate random sample一个expectation问题请教
相关话题的讨论汇总
话题: avoid话题: statement话题: element话题: vector话题: question
进入Statistics版参与讨论
1 (共1页)
y***6
发帖数: 46
1
Hi all,
I got some new questions about R. Any help is appreciated!
First Question:
If I have the following three row/column vectors:
A=[0, 0 , 0, 0 ,0];
B=[0.1,0.2,0.3,.5,0.6];
C=[1,1,1,1,1];
I want to verify if elments in B are within the corresponding
boundary as defined in vector A and vector C (component-wise), for example,
1st element: 0<0.1<1--> TRUE
2nd element: 0
D******n
发帖数: 2836
2
1)(B>A)&(C>B)
2)(x[,,1]+x[,,2])/2

【在 y***6 的大作中提到】
: Hi all,
: I got some new questions about R. Any help is appreciated!
: First Question:
: If I have the following three row/column vectors:
: A=[0, 0 , 0, 0 ,0];
: B=[0.1,0.2,0.3,.5,0.6];
: C=[1,1,1,1,1];
: I want to verify if elments in B are within the corresponding
: boundary as defined in vector A and vector C (component-wise), for example,
: 1st element: 0<0.1<1--> TRUE

y***6
发帖数: 46
3
What if A is 2-by-2-100000, it's no convenient to do
(A[,,1]+...+A[,,100000])/2
which actually calls for a loop. Can we do this without loop? Thanks Da
Shagen for answer to my first question!
D******n
发帖数: 2836
4
apply(A,c(1,2),sum)

【在 y***6 的大作中提到】
: What if A is 2-by-2-100000, it's no convenient to do
: (A[,,1]+...+A[,,100000])/2
: which actually calls for a loop. Can we do this without loop? Thanks Da
: Shagen for answer to my first question!

1 (共1页)
进入Statistics版参与讨论
相关主题
一个expectation问题请教rbind或者cbind时候,vector的长度不一样怎么办呢?求助
问R和C的循环语句two vectors' coefficient of determination
请教cointegration...新手问个R里vectorization的问题
Vectorization questionApproximate random sample
R 求助两组时间序列的比较
R: matrix to vectordata clustering by vector correlation distance
R Matrix 初级问题Predict values of vectors generated by black box functions
请教R - 关于mean如何把一个correlation matrix 按照一个table 输入一个 databas (转载)
相关话题的讨论汇总
话题: avoid话题: statement话题: element话题: vector话题: question