In this case, instead of naming the column 'c', it names it 'args[1]' as a
string, not a variable.
--
View this message in context:
http://r.789695.n4.nabble.com/Problem-with-cbind-and-arguments-tp4650808p4650913.html
Sent from the R help mailing list archive at Nabble.com.
___
Yeah, I meant 3 instead of 5.
This was just an example, it's not what Im really doing.
I am using a 'arules' package for data mining, and I have to pass and
'arg[]' element and use it as the new column name of a data.frame.
It's a bit complicated, so I used this example, and I would like to use
'
This is not reproducible. Nor can I figure out why you expected assigning
"5" to "args[1]" was going to end up with c(3,3,3).
FWIW, I highly recommend that you re-read the Introduction to R,
particularly the sections discussing indexing.
Then you might try
P[[ args[1] ]] <- 3
On Sun, 25 Nov 2
Hello,
I am using Rscript and arguments, and I have to create a object, here is a
small example:
-I have P:
a b
1 2
1 2
1 2
-And I want this result:
a b c
1 2 3
1 2 3
1 2 3
So I pass 'c' as an Rscript argument and use this command:
>P<-cbind(P,args[1]=5)
-But then it wil
Try this where Age.Group is a factor whose
levels represent the columns of out and Seq is
a sequence number labeling the first Name
in each Age.Group 1, the second 2 and
so on.
> DF <- data.frame(Name = LETTERS, Age = 1:26)
> DF$Age.Group <- cut(DF$Age, seq(0, 30, 10))
> DF$Seq <- with(DF, ave(seq
Here is one way of doing it by splitting the data and then padding
everything to the same length:
> x <- data.frame(pat=LETTERS, age=sample(60, 26))
> x.cut <- split(x, cut(x$age, breaks=c(1,seq(10,60,10
> # determine maximum number in a group and then pad the rest out to that
size
> x.max <-
Hi All,
I have a file with two columns, the first column has the names of the
patients and the second column has the age. I am looking into creating an
output file that looks like
1-1010-20etc
EricChris
Bob mat
Andrew
Suzan
Where each column has the nam
7 matches
Mail list logo