Package {IndFarmCost}


Type: Package
Title: Indian Farm Cost Concepts for Agricultural Economic Analysis
Version: 0.1.0
Description: Implements commonly used Indian farm cost concepts for agricultural economic analysis, including Cost A1, A2, B1, B2, C1, C2, and C3. Tools are provided to calculate cost concepts from farm-level input data, aggregate costs across groups, summarize distributions, compute returns and benefit-cost ratios, estimate cost of production and break-even values, decompose cost shares, conduct one-way sensitivity analysis, and visualize concept-wise costs. The implementation is designed for reproducible farm management and cost-of-cultivation studies.
License: GPL-3
Encoding: UTF-8
Depends: R (≥ 4.1.0)
Suggests: knitr, rmarkdown, testthat (≥ 3.0.0)
VignetteBuilder: knitr
Config/testthat/edition: 3
Config/roxygen2/version: 8.1.0
NeedsCompilation: no
Packaged: 2026-08-28 14:57:35 UTC; majum
Author: Chiranjit Mazumder [aut, cre], Mrinmoy Ray [aut], Utkarsh Tiwari [aut]
Maintainer: Chiranjit Mazumder <majumder.chira@gmail.com>
Repository: CRAN
Date/Publication: 2026-09-10 08:30:08 UTC

IndFarmCost: Indian Farm Cost Concepts for Agricultural Economic Analysis

Description

Tools for calculating and analysing Indian farm cost concepts A1, A2, B1, B2, C1, C2, and C3 for farm management and cost-of-cultivation studies.

Author(s)

Maintainer: Chiranjit Mazumder majumder.chira@gmail.com

Authors:

References

Directorate of Economics and Statistics, Department of Agriculture and Farmers Welfare, Government of India. Cost Studies and cost concept methodology.


A2 Plus Family Labour

Description

Calculates the frequently reported A2 plus family labour measure from a farmcost object.

Usage

a2_plus_fl(x)

Arguments

x

An object returned by farm_costs().

Value

A numeric vector equal to A2 plus imputed family labour.


Break-Even Price

Description

Calculates the main-product price required to cover a selected cost concept, after crediting by-product value.

Usage

break_even_price(x, yield, concept = "C2", byproduct_value = 0)

Arguments

x

An object returned by farm_costs().

yield

Main-product yield as a column name, scalar, or vector.

concept

Cost concept used for break-even analysis.

byproduct_value

By-product value credited against cost.

Value

A numeric vector of break-even prices.


Break-Even Yield

Description

Calculates the main-product yield required to cover a selected cost concept, after crediting by-product value, at a specified product price.

Usage

break_even_yield(x, price, concept = "C2", byproduct_value = 0)

Arguments

x

An object returned by farm_costs().

price

Main-product price as a column name, scalar, or vector.

concept

Cost concept used for break-even analysis.

byproduct_value

By-product value credited against cost.

Value

A numeric vector of break-even yields.


Indian Farm Cost Concept Definitions

Description

Provides a compact table describing the cost concepts implemented by the package.

Usage

concept_definitions()

Value

A data frame with concept, formula, and interpretation.


Cost of Production per Unit

Description

Calculates unit cost as the selected cost concept less by-product value, divided by main-product yield.

Usage

cost_of_production(x, yield, concept = "C2", byproduct_value = 0)

Arguments

x

An object returned by farm_costs().

yield

Main-product yield as a column name, scalar, or vector.

concept

Cost concept used in the numerator. One of A1, A2, B1, B2, C1, C2, or C3.

byproduct_value

By-product value as a column name, scalar, or vector. Defaults to zero.

Value

A numeric vector of cost per unit of main product.


One-Way Farm Cost Sensitivity Analysis

Description

Changes one raw cost input by a series of proportional changes and reports the mean A1 through C3 under each scenario.

Usage

cost_sensitivity(data, variable, changes = c(-0.2, -0.1, 0, 0.1, 0.2), ...)

Arguments

data

Raw input data frame accepted by farm_costs().

variable

Name of one numeric input column to vary.

changes

Numeric vector of proportional changes. For example, 0.10 means a 10 percent increase and -0.10 a 10 percent decrease.

...

Additional arguments passed to farm_costs().

Value

A data frame with the scenario change and mean cost concepts.


Decompose Farm Costs into Additive Shares

Description

Decomposes C2 or C3 into the A1 base, leased-land rent, interest on owned fixed capital, rental value of owned land, family labour, and (for C3) managerial cost.

Usage

cost_shares(x, denominator = c("C3", "C2"))

Arguments

x

An object returned by farm_costs() with the original input columns retained.

denominator

Either "C2" or "C3".

Value

A long data frame with row number, component, amount, denominator, and share percentage.


Example Indian Farm Cost Data

Description

