R- notes

=========累加=========
Sumx=0

for(y in 1:100)
{
Sumx=Sumx+x[y]
}

=========计数===========
xx=matrix(ncol=10, nrow=10, 0)
sum=0
for(a in 1:10)
{
if(xx[a,10]==1)
{
sum=sum+xx[a,1]
}
}

2 thoughts on “R- notes

  1. 阿,这是R吗,这是我当年最爱的R耶~咋看着半亲切半眼生~~year姐姐折腾了个啥工作,为毛部落格越来越学术~

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>