Lets suppose your dataframe d
has a column named "number" (you can see the actual names of the columns in the dataframe using str(d)
). To multiply the column "number" by 5, use:
# You are referring to the column "number" within the dataframe "d"
d$number * 5
# The last command only shoes the multiplication.
# If you want to replace the original values, use
d$number <- d$number * 5
# If you want to save the new values in a new column, use
d$numberX5 <- d$number * 5
Also, try referring to the standard R documentation, which you can find in the official page.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…