Question

If I have 128 columns (patients) and 1265 rows (genes) of data; example below. How do...

If I have 128 columns (patients) and 1265 rows (genes) of data; example below. How do I calculate the average of each column (128) in R? I need to know how to write the code in R?

> exprs(ALL)
01005 01010 03002 04006 04007
1000_at 7.597323 7.479445 7.567593 7.384684 7.905312
1001_at 5.046194 4.932537 4.799294 4.922627 4.844565
1002_f_at 3.900466 4.208155 3.886169 4.206798 3.416923
1003_s_at 5.903856 6.169024 5.860459 6.116890 5.687997
1004_at 5.925260 5.912780 5.893209 6.170245 5.615210
1005_at 8.570990 10.428299 9.616713 9.937155 9.983809
1006_at 3.656143 3.853979 3.646808 3.874289 3.547361

Homework Answers

Answer #1

There are many ways for calculating average of each column in R.

1.

> colMeans(x=ALL, na.rm = TRUE) # Assuming that your data stored in ALL variable and in dataframe format. IF not run this

> ### Create Data Frame

> ALL=as.data.frame(ALL)

2.

Use summarise in the dplyr package:

library(dplyr)
summarise(ALL, Average = mean(col_name, na.rm = T))

3.

Get Mean of the column by column position

# Get Mean of the column by column position

> mean(ALL[,3])

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
How can I reduce data set by deleting any rows that have all FALSE values for...
How can I reduce data set by deleting any rows that have all FALSE values for every column in that row using pandas. Assuming there are 20+ columns/rows to loop through. Example: The table data below the pandas code should drop/reduce the data to remove the second & fifth row. Treat The Dtype for the True and False values as Bool. id Test1 value1 value2 value3 value4 0.1 1 False False False False 0.2 2 False True True False 0.3...
How can I reduce data set by deleting any rows that have all FALSE values for...
How can I reduce data set by deleting any rows that have all FALSE values for every column in that row using pandas. Example: The table data below the pandas code should drop/reduce the data to remove the second & fifth row. Treat The Dtype for the True and False values as object. id Test1 value1 value2 value3 value4 0.1 1 False False False False 0.2 2 False True True False 0.3 3 True False False False 0.4 4 False...
Suppose we have the following data: 0.1876798 0.5425627 0.0000000 0.4680425 0.2812897 0.2763695 -0.2048694 0.4441289   0.0000000 0.5694079...
Suppose we have the following data: 0.1876798 0.5425627 0.0000000 0.4680425 0.2812897 0.2763695 -0.2048694 0.4441289   0.0000000 0.5694079 The data have two columns as above, the first one is beta1 hat the second one is for beta 2 hat. I want R codes to get 0.1876798 0.5425627 0.2812897 0.2763695 -0.2048694 0.4441289   I want R codes to delete the rows that have zeros, and find the average for the first column and second column Note, I want to apply the code for 800...
how to use aov commend in R Studio with only one column of data. the data...
how to use aov commend in R Studio with only one column of data. the data name is temperature for example. I know if there is two column of data i can use like avo(temperature~name, data=temperature), how to do it in one
Python Regular Expressions problem: How do you get string data from file of say rows of...
Python Regular Expressions problem: How do you get string data from file of say rows of IP address and city location values obtained from re.finditer patterns to appear in the same dictionary? for example: text file has 100.200.10.255 New York City 10. 16. 25.254 Los Angeles segment of code includes for item in re.finditer(the_two_patterns, text_file, re.MULTILINE): print (item.groupdict()) result is below that I am getting {‘IP’: ‘100.200.10.255’, ‘city’: None} {‘IP’: None, ‘city’: ‘New York City’} {‘IP’: ‘10.16.25.254’, ‘city’: None} {IP’:...
When you write code, how do you know that you need to use value or reference?...
When you write code, how do you know that you need to use value or reference? Please show with an example. I know reference is two way communication but it is not clear to me. Thanks
Sudoku is a puzzle consisting of squares arranged in 9 rows and 9 columns. The 81...
Sudoku is a puzzle consisting of squares arranged in 9 rows and 9 columns. The 81 squares are further divided into nine 3 ✕ 3 square boxes. The object is to fill in the squares with numerals 1 through 9 so that each column, row, and box contains all nine numbers. However, there is a requirement that each number appear only once in any row, column, or box. Each puzzle already has numbers in some of the squares. Alisha wants...
In R studio please explain how to do the stemplot? A sample of 20 endangered species...
In R studio please explain how to do the stemplot? A sample of 20 endangered species was obtained and the length of time (in months) since being placed on the list was recorded for each species. A stemplot of these data follows. In the stemplot, 5|2 represents 52 months. 5   2 4 8 9 9 6   0 0 3 5 6 7 8 9 7   3 4 7 8 9 9 8 9   8 The median length of time (in...
I am using forecast package for time series analysis. I have a dataset with hourly data...
I am using forecast package for time series analysis. I have a dataset with hourly data from oct 3 2016 to oct 23 2016. I used the following code to convert my data into a time series object. Dataset is about citibike stations I’m only using 6 stations I’m not sure if Im supposed to use my time column or include my time column. This is what i have so far. data.ts <- ts(CitiBike[,2:7], freq = 504, start = 2016)...
I have C++ question that I do not know how to answer it, Please do not...
I have C++ question that I do not know how to answer it, Please do not copied and pasted from the internet will be deleted. What is a template? What is the main problem with templates ? What is the advantage with templates ? Give example other have not done..
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT