Gsub function in Julia

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 !

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, 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.

2 Likes