Displaying 2 results from an estimated 2 matches for "daniel_wu_r".
2011 Jan 17
3
to append a column to a data frame, has I use loop/if in my case?
days=Sys.Date()-1:70
price=abs(rnorm(70))
regular=rep(c(0,0,0,0,1,0,1,0,0,1),c(7,7,7,7,7,7,7,7,7,7))
y=data.frame(cbind(days,price,regular))
y is like
    days      price regular
1  14990 0.16149463       0
2  14989 1.69519358       0
3  14988 1.57821998       0
4  14987 0.47614311       0
5  14986 0.87016180       0
6  14985 2.55679229       0
7  14984 0.89753533       0
the output I want:
2011 Jan 16
2
how to add a derived column to a data frame?
I have a data frame with 10 columns: A:J and I want to have the output as a data frame with 11 columns, the value of 11th column is£º
for each row, if any column can be divided by 13, then the 11th column has a values of 1, otherwise, it has a value of 0. How to do that?
input is
a=matrix(1:10000,1000,10)
dimnames(a)=list(NULL,LETTERS[1:10])
	[[alternative HTML version deleted]]