It's not clear to me what problem you're having.

   tan(data$slope)

should work.  As should

   log(data$uparea/data$slope)

I suggest that you provide a small subset of example data along with an 
example of any code you've tried, and the output that you'd like.

Jean

Tom Vanwalleghem wrote on 08/25/2011 05:54:01 AM:
> 
> Dear R helpers,
> I'm new to R and struggling with applying functions to a spatial 
> grid data frame, called data for example.data has a variable named 
> "slope" and "uparea"
> Basically, I need to calculate the tan(data$slope)Next, I need to 
> divide data$uparea by data$slope and take the log() of that all
> In the basic examples I found how to make simple multiplications 
> with a scalar likedata[["slope"]] = data[["slope"]]/2 # assigns new 
attribute
> I come from a background in GIS and fortran, so used to dealing with
> ordinary matrices, I'll admit I'm having trouble with understanding 
> the format of this spatial grid data frame structureI've been trying
> different methods to index the data frame, or working with the 
> function "lapply" but so far I can't seem to get my head wrapped around 
it.
> I appreciate any help.TomResearcher@University of CordobaSpain  
>    [[alternative HTML version deleted]]
> 

	[[alternative HTML version deleted]]

