Completely new to RStudio and need help

I am brand new this and have some questions that are probably very basic. I have 3 rows of data. Row 1 has two variables in it, A and B. Row 3 has multiple different scores. I know how to find the mean and SD of row 3 all together, but I don't know how to only run my analysis for A and B separately. Any help would be greatly appreciated.



It si not clear what you mean by "I have 3 rows of data" but here is an example of how to subset a named vector.

row3 <- c("A" = 1, "B" = 2, "C" = 3)
#> A B C 
#> 1 2 3

mean(row3[c("A", "B")])
#> [1] 1.5
sd(row3[c("A", "B")])
#> [1] 0.7071068

Created on 2019-09-15 by the reprex package (v0.3.0.9000)

If you need more specific help please provide a minimal REPRoducible EXample (reprex). A reprex makes it much easier for others to understand your issue and figure out how to help.

If you've never heard of a reprex before, you might want to start by reading this FAQ:

Thank you andresrcs,

I don't have anything to reproduce right now as I have been starting and restarting for the last 6 hours. But, I will try to sum it up as best I can. My first row is labeled Departments and only has two response, Finance and Marketing. The third row is Scores and are all numeric values. I have uploaded my dataset from excel and attached it. I need to run analysis that I know how to do on only finance or marketing individually. The way I have it uploaded right now I can only run analysis on the entirety of the scores. I am sorry if this not enough info, I am completely new to this and have never had to write code for anything.

Thank you,


It would be easier to help you if you could provide sample data on a copy/paste friendly format, please read the guide I gave you to learn how to do it, is actually pretty simple, give it a try.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.