Returns a small deterministic farm-level dataset suitable for examples, teaching, and testing. Monetary values are illustrative Indian rupees per hectare and do not represent an official survey.

Usage

farm_cost_example()

Value

A data frame with 12 farm observations and standard cost components.


Calculate Indian Farm Cost Concepts A1 to C3

Description

Calculates Cost A1, A2, B1, B2, C1, C2, and C3 for each row of a farm-level data frame.

Usage

farm_costs(
  data,
  a1_cols = standard_a1_components(),
  a1_col = NULL,
  rent_leased_land = "rent_leased_land",
  interest_fixed_capital = "interest_fixed_capital",
  rental_value_owned_land = "rental_value_owned_land",
  family_labour = "family_labour",
  managerial_rate = 0.1,
  na.rm = FALSE,
  keep_inputs = TRUE
)

Arguments

data

A data frame containing farm cost components.

a1_cols

Character vector naming columns to sum for Cost A1. By default, standard_a1_components() is used.

a1_col

Optional name of a pre-computed A1 column. If supplied, a1_cols is ignored.

rent_leased_land

Column name, scalar, or numeric vector for rent paid for leased-in land.

interest_fixed_capital

Column name, scalar, or numeric vector for interest on owned fixed capital excluding land.

rental_value_owned_land

Column name, scalar, or numeric vector for the imputed rental value of owned land.

family_labour

Column name, scalar, or numeric vector for the imputed value of family labour.

managerial_rate

Non-negative managerial charge rate used for C3. The default is 0.10, so C3 equals 110 percent of C2.

na.rm

Logical. If TRUE, missing A1 components are ignored when A1 is summed. Missing values in the additional cost components still propagate.

keep_inputs

Logical. If TRUE, retain the input columns in the result.

Value

An object of class farmcost and data.frame containing the seven cost concepts.


Aggregate Farm Cost Concepts by Groups

Description

Aggregates A1 through C3 by one or more grouping variables using the mean, median, or sum. Weighted means are supported.

Usage

farm_costs_aggregate(
  x,
  by,
  method = c("mean", "median", "sum"),
  weights = NULL,
  na.rm = TRUE
)

Arguments

x

An object returned by farm_costs(). Grouping columns must be retained in x.

by

Character vector naming grouping columns.

method

One of "mean", "median", or "sum".

weights

Optional column name or numeric vector of non-negative weights. Weights are allowed only when method = "mean".

na.rm

Logical indicating whether missing values should be removed.

Value

A data frame with grouping columns and aggregated A1 through C3.


Compute Farm Returns and Benefit-Cost Ratios

Description

Computes gross return, net return over each cost concept, and gross-return to cost ratios. Gross return may be supplied directly or calculated from main and by-product quantities and prices.

Usage

farm_returns(
  x,
  gross_return = NULL,
  main_output = NULL,
  main_price = NULL,
  byproduct_output = NULL,
  byproduct_price = NULL
)

Arguments

x

An object returned by farm_costs().

gross_return

Optional gross return as a column name, scalar, or vector.

main_output, main_price

Main-product quantity and price, each supplied as a column name, scalar, or vector.

byproduct_output, byproduct_price

Optional by-product quantity and price. If omitted, by-product value is treated as zero.

Value

A data frame containing gross return, net returns, and benefit-cost ratios for A1 through C3.


Plot Indian Farm Cost Concepts

Description

Plots A1 through C3 for one observation or the column means across all observations.

Usage

## S3 method for class 'farmcost'
plot(x, row = 1L, type = c("bar", "line"), main = NULL, ylab = "Cost", ...)

Arguments

x

An object returned by farm_costs().

row

Row number to plot. Use NULL to plot means across observations.

type

Either "bar" or "line".

main

Plot title.

ylab

Y-axis label.

...

Additional graphical arguments passed to graphics::barplot() or graphics::plot().

Value

The plotted values, invisibly.


Print a Farm Cost Object

Description

Print a Farm Cost Object

Usage

## S3 method for class 'farmcost'
print(x, ...)

Arguments

x

An object returned by farm_costs().

...

Arguments passed to print.data.frame().

Value

The input object, invisibly.


Standard A1 Cost Components

Description

Returns the default column names used by farm_costs() to construct Cost A1.

Usage

standard_a1_components()

Value

A character vector of standard A1 component names.


Summarize Farm Cost Concepts

Description

Computes descriptive statistics for A1 through C3.

Usage

summarize_costs(x, na.rm = TRUE)

## S3 method for class 'farmcost'
summary(object, ...)

Arguments

x

An object returned by farm_costs().

na.rm

Logical indicating whether missing values should be removed.

object

An object returned by farm_costs().

...

Additional arguments passed to summarize_costs().

Value

A data frame with sample size, mean, standard deviation, minimum, quartiles, maximum, and coefficient of variation.

A data frame of descriptive statistics.