Questions tagged [rowwise]

229 questions
-1
votes
1 answer

Using R to do aggregation like tapply in matrice rowwisely

I have a problem in doing matrix computation, could you please shed some light upon it. Thank you very much in advance! I have a data frame genderLocation and a matrix test, they correspond to each other with the index genderLocation[,1:6] …
Bylon
  • 21
  • 1
  • 6
-2
votes
2 answers

Add a row-wise specific column result from left join of two dataframes

Info: So I have 2 dataframes, we'll call them dfa and dfb. Dfa has a master list of things I'm interested in, and dfb has a list of things I want to check for in dfa if they already exist. I'm using a left join to carry over some information in a…
SqueakyBeak
  • 366
  • 4
  • 15
-2
votes
3 answers

Combine matrices row by row

I have two matrices of arbitrary sizes, e.g. matrix 1 (n * m) and matrix 2 (k * l). Is there a (convenient) way in R to cbind them row-by-row, to form a (n * k) * (m + l) matrix where each row of matrix 1 has a chance to be cbinded to each row of…
Ken Chen
  • 7
  • 3
-6
votes
1 answer

How to find profit or loss percentage from consecutive rows

I need a help in calculating profit/loss percentage. I have a data frame as follows Date Price 2017-5-20 50 2017-5-20 60 2017-5-20 45 I need a new column in dataframe which calculates profit or loss percentage of…
1 2 3
15
16