If you need to subtract the columns 3:ncol(df)
from the second column
df[3:ncol(df)] <- df[3:ncol(df)]-df[,2]
More Related Contents:
- Reshaping data.frame from wide to long format
- Quickly reading very large tables as dataframes
- Reshape three column data frame to matrix (“long” to “wide” format) [duplicate]
- Combine two data frames by rows (rbind) when they have different sets of columns
- Convert a list to a data frame
- How to combine multiple conditions to subset a data-frame using “OR”?
- Split a large dataframe into a list of data frames based on common value in column
- Splitting a dataframe string column into multiple different columns [duplicate]
- Conditional replacement of values in a data.frame
- Convert data.frame column format from character to factor
- How to convert a table to a data frame
- How do I combine two data-frames based on two columns? [duplicate]
- R Apply() function on specific dataframe columns
- Count NAs per row in dataframe [duplicate]
- Changing Column Names in a List of Data Frames in R
- dplyr filter with condition on multiple columns
- Add (insert) a column between two columns in a data.frame
- Find duplicated rows (based on 2 columns) in Data Frame in R
- Change value of variable with dplyr
- Creating a new variable from a lookup table
- How to initialize empty data frame (lot of columns at the same time) in R
- R: Assign variable labels of data frame columns
- rbind data frames based on a common pattern in data frame name
- Read and rbind multiple csv files
- Count number of zeros per row, and remove rows with more than n zeros
- How I can select rows from a dataframe that do not match?
- Select last non-NA value in a row, by row
- Join two data frames in R based on closest timestamp
- R how can I calculate difference between rows in a data frame
- Color one point and add an annotation in ggplot2?