I am using the following data:

[![]1](https://i.stack.imgur.com/OV7mA.png)

I am using this code to generate the velocity of the individual in the X and Y axes.

```
# Create velocity in x and y
VelocityXY <- function(data, angle, speed) {
  angleadjusted <- angle*0.0174533 # convert to radians

  YVelocity = (sin(angleadjusted))*speed 
  XVelocity = (cos(angleadjusted))*speed

  data$XVelocity <- XVelocity
  data$YVelocity <- YVelocity

  return(data)
}   

dat <- VelocityXY(dat, dat$DirStd, dat$s)

```

As you may note in my original data, I have multiple columns that indicate direction/angle. How might it be possible to name the new columns created by the function in accordance with the direction column that I use?

Since I'm going to be implementing this function a number of times, it would be helpful for it to automatically change the names of the new columns to reflect the direction and speed column from which it creates the new column.

For example, if I wanted to use `Dir1` and `s1` as my input vectors, how can I change the function so that the output columns will be named `XVelocityDir1S1` or something like that?