1

This is my first time here, and after browsing on this site I could not find a solution to my problem. I would really appreciate your help!

I have a dataset called esports, which have items such as Age, gender, femininity, machiavellianism. I have extracted variables from the dataset called Femininity and mac, by using the following code:

 femininity<-rowMeans(data.frame(esports[11:15],6-esports[16:17]))
 mac<-rowMeans(data.frame(esports[28:30],6-esports[31,33]))

Now what I wish to do is: Take the rows Femininity + mac and combine it with my first 8 items in esports. The following code gave me the first 8 items:

 esports2<-esports[1:9]

After looking around I tried the following:

 esports2<-rbind((esports[,c(1:9,femininity,soc,mac)]

sadly, it did not work.

Does anyone have a solution?

Kind regards, Fares.

Joshua
  • 40,822
  • 8
  • 72
  • 132
  • 2
    When asking for help, you should include a simple [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input and desired output that can be used to test and verify possible solutions. – MrFlick May 08 '18 at 15:12
  • Related: [*How to get the means of all columns but one?*](https://stackoverflow.com/questions/49389204/how-to-get-the-means-of-all-columns-but-one-in-r) – Jaap May 08 '18 at 15:15
  • With out a reproducible example it is hard to tell for sure, but are you looking for `rbind(esports[1:9],femininity,soc,mac)`? – Ian Wesley May 08 '18 at 15:15
  • @MrFlick I'm sorry I don't fully understand, what can I do to make it easier to answer my question? :) – Fares Hassan Almas May 08 '18 at 15:17
  • @IanWesley when I type the command you entered, it only adds esports 1:9, and it ignores femininity, soc and mac – Fares Hassan Almas May 08 '18 at 15:20
  • Keep in mind, that only esports is a dataframe, while femininity, soc and mac are listed as "Values" in the Environment – Fares Hassan Almas May 08 '18 at 15:22

0 Answers0