"Suran, Luciana @ Torto Wheaton Research"
<[EMAIL PROTECTED]> wrote in
news:[EMAIL PROTECTED]:
> I'm new to R and have some question on combining (and deleting)
> rows.
You posted your email in response to a question that had nothing to do
with this question. If you have new question, you should not send a
reply to someone else's question.
> I have a dataset that looks like this:
>
<snipped single element per line listing with 47 elements>
The lines you posted had no organization that would suggest they had
ever been part of a data.frame. The first 5 elements looked to be
variable names. But the number of elements was not evenly divisible by
5. Can you post a new message with complete data and the code (or
method) that you used to bring this data into the R environment?
>
> How can I add row 1 to row 24?
If this is arranged as only one column, and you wanted the value in row
24, then the code might be:
df[24] <- df[24] + df[1]
> Also, how can I delete rows from the dataframe?
You could assign another object the values in the first object rows
that you wanted kept:
df2 <- df[c(1:3, 5:10), ]
Or you could exclude the rows you wanted dropped using a minus-sign:
df2 <- df[-4,]
df2 <- df[-c(2,5,8), ]
--
David Winsemius
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.