Greeting all,
I was wondering how can I call a data.frame or an object outside a function class? i tried to use <<- but with no use.
simply put
I have a function
mod0 = function(Q1,Q2){ #where Q1 and Q2 are numeric input in the shiny app ui
A= Q1+2
B=Q2+A
long= 37.6543
lat= 127.5432
C <<- data.frame(A,B, lat, long)
return (list(C))
}
#later I want to use C values to add markers inside leaflet but I cannot call C data.frame outside the function class. it gives me an error of [there is no object called "C"]
# I want to call C dataframe outside the function here and use it for leaflet marker values as following
data <- C #C is the dataframe from the mod0 function
data <-data[complete.cases(data),] #remove empty cell data
data$long <- as.numeric(data$long) #to make sure this is a numeric column not text
data$lat <- as.numeric(data$lat)
data$results <- as.numeric(data$results)
thank you in advance for any reply and advises
best regards
Ahmed Ali
PhD Candidate
Chung Ang University