# Gsub function in Julia

**URL:** https://discourse.julialang.org/t/gsub-function-in-julia/72351
**Category:** New to Julia
**Tags:** r
**Created:** [December 1, 2021, 8:49am UTC](https://discourse.julialang.org/t/gsub-function-in-julia/72351 "2021-12-01T08:49:33Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![jnewbie](https://avatars.discourse-cdn.com/v4/letter/j/53a042/32.png) [@jnewbie](https://discourse.julialang.org/u/jnewbie)
#### Post date: [December 1, 2021, 8:49am UTC](https://discourse.julialang.org/t/gsub-function-in-julia/72351/1 "2021-12-01T08:49:33Z")

</div>

Hi everyone,

I am translating an R code into a Julia code, I have this function in R :

> for (i in 1:length(l)) {  
> if(length(l[[i]])\>0){  
> a ← l[[i]]  
> y[i,a+c-1] ← as.numeric(  
> gsub(“,”,“”, work.matrix[which(row.names(work.matrix)==i),colnames(work.matrix)%in% a], fixed = TRUE))  
> }  
> }

I translated it like that in Julia :

> for key in keys(l)  
> if length(l[key]) \> 0  
> a = l[key]  
> b = rownames .== key  
> d = [i for i in a]  
> y[key,(a .+ c .- 1)] = replace.(work\_matrix[b,d],“,” =\>“”)  
> end  
> end

But I get this error : no method matching similar(::Int64, ::Type{Any}), does anyone know why ? Thank you !

---

<div class="post-metadata">

### Author: ![DNF](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dnf/32/10191_2.png) [@DNF](https://discourse.julialang.org/u/DNF)
#### Post date: [December 1, 2021, 9:05am UTC](https://discourse.julialang.org/t/gsub-function-in-julia/72351/2 "2021-12-01T09:05:39Z")

</div>

Hi. I don’t know exactly what the problem is, but you can make it easier to understand if you provide more input. I suggest that you read this post: [Please read: make it easier to help you](https://discourse.julialang.org/t/please-read-make-it-easier-to-help-you/14757), which gives some tips on how to write questions that are clearer to the reader.

In particular, tip number 4 in that post is relevant. When we cannot tell what sort of data you are working on, it is difficult to understand what is going wrong.
