# Creating a function in Julia

**URL:** <https://discourse.julialang.org/t/creating-a-function-in-julia/76603>\
**Category:** New to Julia\
**Tags:** question, package, statistics, function\
**Created:** [February 17, 2022, 4:08am UTC](https://discourse.julialang.org/t/creating-a-function-in-julia/76603 "2022-02-17T04:08:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![fsanik041](https://avatars.discourse-cdn.com/v4/letter/f/a6a055/32.png) [@fsanik041](https://discourse.julialang.org/u/fsanik041)\
**Post date:** [February 17, 2022, 4:08am UTC](https://discourse.julialang.org/t/creating-a-function-in-julia/76603/1 "2022-02-17T04:08:40Z")

</div>

I’m trying to write a function in Julia that draws n values from a arbitrary distribution truncated on loess fit and hybrid index class. I can create the function in r using:

```julia
rtruncated=function(n,lo,hi,pf,qf,...)
  ....<rest of the code>

```

where lo is loess fit and hi is hybrid index class. I want to create a function that is similar to this in Julia, I can’t find resource for hybrid class Index in Julia.

---

<div class="post-metadata">

**Author:** ![jling](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jling/32/212909_2.png) [@jling](https://discourse.julialang.org/u/jling)\
**Post date:** [February 17, 2022, 4:45am UTC](https://discourse.julialang.org/t/creating-a-function-in-julia/76603/2 "2022-02-17T04:45:15Z")

</div>

is the question more about where can you find hybrid index class in Julia? (is it a statistical thing? or a programming language thing)

---

<div class="post-metadata">

**Author:** ![fsanik041](https://avatars.discourse-cdn.com/v4/letter/f/a6a055/32.png) [@fsanik041](https://discourse.julialang.org/u/fsanik041)\
**Post date:** [February 17, 2022, 5:25am UTC](https://discourse.julialang.org/t/creating-a-function-in-julia/76603/3 "2022-02-17T05:25:06Z")

</div>

The question precisely is using a function similar to hi() which is present in R in Julia.

---

<div class="post-metadata">

**Author:** ![gustaphe](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gustaphe/32/18174_2.png) [@gustaphe](https://discourse.julialang.org/u/gustaphe)\
**Post date:** [February 17, 2022, 5:29am UTC](https://discourse.julialang.org/t/creating-a-function-in-julia/76603/4 "2022-02-17T05:29:34Z")

</div>

If you describe what you want it’s a lot easier to help you. Some people might know enough R to be able to do it based off of just the R function name, but you’ll increase your chances if you tell us what the function you want _does_.

If your question is about how to create functions,  
[https://docs.julialang.org/en/v1/manual/functions/](https://docs.julialang.org/en/v1/manual/functions/)
