na Questions
4
I would like to ask the R community how to merge two rows with the same ID (i.e. same participant) with some variables that are identical and others where there are NA's. In my example, I would lik...
2
I'm trying to print a table in knitr from a data frame using xtable . The table in the example below has the dimensions 3x7 but the third row only has one value, in the second column. The rest of t...
1
Solved
I have not found a satisfying solution to the problem of missing data when importing CSV data into a pandas DataFrame.
I have datasets where I don't know in advance what the columns or data types ...
Edgewise asked 1/10, 2016 at 23:37
3
Solved
I'm trying to clean up a data frame and I would like to replace NAs in one column, with a corresponding value from another column. I would also like to do this for multiple columns at once.
Examp...
1
Solved
I'm looking to find the columns of matrix row-maxima while ignoring NAs. E.g.,
set.seed(1)
a <- matrix(runif(15), ncol=3)
a[a<.3] <- NA
a[5,] <- NA
That is:
> a
[,1] [,2] [,3]
...
1
Solved
I have problems understanding this. I have an integer vector of length 5:
x <- 1:5
If I index it with a single NA, the result is of length 5:
x[NA]
# [1] NA NA NA NA NA
My first idea was that...
1
Solved
I've seen a solution to this, but can't get it to work for groups
(Fill NA in a time series only to a limited number), and thought there must be a neater way to do this also?
Say I have the follow...
Regelation asked 8/8, 2016 at 6:22
4
Solved
I have a dict that holds computed values on different time lags, which means they start on different dates. For instance, the data I have may look like the following:
Date col1 col2 col3 col4 col5...
Melicent asked 18/7, 2016 at 21:43
3
Solved
I am using Pandas 0.18.1 with python 2.7.x. I have an empty dataframe that I read first. I see that the types of these columns are object which is OK. When I assign one row of data, the type for nu...
3
Solved
I want to use na.omit (data) for the following example dataset, but on a condition so as to remove rows with NAs only when they are present in lets say "more than 30%" of the columns.
data:
C1 C...
2
Solved
I've got dataframe that has batch ID and the results of six tests performed on each batch. The data looks like this:
batch_id test1 test2 test3 test4 test5 test6
001 0.121 NA 0.340 0.877 0.4...
3
Solved
This is a sample of my data from CSV. It contains ~10 columns.
Product_id Product_Weight Product_Name Shop_Name ...
[1] A 10 xxxx Walmart
[2] B 12 yyyy Target
[3] C 11 zzzz Target
[4] A NA xxxx W...
3
Solved
I am doing a correlation matrix for a dataframe of 4000 variable and I would like to remove the variables showing > 0.5 correlation, so I am using this command from the {caret} package.
removeme &...
Detinue asked 1/10, 2013 at 9:54
2
I am trying to detect anomalous values in a time series of climatic data with some missing observations. Searching the web I found many available approaches. Of those, stl decomposition seems appea...
Splashboard asked 21/8, 2012 at 15:35
2
Solved
I have a matrix in which every row has at least one NA cell, and every column has at least one NA cell as well. What I need is to find the largest subset of this matrix that contains no NAs.
For e...
2
Solved
2
Solved
I have a dataset df and I would like to remove all rows for which variable y does not have the value a. Variable y also contains some NAs:
df <- data.frame(x=1:3, y=c('a', NA, 'c'))
I can ach...
6
Solved
What is the fastest way to detect if a vector has at least 1 NA in R? I've been using:
sum( is.na( data ) ) > 0
But that requires examining each element, coercion, and the sum function.
1
Anyone know if the incomparables argument of unique() or duplicated() has ever been implemented beyond incomparables=FALSE?
Maybe I don't understand how it is supposed to work...
Anyway I'm looki...
4
Solved
I have a csv file as shown below that I read into R using read.csv, where column C has 12/30 empty values. I want to work out the max of each column, but the R function "max" returns "NA" when used...
2
Solved
I want to convert all 0s in the matrices of a list into NAs. I figured out a way how to achieve this task. However, it is too complex and I think there should be an easy way how to do it. Here some...
1
Solved
I have a Pandas DataFrame object data with columns 'a', 'b', 'c', ..., 'z'
I want to select all rows which satisfy the following condition: data in columns 'b', 'c', 'g' is not NaN simultaneously....
1
Solved
I want to select a Cox model with the forward procedure from a data.frame with no NA. Here is some sample data:
test <- data.frame(
x_1 = runif(100,0,1),
x_2 = runif(100,0,5),
x_3 = runif(10...
Weimer asked 20/6, 2013 at 9:9
2
Solved
Recently, I've faced a behaviour in table function that was not what I was expected:
For example, let take the following vector:
ex_vec <- c("Non", "Non", "Nan", "Oui", "NaN", NA)
If I check...
2
Solved
There are two data tables of the following structure:
DT1 <- data.table(ID=c("A","B","C"), P0=c(1,10,100), key="ID")
DT2 <- data.table(ID=c("B","B","B","A","A","A","C","C","C"), t=re...
Supposition asked 29/11, 2015 at 10:36
© 2022 - 2024 — McMap. All rights reserved.