0

Consider two data frames, dataFrame1 and dataFrame2:

  • dataFrame1 has N columns (colmn1, ..., colmnN)
  • dataFrame2 has 3 columns (col1, col2, col3)

Can I write a statement like:

Select colmn1, colmn2, ..., colmnN, col1, col2 from dataFrame1, dataFrame2

using RMySQL?

Ferdinand.kraft
  • 12,579
  • 10
  • 47
  • 69

1 Answers1

2

Maybe you want package sqldf instead.

Try this:

library("sqldf")
sqldf("select colmn1, colmn2, ..., colmnN, col1, col2 from dataFrame1, dataFrame2")

of course you must replace ... with actual column names.

Ferdinand.kraft
  • 12,579
  • 10
  • 47
  • 69
  • thanks for your answer! Cant write the actual column names because the number of columns may be different. I should avoid explicit column names in the query. – stairway_2_7 Aug 13 '13 at 13:08
  • @stairway_2_7, You can use something like `"select a.*, b.col1, b.col2 from dataFrame1 a, dataFrame2 b"`. – Ferdinand.kraft Aug 13 '13 at 13:18