missing-data

java.lang.NoClassDefFoundError: android.support.v7.appcompat.R$styleable

南楼画角 提交于 2019-11-26 07:47:12
问题 i am using terminal [not eclipse]. i got following exception error, while i use emulator.debug successfully and installd successfully. But emulator show Unfortunatly app has stop . Then i run $ adb logcat it will display following. java.lang.NoClassDefFoundError: android.support.v7.appcompat.R$styleable at android.support.v7.app.ActionBarActivityDelegate.onCreate(ActionBarActivityDelegate.java:107) at android.support.v7.app.ActionBarActivityDelegateICS.onCreate(ActionBarActivityDelegateICS

Reading multiple files and calculating mean based on user input

只愿长相守 提交于 2019-11-26 04:51:14
问题 I am trying to write a function in R which takes 3 inputs: Directory pollutant id I have a directory on my computer full of CSV\'s files i.e. over 300. What this function would do is shown in the below prototype: pollutantmean <- function(directory, pollutant, id = 1:332) { ## \'directory\' is a character vector of length 1 indicating ## the location of the CSV files ## \'pollutant\' is a character vector of length 1 indicating ## the name of the pollutant for which we will calculate the ##

Replace missing values with column mean

女生的网名这么多〃 提交于 2019-11-26 04:42:22
问题 I am not sure how to loop over each column to replace the NA values with the column mean. When I am trying to replace for one column using the following, it works well. Column1[is.na(Column1)] <- round(mean(Column1, na.rm = TRUE)) The code for looping over columns is not working: for(i in 1:ncol(data)){ data[i][is.na(data[i])] <- round(mean(data[i], na.rm = TRUE)) } the values are not replaced. Can someone please help me with this? 回答1: A relatively simple modification of your code should

Replace NA with previous or next value, by group, using dplyr

巧了我就是萌 提交于 2019-11-26 02:38:11
问题 I have a data frame which is arranged by descending order of date. ps1 = data.frame(userID = c(21,21,21,22,22,22,23,23,23), color = c(NA,\'blue\',\'red\',\'blue\',NA,NA,\'red\',NA,\'gold\'), age = c(\'3yrs\',\'2yrs\',NA,NA,\'3yrs\',NA,NA,\'4yrs\',NA), gender = c(\'F\',NA,\'M\',NA,NA,\'F\',\'F\',NA,\'F\') ) I wish to impute(replace) NA values with previous values and grouped by userID In case the first row of a userID has NA then replace with the next set of values for that userid group. I am

Replace NA in column with value in adjacent column

无人久伴 提交于 2019-11-26 02:21:32
问题 This question is related to a post with a similar title (replace NA in an R vector with adjacent values). I would like to scan a column in a data frame and replace NA\'s with the value in the adjacent cell. In the aforementioned post, the solution was to replace the NA not with the value from the adjacent vector (e.g. the adjacent element in the data matrix) but was a conditional replace for a fixed value. Below is a reproducible example of my problem: UNIT <- c(NA,NA, 200, 200, 200, 200, 200

Insert rows for missing dates/times

对着背影说爱祢 提交于 2019-11-26 01:36:46
问题 I am new to R but have turned to it to solve a problem with a large data set I am trying to process. Currently I have a 4 columns of data (Y values) set against minute-interval timestamps (month/day/year hour:min) (X values) as below: timestamp tr tt sr st 1 9/1/01 0:00 1.018269e+02 -312.8622 -1959.393 4959.828 2 9/1/01 0:01 1.023567e+02 -313.0002 -1957.755 4958.935 3 9/1/01 0:02 1.018857e+02 -313.9406 -1956.799 4959.938 4 9/1/01 0:03 1.025463e+02 -310.9261 -1957.347 4961.095 5 9/1/01 0:04 1

How do I replace NA values with zeros in an R dataframe?

徘徊边缘 提交于 2019-11-26 01:19:06
问题 I have a data frame and some columns have NA values. How do I replace these NA values with zeroes? 回答1: See my comment in @gsk3 answer. A simple example: > m <- matrix(sample(c(NA, 1:10), 100, replace = TRUE), 10) > d <- as.data.frame(m) V1 V2 V3 V4 V5 V6 V7 V8 V9 V10 1 4 3 NA 3 7 6 6 10 6 5 2 9 8 9 5 10 NA 2 1 7 2 3 1 1 6 3 6 NA 1 4 1 6 4 NA 4 NA 7 10 2 NA 4 1 8 5 1 2 4 NA 2 6 2 6 7 4 6 NA 3 NA NA 10 2 1 10 8 4 7 4 4 9 10 9 8 9 4 10 NA 8 5 8 3 2 1 4 5 9 4 7 9 3 9 10 1 9 9 10 5 3 3 10 4 2 2 5

Include levels of zero count in result of table()

好久不见. 提交于 2019-11-26 00:55:29
问题 I have a vector of integers between 0 and 5. I want to compute a histogram of counts. For example: y <- c(0, 0, 1, 3, 4, 4) table(y) # y # 0 1 3 4 # 2 1 1 2 However, I also want the results to include the fact that there are zero 2\'s and zero 5\'s, ie. I want the returned vector to have length 6. Can I use table() for this? Desired result: # y # 0 1 2 3 4 5 # 2 1 0 1 2 0 回答1: Convert your variable to a factor , and set the categories you wish to include in the result using levels . Values

Remove rows with all or some NAs (missing values) in data.frame

丶灬走出姿态 提交于 2019-11-25 23:57:08
问题 I\'d like to remove the lines in this data frame that: a) contain NA s across all columns. Below is my example data frame. gene hsap mmul mmus rnor cfam 1 ENSG00000208234 0 NA NA NA NA 2 ENSG00000199674 0 2 2 2 2 3 ENSG00000221622 0 NA NA NA NA 4 ENSG00000207604 0 NA NA 1 2 5 ENSG00000207431 0 NA NA NA NA 6 ENSG00000221312 0 1 2 3 2 Basically, I\'d like to get a data frame such as the following. gene hsap mmul mmus rnor cfam 2 ENSG00000199674 0 2 2 2 2 6 ENSG00000221312 0 1 2 3 2 b) contain

Insert rows for missing dates/times

梦想的初衷 提交于 2019-11-25 21:58:23
I am new to R but have turned to it to solve a problem with a large data set I am trying to process. Currently I have a 4 columns of data (Y values) set against minute-interval timestamps (month/day/year hour:min) (X values) as below: timestamp tr tt sr st 1 9/1/01 0:00 1.018269e+02 -312.8622 -1959.393 4959.828 2 9/1/01 0:01 1.023567e+02 -313.0002 -1957.755 4958.935 3 9/1/01 0:02 1.018857e+02 -313.9406 -1956.799 4959.938 4 9/1/01 0:03 1.025463e+02 -310.9261 -1957.347 4961.095 5 9/1/01 0:04 1.010228e+02 -311.5469 -1957.786 4959.078 The problem I have is that some timestamp values are missing -