similar to: how to ignore NA with "NA" or "NULL"

Displaying 20 results from an estimated 40000 matches similar to: "how to ignore NA with "NA" or "NULL""

2012 May 03
2
add an automatized linear regression in a function
Dear R users, For the moment, I have a script and a function which calculates correlation matrices between all my data files. Then, it chooses the best correlation for each data and take it in order to fill missing data in the analysed file (so the data from the best correlation file is put automatically into the missing data gaps of the first file (because my files are containing missing values
2012 May 21
3
Prevent calculation when only NA
Hi everybody, I have a small question about R. I'm doing some correlation matrices between my files. These files contains each 4 columns of data. These data files contains missing data too. It could happen sometimes that in one file, one of the 4 columns contains only missing data NA. As I'm doing correlations between the same columns of each files, I get a correlation matrix with a
2012 May 29
1
correlation matrix only if enough non-NA values
Hi everybody. I'm trying to do a correlation matrix in a list of files. Each file contains 2 columns: "capt1" and "capt2". For the example, I merged all in one data.frame. My data also contains many missing data. The aim is to do a correlation matrix for the same data for course (one correlation matrix for capt1 and another for capt2). For the moment, I have a correlation
2012 Aug 01
4
how to calculate seasonal mean for temperatures
Hello everybody, I need to calculate seasonal means with temperature data for my work. I have 70 files coming from weather stations, which looks like this for example: startdate <- as.POSIXct("01/01/2006", format = "%d/%m/%Y") enddate <- as.POSIXct("05/01/2006", format = "%d/%m/%Y") date <- seq(from = startdate, to = enddate, by =
2012 Sep 26
5
create new column in a DF according to values from another column
Hi everyone, I have a small problem in my R-code. Imagine this DF for example: DF <- data.frame(number=c(1,4,7,3,11,16,14,17,20,19),data=c(1:10)) I would like to add a new column "Station" in this DF. This new column must be automatically filled with: "V1" or "V2" or "V3". The choice must be done on the numbers (1st column). For example, I would like
2006 Sep 21
3
how to ignore "NA" or replace it by another value
Hello, I`m a newbie to R so maybe this question is boring, but I have a large table with several empty missing values, which come out as "NA". How can i ignore them or replace them by another number? Greetings, Thomas
2007 Jun 27
3
Correlation ratio
Hi, I wanted to know how to compute the correlation ratio (eta) between two variables using R. Is there any function to compute the correlation ratio. Any help will be very much appreciated. Thanks, Suman [[alternative HTML version deleted]]
2011 Nov 25
3
counting values with some conditions in a simulation
Dear R users, I am running simulations (1000), and in my simulation I am looking at specific sums. For example, if the sum is >=4 then count this, if say <3, then don't count, if the sum=3, then generate a random number from uniform distribution, if this number is say less than 0.5, then count this sum, if greater than 0.5, then don't count. I am having trouble with introducing this
2012 May 25
4
Hash Table - Select and Change Data iniside Matrix
Hi, Here i have been a matrix like this, *NAME AGE PALCE TRUE/FALSE* ABC 20 INDIA XYZ 30 FRANCE PQR 40 USA MNO 30 KENIYA DEF 25 AUSTRALIA Here,* TRUE/FALSE* Column containing empty values. So my requirement what is , need to change all the *TRUE/FALSE *column value into "*TRUE*" where *AGE =
2012 May 12
2
ggplot simple question.
I have a matrix like this Name 1 2 3 4 5 NM_001039514 1.033557047 0.7469879518 0.9004524887 0.8613861386 0.7952499048 NM_001039723 1.0759493671 1.2315789474 0.8666666667 1.1142857143 0.9428011471 NM_001042605 0.9897435897 0.8870431894
2012 Oct 02
1
Ifelse Execution
Hi Everyone, I am trying to run a time based query and need some of your help. Not much of data or packages. Just a simple one. Query I am trying to execute. ifelse ((as.numeric(as.POSIXct("2012-10-01 20:38:00"))), (rnorm(1,2,1)),(Sys.sleep())) Note. Why I am using as.numeric is as I have a list of time at which I wanted to run the command. Something like 1349142243 1349138667
2017 Jun 03
2
New var
Thank you all for the useful suggestion. I did some of my homework. library(data.table) DFM <- read.table(header=TRUE, text='obs start end 1 2/1/2015 1/1/2017 2 4/11/2010 1/1/2011 3 1/4/2006 5/3/2007 4 10/1/2007 1/1/2008 5 6/1/2011 1/1/2012 6 10/5/2004 12/1/2004',stringsAsFactors = FALSE) DFM DFM$D =as.numeric(difftime(as.Date(DFM$end,format="%m/%d/%Y"),
2012 Jul 06
1
Problem using Lag on time series
I'm trying to duplicate something in Excel, where it is easy to reference the previous row in formula. Have been stuck on this for ages trying to achieve the same result in R. I've managed to do it with a loop but it takes ages on a large data set. What I want to do is create a new variable in a matrix that will refer to it's previous value if the ifelse statements aren't met.
2018 Jan 08
2
Replace NAs in split lists
Thank you Jeff. Your code works, as usual , perfectly. I am just wondering why if i put the whole code in one line, i get an error message. sdf2 <- lapply( sdf, function(z){z$Value <-ifelse(is.na(z$Value),z$Value[!is.na(z$Value)][1],z$Value)z}) error. unexpected symbol in sdf2 Thanks again EK On Mon, Jan 8, 2018 at 3:12 AM, Jeff Newmiller <jdnewmil at dcn.davis.ca.us> wrote: >
2012 May 31
0
ignore NA column in a DF (for calculation) without removing them
Dear users, I have for the moment a function which looks for the best correlation for each file I have in my correlation matrix. I'm working on a list.files. Here's the function: get.max.cor <- function(station, mat){ mat[row(mat) == col(mat)] <- -Inf which( mat[station, ] == max(mat[station, ],na.rm=TRUE) ) } If I have a correlation matrix like this
2017 Jun 04
2
New var
Thank you Jeff and All, Within a given time period (say 700 days, from the start day), I am expecting measurements taken at each time interval;. In this case "0" means measurement taken, "1" not taken (stopped or opted out and " -1" don't consider that time period for that individual. This will be compared with the actual measurements taken (Observed-
2012 Aug 23
1
Why was my R process killed spontaneously?
I tried to use gpuCor function in the gputools package of R to calcuate the pairwise correlations of a matrix of 40,000 columns. Becuase there would be memory issues if I use the whole matrix at a time, I splitted the matrix into submatrix of 10,000 columns and then calculate the pairwise correlation of different submatrices. There are altogether 4 submatrices, so I need to calculate the pearson
2012 May 06
3
correlation between XY coordinates
Hello r world, Does anyone know a function or package that can compute correlations between sets of XY coordinates? Thanks in advance for your help, Chris
2018 Jan 08
3
Replace NAs in split lists
Why do you want to modify df1? Why not just reassemble the parts as a new data frame and use that going forward in your calculations? That is generally the preferred approach in R so you can re-do your calculations easily if you find a mistake later. -- Sent from my phone. Please excuse my brevity. On January 7, 2018 7:35:59 PM PST, Ek Esawi <esawiek at gmail.com> wrote: >I just came
2010 Sep 20
1
Please help with this error - new to
I am getting the following error in my script. I am very very new to R and have obtained this script from another person. #read file in (dummy data) starburst.plot<-function(affy.fold, affy.FDR)(ifelse( ((affy.fold) >=0), -1*log10(affy.FDR), 1*log10(affy.FDR))) starburst.plot<-function(meth.fold, meth.FDR)(ifelse( ((meth.fold) >=0), -1*log10(meth.FDR), 1*log10(affy.FDR))) At my next