VaR calculation: Error in if(class(x) == "numeric") : the condition has length < 1

63 Views Asked by At

in the course of my bachelor thesis I have to perform a value at risk calculation based on a vector. The vector is available to me in the form of an Excel file, which I have already imported into R. For the calculation and subsequent graphical representation I use the packages mosaic, PerformanceAnalytics and ggplot2.

If I now select the vector as the data basis, I get the error message "Error in if (class(x) == "numeric") : the condition has length <1

What do I have to change to display the VaR of the vector? Unfortunately I am a complete beginner in R and try to help myself with YouTube videos, so I apologize for obvious errors that I do not recognize.

enter image description here

Here is an image of my code. I know I haven't tried a lot but im completely lost and I hope one of you guys can give me a short instruction how to do it.

0

There are 0 best solutions below