Shinzi Katoh
Shinzi Katoh

Reputation: 291

R: Write a function to produce a number with decimal points

I wanted to generate a number with a certain decimal point when a number indicating the decimal point is given. So, simply speaking, if 1 is given, generate .1. If 2 is given, generate .01, and so on.

1 => .1
2 => .01
3 => .001
4 => .0001 and so on.

Do you guys have any idea on that?

Thanks.

Upvotes: 0

Views: 54

Answers (1)

Ayush Nigam
Ayush Nigam

Reputation: 384

I think you are looking for this

#p is input integer here 
func1 <- function(p){

return (10^(-p))

}

Upvotes: 1

Related Questions