Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Articles on Trending Technologies
Technical articles with clear explanations and examples
How to create stacked bar plot in which each bar sum to 1 or 100% in R?
A stacked bar plot consists multiple bars in one bar, it shows one category for a categorical variable with its levels. Mostly, the stacked bar chart is created with the count of the levels in each category but if we want to create it with percentage for individual categories of the categorical variables then it can be done as well. We can use prop.table function to create the proportion of levels for each category then create the bar plot.ExampleConsider the below data frame −> set.seed(99) > x1 x2 x3 df df x1 x2 x3 1 48 98 68 2 33 ...
Read MoreHow to create a lagged variable in R for groups?
Lagged variable is the type of variable that contains the previous value of the variable for which we want to create the lagged variable and the first value is neglected. Therefore, we will always have one missing value in each of the groups, if we are creating a lagged variable that depends on a grouping variable or factor variable.ExampleConsider the below data frame:> set.seed(2) > Factor Rate df df Factor Rate 1 F1 12 2 F1 54 3 F1 18 4 F1 26 5 F1 14 6 F2 25 7 F2 81 8 F2 47 9 F2 15 10 F2 ...
Read MoreHow to multiple a matrix rows in R with a vector?
When we multiple a matrix with a vector in R, the multiplication is done by column but if we want to do it with rows then we can use transpose function. We can multiply the transpose of the matrix with the vector and then take the transpose of that multiplication this will result in the multiplication by rows.ExampleConsider the below matrix −> M1 M1 [,1] [,2] [,3] [,4] [,5] [1,] 1 6 11 16 21 [2,] 2 7 12 17 22 [3,] 3 8 13 18 23 [4,] 4 9 14 19 24 [5,] 5 10 15 20 25 > V1 M1*V1 [,1] [,2] [,3] [,4] [,5] [1,] 1 6 11 16 21 [2,] 4 14 24 34 44 [3,] 9 24 39 54 69 [4,] 16 36 56 76 96 [5,] 25 50 75 100 125Row-wise Multiplication −> t(t(M1)*V1) [,1] [,2] [,3] [,4] [,5] [1,] 1 12 33 64 105 [2,] 2 14 36 68 110 [3,] 3 16 39 72 115 [4,] 4 18 42 76 120 [5,] 5 20 45 80 125Let’s have a look at one more example −> M2 M2 [,1] [,2] [,3] [,4] [,5] [1,] 72 5 36 11 76 [2,] 61 38 17 73 25 [3,] 96 9 62 79 64 [4,] 77 53 80 78 50 [5,] 81 15 21 43 23 > V2 V2 [1] 28 20 1 68 86 > t(t(M2)*V2) [,1] [,2] [,3] [,4] [,5] [1,] 2016 100 36 748 6536 [2,] 1708 760 17 4964 2150 [3,] 2688 180 62 5372 5504 [4,] 2156 1060 80 5304 4300 [5,] 2268 300 21 2924 1978
Read MoreHow to create a vector with names of its elements in one line code in R?
Vectors are frequently created in R but most of the times we don’t give names to their elements and if we want to give their names then we can use setNames function. This function will help us to name the vector elements in a single line of code, obviously this will save our time and workspace in R.Examples > V1 V1 A B C D E F G H I J 1 2 3 4 5 6 7 8 9 10 > V2 V2 A B C D E F G H I J 1 2 3 4 ...
Read MoreHow to change the color of lines for a line chart using ggplot2 in R?
When we create line chart with each of the lines having different color, we might want to change the color of lines if the colors we used at the first time are not making the chart attractive. This can be done by manually setting the color of the lines in the chart with the help of scale_color_manual function.ExampleConsider the below data frame −> set.seed(2) > Group Time Frequency df df Group Time Frequency 1 1 Time1 3 2 2 Time2 6 3 3 Time1 5 4 4 Time2 3 5 5 Time1 9 6 1 Time2 9 7 ...
Read MoreHow to view saved Rdata file in windows?
We save our data files created in R to use them in the future and these files have an extension .Rdata. To view these files, we can make use of load function that will read the path of the file on your system. Suppose you save the file in Documents folder as I do then you will have to provide the path of the Documents folder and that’s it.ExampleSuppose that you created a data frame df and saved it as df.Rdata file in your system −> set.seed(99) > x1 x2 x3 df df x1 x2 x3 1 2 0.7542310 3.3730539 ...
Read MoreExplain about sensitivity analysis in financial management.
In a business, decision making is very important aspect. Decision making can direct the business in a successful way or in an unsuccessful way. So, if a business wants to be successful, correct decisions should be taken in given circumstances.A lot of independent variables are involved in decision making mainly in financial aspects of the firm. So, there is a need of a tool or a technique to take appropriate decisions.Sensitivity analysis is a tool or a technique which tells about how independent variable impacts a dependent variable under current conditions. Investors use this tool to evaluate the result of ...
Read MoreExplain about various financial statements in financial management.
Financial statements are the reports prepared by a firm to represent their financial activities in an accounting year. These gives how the firm carries its activities, maintain its cash flows and how well the firm is doing in the market.Nature of financial statements includes −Recording facts.Accounting conversions.Assumptions.Personal judgements.Objectives of financial statements are as follows −To provide information about economic resources of a firm.To provide information about changes in economic resources of a firm.To provide information about net resources of a firm.To provide information about estimation of earning potential of a firm.Types of financial statements includes −Balance sheetAssetsLiabilitiesEquityIncome statementIncomeExpensesProfit or lossCash ...
Read MoreExplain about cash flows in financial management.
Money is an important factor in the business. A firm should maintain a clear record about income and outing of money to evaluate and estimate their performance. A cash flow statement is a record, which records firms in and out flow of cash in detail. Monitoring, analysing and optimising the cash flow is called cash flow management.Importance of cash flow management is explained below:Solvency and credit worthiness.CAPEX and investment.Improves vendor ad employee relationships.Indicators of cash flow management are as follows −EBIT − It tells about earnings after leverage and tax expenses which are deducted. EBITDA tells about operating efficiency of ...
Read MoreExplain about forecasting in financial management.
The term forecasting refers to predication of future with the given circumstances. In forecasting, both macro and micro economic factors will be considered. Financial forecasting tells about company’s future action.Financial forecasting made through projected financial statements (income statements, balance sheets and cash flows). It helps to make decisions like capital investments, requirement of working capital, funds requirement etc.Features of forecasting include −Relates to future events.Depends on historical and current events.Predication of future events.Forecasting techniques.Quantitative and qualitative techniques are two types of financial forecasting techniques, which are explained below in detail.Quantitative techniquesCasual methods.Simple linear and multiple regression.Days sales technique.Percentage of sales ...
Read More