search for: rprojecthelp

Displaying 11 results from an estimated 11 matches for "rprojecthelp".

2010 May 03
3
how to rewrite this for loops in matrix form without loop
x0=rnorm(100) y0=rpois(100,3)+1 ind=as.data.frame(table(y0)) ind1=ind[,1] ind2=ind[,2] phi=NULL for (i in 1:length(ind2)){ phi[i]=sum(x0[y0==ind1[i]])/ind2[i] } [[alternative HTML version deleted]]
2010 Jun 17
3
ask a question about data sets element
for example, I have a1=c(1,3,5) a2=c(2,4,6) a3=c(7,8) a4=c(9,10) now if I have i=5, so i in a1, then I get a feedback tag[5]=1 i=8, so i in a3, then can get tag[8]=3 in there any function to do this to check the element belongs to which group? thank you!!! [[alternative HTML version deleted]]
2010 Jun 21
4
how to initial a list to store data result?
May I ask how to initialize a list? usually I will use " result=list(0) " to do this. is this right? [[alternative HTML version deleted]]
2010 Apr 28
1
how to remove the names in the list result
hi,everybody: I get a list as following. For each element of the list, it has names such as "Var1" and "Freq". May I ask how to remove them? And, may I ask how to make them form a matrix such as like concatinating them? Thank you! The list I got: [[1]] Var1 Freq 1 -5.20726501684368 19 2 1.89099344331540 31 [[2]] Var1
2010 Sep 29
1
how to to if a calculation is out range?
for example, when I am calculating a posterior density, I need to calculate gamma(75*3+5)=gamma(220) which is out of the bound of gamma function. what shall I do for this condition> Thank you [[alternative HTML version deleted]]
2010 Jul 05
1
if using ginv function, does it mean there is no need to use solve function any more?
since ginv can deal with both singular and non-singular conditions, is there any other difference between them? if I use ginv only, will be any problem? thanks [[alternative HTML version deleted]]
2010 Nov 02
2
how to compare two datasets in R>?
hi, everybody, my question is: suppose I have two data sets, set A is large and have variables like ID, Gender, Income. Set B is small and suppose only has ID. Now I want to get a subset from data set A which contains ID from Set B. How to do this in R>? Is there any commands to do this? Thank you [[alternative HTML version deleted]]
2010 Apr 29
2
Is it possible to transform a factor to a number like this way?
such a factor as a=as.factor(c(1.23, 4.56, 7.89)) and I want to get this vector: c(1.23, 4.56, 7.89). Thanks [[alternative HTML version deleted]]
2010 Jun 25
2
ask a question about list in R
my list al is as below: al=list(c(2,3),5,7) > al [[1]] [1] 2 3 [[2]] [1] 5 [[3]] [1] 7 and I check the second component, its element is 5, then I remove this, now my al is: al[[2]][al[[2]]!=5]->al[[2]] > al [[1]] [1] 2 3 [[2]] numeric(0) [[3]] [1] 7 The Question is, how I can get the new list without the second component, that is : > alwanted [[1]] [1] 2 3 [[2]] [1] 7 Thank
2010 Jun 28
2
ask a question about list in R project
my list al is as below: mylist=list(c(2,3),5,7) > mylist [[1]] [1] 2 3 [[2]] [1] 5 [[3]] [1] 7 How could I get the following FOUR lists: First one [[1]] [1] 3 [[2]] [1] 5 [[3]] [1] 7 Second one [[1]] [1] 2 [[2]] [1] 5 [[3]] [1] 7 Third One [[1]] [1] 2 3 [[2]] [1] 7 Last one [[1]] [1] 2 3 [[2]] [1] 5 Do I have to use 'for' loops? Please give me sone suggestions! Thank you
2010 Jun 29
2
how to remove "numeric(0)" component from a list
like this, the list is below, I want to remove the last one . not using newlist[-2], but using the function detect its component is numeric(0) and then remove it from the list. newlist [[1]] [1] 2 3 [[2]] [1] numeric(0) [[3]] [1] 7 [[alternative HTML version deleted]]