R Studio: Why A Function Argument is Considered A Function Name -
i newcomer in r language. far have made 1 r language's function works properly. have main function (nsbeta) calls 2 functions, when arrives second function, called "pnsjacob", responses: error: not find function "vperiodyear" 1 of "pnsjacob"'s argument
nsbeta <- function() { #postgresql connection #data sourced postgresql con <- dbconnect(postgresql(), user= "postgres", password="luthf1had1", dbname="my dissertation") rs <- dbsendquery(con,"select * tscf") tscf <- fetch(rs, n=-1) #disconnect dbdisconnect(con) # initiate variables vertices <- tscf$vertex vfreq <- vertextally(vertices) vlength <- length(vfreq) vcf <- tscf$cashflow_amount vparam <- c(0.5,0.5,0.5,1) # prices , jacobian after initial parameters # names(tscf)[9] <- "years" # vperiodyear <- tscf$years vperiodyear <- tscf$period_year vjacoboutput <- pnsjacob(vfreq, vcf, vperiodyear, vparam) vpx <- vjacoboutput[,1] vjacob <- vjacoboutput[,2:5] }
and response of interpreter is:
> vjacoboutput <- pnsjacob(vfreq, vcf, vperiodyear, vparam) error: not find function "vperiodyear"
so please knows cause please tell me .....
i sorry stupid question last night. morning, after long sleeping, after brain refreshed, find problem. since in jacobian function mistyped index bracket in array vperiodyear(count), should type vperiodyear[count].
i thought problem within calling function, find out problem within called function.
thx god!
Comments
Post a Comment