try to find the mistake in my code error in parse ,missing coma shiny?

35 Views Asked by At

This is the error:

> Error in parse(file, keep.source = FALSE, srcfile = src, encoding =
> enc) :    C:\Users\zeine\OneDrive\Desktop\CAST
> Lifeactuary\App-1\App2/app.R:39:1: unexpected symbol 38:     39:
> server
>     ^ Possible missing comma at: 39:server <- function(input, output) {    ^ Possible missing comma at: 54:      for (i in seq(0:k-1)){
>                 ^ Possible missing comma at: 54:      for (i in seq(0:k-1)){
>                    ^ Possible missing comma at: 67:      for (j in seq(1:(120-input$Age))){
>                 ^ Possible missing comma at: 67:      for (j in seq(1:(120-input$Age))){
>                    ^ Error in sourceUTF8(fullpath, envir = new.env(parent = sharedEnv)) :    Error sourcing
> C:\Users\zeine\AppData\Local\Temp\Rtmpc9QmLp\file28c0a8113f0

this is my first try on shiny , could you please help me? this is the code:

server <- function(input, output) {

  output$EPV <- renderText({
    
    
    #Reading Data
    AM92= read.csv("AM92Table.csv",header = TRUE,sep=',')
      
        
    #Calculate kpx 
    
    KPX=function(k){
    
      kpx=1
      
      for (i in seq(0:k-1)){
        
        px= 1-(AM92$qx[input$Age-17+3+i])
        kpx=kpx*px
      }
      return(kpx)
      
    }
      
    #whole Life Annuity Due   
    
    ax=1
    
      for (j in seq(1:(120-input$Age))){
        
       a=(1+input$interest)^-j*KPX(j)
       ax=ax+a

    }
    
    Annuity=input$Amount*ax })
}
0

There are 0 best solutions below