I've an issue for create an function for the package
myfunction<-function(tab, a, b, c,format){
if(format ="M") {
...
} # Here I don't use the variable a,b,c
if(format ="L") {
...
} #Here I use the variable a,b,c
As you can see I use the variable a,b,c only when format ="L" so whenformat ="M" there is a problem because the variable a,b,c are a declaration of the column of the list.
information : M = data is matrix format ; L = data is list format
I would like to know how I can use the variable a,b,c only for format = "L"
I don't know if I can put the condition in declaration of variable in function for e.g
myfunction<-function(tab, if (format = "L") a, b, c else format = "M"){
...}
I tried but is not OK !
Have an idea
Thanks in advance
Sorry but can you precise the issue ?
I am not sure to see the problem of having a b c in declaration but not use after.
One improvement would be if format= "M", you could use a warning if any of a b or c is providing, to indicate to the user that they won't be used. Or something similar.
In general, it is not a problem to have argument that are not used afterwards.
So, I have to understand that it is possible to use the function without using the variable if they are not called. It seems logical to me.
I've tested and all thinks it's okay for me.
I agree it's not an issue (today is the day of rest!)