Skip to content
Prev 206671 / 398503 Next

Help using Cast (Text) Version

On Jan 18, 2010, at 10:26 AM, Steve Sidney wrote:

            
It removes the first column from the object that is offered to  
apply(). I didn't think it would not have made any sense to offer the  
vector of text entries, but now that I think about it again, it would  
have given you a total count as a check, I suppose. Read up on  
"negative indexing".

?"["
The apply function with a "2" argument takes individual columns of  
matrices, arrays or data.frames and offers them to the function that  
follows. In this case each successive column temporally becomes "x"  
and then the body of that function works on "x" and returns a value  
for the sum of the !is.na() values, i.e. the count of the non-missing  
entries in that column.
Any of the introductory texts should explain the various forms of  
indexing and the use of the apply family of functions. They are both  
central to effective R programming.