Hello together,
i have a little problem, to create a new column, in a data.frame.
I know i can calculate one column with as a example 2 like this:
ORDER$WEIGHT - ORDER$VALUE * 2
But how can i create the ORDER$WEIGHT with different numbers, like this one.
I have a data.frame like this one:
Hi, Mat,
e. g., try something like
ORDER$VALUE * c( NY = 3, BER = 2, FRA = 1, WAS = 4)[ ORDER$DESTINY]
Hth -- Gerrit
On Fri, 17 Jan 2014, Mat wrote:
Hello together,
i have a little problem, to create a new column, in a data.frame.
I know i can calculate one column with as a example 2
thanks a lot, works perfectly
--
View this message in context:
http://r.789695.n4.nabble.com/calculate-an-value-in-dependence-of-another-column-tp4683727p4683732.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r-project.org
Hi,
You could try:
dat1 - read.table(text=ORDER DESTINY VALUE
A NY 100
B BER 10
C FRA 100
D WAS 50
E BER 20,sep=,header=TRUE,stringsAsFactors=FALSE)
within(dat1,WEIGHT -
4 matches
Mail list logo