similar to: Deleting rows with NA from isolated column in matrix

Displaying 20 results from an estimated 50000 matches similar to: "Deleting rows with NA from isolated column in matrix"

2011 Jan 25
5
Counting number of rows with two criteria in dataframe
Hi R-users, I'm trying to find an elegant way to count the number of rows in a dataframe with a unique combination of 2 values in the dataframe. My data is specifically one column with a year, one with a month, and one with a day. I'm trying to count the number of days in each year/month combination. But for simplicity's sake, the following dataset will do:
2011 Jun 22
2
Linking 2 columns in 2 databases and applying a function
Hi all, I have two datasets, one that represents a long-term time series and one that represents summary data for the time series. It looks something like this: x<-data.frame(Year=c(2001,2001,2001,2001,2001,2001,2002,2002,2002,2002,2002,2002), Month=c(1,1,1,2,2,2),Q=c(5,5,5,6,6,6,3,3,3,4,4,5)) y<-data.frame(Year=c(2001,2001,2002,2002),Month=c(1,2,1,2),Threshold_Q=c(5,5,4,4)) What I'd
2011 Dec 12
1
Please delete my e-mail judit.barroso@montana.edu
Please, I am receiving lot of e-mails that I do not want. Please could you delete my e-mail. Thank, Judit -----Original Message----- From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Thomas Adams Sent: Monday, December 12, 2011 3:22 PM To: Bert Gunter Cc: r-help at r-project.org Subject: Re: [R] Boxplot of multiple vectors with different lengths Bert,
2011 Dec 12
4
Boxplot of multiple vectors with different lengths
Hello, I'm attempting to write a code that automatically imports data from different files (with different lengths-just one variable) and makes tidy box plots for comparison. I can successfully import the data and create a list of the vectors I want to compare. But I cannot, for the life of me, figure out how to generate box plots using the "list" option. Suppose these are my data:
2011 Jul 25
3
Finding/identifying a value within a factor
Hi all, I'm trying to identify a particular digit or value within a vector of factors. Specifically, this is environmental data where in some cases the minimum value reported is "<" a particular number (and I want to manipulate only these). For example: x<-c("1","2","3","4","<1") For a dataset that is hundreds or
2011 May 03
2
Controlling the extent of ablines on plot
Hi all, I'm attempting to make a quite-specific plot where the axes cross at the origin and with gridlines for guidance. I've been using ablines to create the reference lines because I want a lot of control as to where they are placed on the axis. This command works very well for such control. However... These ablines don't seem to work when I specify the origin as 0,0. They go
2010 Mar 10
1
Importing Access 2007 data with ROBC
Hi all, I'm trying to import Microsoft Access data into R. It looks like I'm supposed to use the ROBC package, and this works fine with old Access files (those with an .mdb extension). However, lovely Microsoft must constantly update their software. Modern Access files have an .ACCDB extension. I cannot seem to coerce R to import data from such a file. Any advice? I've been using
2010 Mar 18
1
Imported tables from Access 2007
Hi all, I am very new to R and I'm trying to import data from Microsoft Access. So far, I've managed to do so successfully using the following code: testdb <- file.path("c:\Databse.accdb") channel2 <- odbcConnectAccess2007(testdb) data.table <- sqlFetch(channel2,"data") This successfully imports a table(?) called "data.table". But when I try to
2006 Jan 18
1
phyper returns 1 if x==k (PR#8499)
Full_Name: Utz J. Pape Version: 2.2.0 OS: linux Submission from: (NULL) (141.14.23.12) If I use phyper and set parameter x equal to k (meaning that all balls I draw are white) phyper returns 1 which is not (always) correct: pape at xxx:~> R2.2.0 --vanilla R : Copyright 2005, The R Foundation for Statistical Computing Version 2.2.0 (2005-10-06 r35749) ISBN 3-900051-07-0 R is free software
2012 Jan 10
4
Sum of a couple of variables of which a few have NA values
Dear everyone, I have looked all over the internet but I cannot find a way to solve my problem. In my data I want to sum a couple of variables. Some of these variables have NA values, and when I add them together, the result is NA dat <- data.frame( id = gl(5,1), var1 = rnorm(5, 10), var2 = rnorm(5, 7), var3 = rnorm(5, 6), var4 = rnorm(5, 3), var5 = rnorm(5, 8) ) dat[3,3] <- NA dat[4,5]
2012 May 20
5
removeing only rows/columns with "na" value from square ( symmetrical ) matrix.
I have some square matrices with na values in corresponding rows and columns. M<-matrix(1:2,10,10) M[6,1:2]<-NA M[10,9]<-NA M<-as.matrix(as.dist(M)) print (M) 1 2 3 4 5 6 7 8 9 10 1 0 2 1 2 1 NA 1 2 1 2 2 2 0 1 2 1 NA 1 2 1 2 3 1 1 0 2 1 2 1 2 1 2 4 2 2 2 0 1 2 1 2 1 2 5 1 1 1 1 0 2 1 2 1 2 6 NA NA 2 2 2 0 1 2 1 2 7 1 1 1 1 1 1 0 2 1 2 8
2010 Jan 20
3
Deleting rows based on duplicate entries in one columns in a data matrix
Hi everybody, I would like to delete rows based on duplicate entries in column 3 in the data matrix X (size 60000 x 57). I have tried the unique(x) command as > data <- X[unique(X[,3]),] however, for some reason the command introduces a lot of NA's into the dataset. So, now I'm looking for a function that eliminates rows, if they have duplicate values in column 3. Does anyone
2007 Feb 11
2
deleting row when any col is.na
Um texto embutido e sem conjunto de caracteres especificado associado... Nome: n?o dispon?vel Url: https://stat.ethz.ch/pipermail/r-help/attachments/20070211/e93b6988/attachment.pl
2012 Aug 06
2
deleting columns from a dataframe where NA is more than 15 percent of the column length
I have a dataframe of 10 different columns (length of each column is the same). I want to eliminate any column that has 'NA' greater than 15% of the column length. Do i first need to make a function for calculating the percentage of NA for each column and then make another dataframe where i apply the function? Whats the best way to do this.
2003 Dec 18
3
NA, deleting rows
Dear colleges, I do not understand the following behaviour: > aa <- data.frame(a1= 1:10, a2= c(rep(NA, 5), 1:5) ) > aa a1 a2 1 1 NA 2 2 NA 3 3 NA 4 4 NA 5 5 NA 6 6 1 7 7 2 8 8 3 9 9 4 10 10 5 > aa[!aa$a2==1, ] # removing rows with a2==1 a1 a2 NA NA NA NA.1 NA NA NA.2 NA NA NA.3 NA NA NA.4 NA NA 7 7 2 8 8 3 9 9 4 10 10 5 I didn't
2007 Mar 08
2
Removing duplicated rows within a matrix, with missing data as wildcards
I'd like to remove duplicated rows within a matrix, with missing data being treated as wildcards. For example > x <- matrix((1:3), 5, 3) > x[4,2] = NA > x[3,3] = NA > x [,1] [,2] [,3] [1,] 1 3 2 [2,] 2 1 3 [3,] 3 2 NA [4,] 1 NA 2 [5,] 2 1 3 I would like to obtain [,1] [,2] [,3] [1,] 1 3 2 [2,] 2 1 3
2008 Feb 04
3
counts of each column that are not NA, and/or greater than column means
Hi, Given a test matrix, test <- matrix(c(1,2,3,NA,2,3,NA,NA,2), 3,3) A) How to compute the counts of each column (excluding the NA) i.e., 3, 2, 1 B) How to compute the counts of each column (excluding the NA) that are greater than the column means ? i.e., 1, 1, 0 I could write a for loop, but hope to use better alternative. [[alternative HTML version deleted]]
2010 Jan 15
2
How to delete matrix rows based on NA frequency?
Hi all, I would like to remove rows from a matrix, based on the frequency of missing values. If there are more than 10 % missing values, the row should be deleted. I use the following to calculate the frequencies, thereby getting a new matrix with the frequencies: freqNA=rowMeans(is.na(exprdata)) But is there a shorter way to remove the rows based on "(1-freqNA)>0.1"
2012 Feb 13
2
Deleting rows and columns containing NA's and "" only
Hello, I use read.xls from the gdata package to read in xlsx files. Sometimes these data.frames contain NA columns and rows only. I know how to get rid of those ones but here is the R output of a test data set read in with read.xls > t1 A B X D X.1 X.2 1 test 1 NA NA 2 <NA> asd NA
2011 Nov 20
1
Deleting multiple rows from a data matrix based on exp value
Dear List, I have a data matrix that consists of ~4500 rows and 25 columns (i.e. an exprSet object that I converted via the 'exprs' function into a data matrix) Now I want to remove/delete the rows where all exp. values in that particular row are below or equal to a specific cut-off value (e.g 1.11) I have tried using several commands to address this issue: >Matrix[rowSums(Matrix