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...
Abbeyabbi asked 26/11, 2016 at 15:52

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...
Oshiro asked 23/12, 2014 at 19:3

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...
Ceasefire asked 13/9, 2016 at 23:16

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] ...
Munoz asked 1/9, 2016 at 15:10

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...
Krummhorn asked 17/8, 2016 at 8:46

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...
Demit asked 23/6, 2016 at 23:22

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...
rna
Georgiannageorgianne asked 17/6, 2016 at 10:37

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...
Lauro asked 14/6, 2016 at 0:54

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...
rna
Adebayo asked 9/6, 2016 at 17:0

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...
Chace asked 6/4, 2016 at 23:18

2

Solved

I have this code import pandas as pd import numpy as np import csv df = pd.DataFrame({'animal': 'cat dog cat fish dog cat cat'.split(), 'size': list('SSMMMLL'), 'weight': [8, 10, 11, 1, 20, 12, ...
Moderate asked 4/4, 2016 at 14:51

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...
Bandolier asked 31/3, 2016 at 20:16

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.
rna
Sarawak asked 1/7, 2011 at 18:26

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...
Litha asked 6/1, 2016 at 3:49

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...
Porous asked 4/4, 2013 at 10:12

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...
Martainn asked 18/12, 2015 at 9:40

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....
Insectivorous asked 16/12, 2015 at 12:23

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...
rna
Troublesome asked 3/12, 2015 at 15:59

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.