Hi:
I want to add a constant to an existing col of the
data.frame. I have the following dataset:
structure(list(x = c(1, 1, 1, 1, 1), y = c(1, 1, 1, 1, 1)),
.Names = c(x,
y), row.names = c(NA, 5L), class = data.frame)
I want to add a
Try this:
sweep(DF, 2, 1:2, '+')
On Thu, Mar 11, 2010 at 9:20 AM, GULATI, BRIJESH (Global Markets FFO
NY) brijesh.gul...@baml.com wrote:
Hi:
I want to add a constant to an existing col of the
data.frame. I have the following dataset:
structure(list(x = c(1, 1,
Hi:
I want to add a constant to an existing col of the data.frame. I
have the following dataset:
structure(list(x = c(1, 1, 1, 1, 1), y = c(1, 1, 1, 1, 1)), .Names =
c(x,
y), row.names = c(NA, 5L), class = data.frame)
I want to add a constant to col 1 and col 2 to get the
hello
can you show me how to create a data.frame from two factors x and y. column 1
should be equal to x and column 2 is 1 if it is common to y and 0 if it is not.
x=factor(c(A,B,C,D,E,F,G))
y=factor(c(B,C,G))
the output should look like this:
A0
B1
C1
D0
E0
F0
G1
Hi,
try this,
data.frame(x,as.numeric(x %in% y))
HTH,
baptiste
On 7 March 2010 21:06, joseph jdsan...@yahoo.com wrote:
hello
can you show me how to create a data.frame from two factors x and y. column 1
should be equal to x and column 2 is 1 if it is common to y and 0 if it is
not.
Hi,
data.frame(x=x,y=as.numeric(x%in%y))
HTH,
Stephan
joseph schrieb:
hello
can you show me how to create a data.frame from two factors x and y. column 1
should be equal to x and column 2 is 1 if it is common to y and 0 if it is not.
x=factor(c(A,B,C,D,E,F,G))
y=factor(c(B,C,G))
the
6 matches
Mail list logo