[R] summing up a column.

oslo hokut1 at yahoo.com
Fri Jun 10 23:06:35 CEST 2016


Jeff thanks for this. My question was job related. No from my course. I need finish a job for the place I work. I am so sorry for causing misunderstanding.
thanks,
Oslo 

    On Friday, June 10, 2016 5:02 PM, Jeff Newmiller <jdnewmil at dcn.davis.ca.us> wrote:
 

 Multiple posting happens when you are learning a new system, but reading the posting guide can keep the bleeding down. 

1) There is a no-homework policy on this list... different educational organizations have different standards for what is acceptable outside help, so you should be using the support offered by your instructor or educational institution. 

2) Once you have completed your course, you CAN learn to post data with your code so that it is self-contained... that is, reproducible on our vanilla R session. Using the dput function is one excellent strategy. 

3) This is not a problem that needs a loop... as Bert (not Bret) said, you can do this in one or two statements if you simply use basic logical indexing. If your instructor wants you to do it with a loop for sine reason then you really really should not be here... you should be talking to him/her.
-- 
Sent from my phone. Please excuse my brevity.

On June 10, 2016 1:34:03 PM PDT, oslo via R-help <r-help at r-project.org> wrote:
Dear All;
I had difficulty to post a mail along with appropriate of data structure. I do sincerely apologize for multiple posting


I would like to sum up the B$a column and cut off at 0.7 for the each row of intervals giving in file=A.For example the interval  at the first row in A$posA and A$posB is 1 and 9. So, I need adding up the B$a and cut off B$a>.7 from the 1 to 9 in B$pos. And then I need to the same using the intervals in the second, third..... rows in A. Obviously my loop is wrong and  does not work properly. Please help for my this first experience.  Regards
Here are my codes
#sorting B$possort=B[order(B$pos),]
#Running loop
for(i in 1:nrow(A)) {if(sum(B[a$B, i:A[1:2])>0.7) {print(A[1:i,]) } }
Reply, R
R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


  
	[[alternative HTML version deleted]]



More information about the R-help mailing list