Hi friends, I have a query regarding na.omit function.Please ,someone help me. I have a function xyz_function<-function(arguments) { some code return(list(matrix=dataset)) } xyz_function_returnvalue<-xyz_function(passed argumentss) *Case-I* xyz_function_returnvalue_deletingNArows<-na.omit((xyz_function_returnvalue)) *Case-II* xyz_function_returnvalue_dataframe_deletingNArows<-na.omit(as.data.frame((pair_raw_data$matrix))) Both case I and II don't work.My dataset has rows with NA values,that's for sure. Whereas this simple code,works fine.I mean from the data frame the rows containing NA values could be easily deleted. DF <- data.frame(x = c(1, 2, 3), y = c(0, 10, NA)) DF<-na.omit(DF) print(DF) -- Thanks Moumita [[alternative HTML version deleted]]
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html<http://www.r-project.org/posting-guide.html> and provide commented, minimal, self-contained, reproducible code. We have no idea of the structure of 'dataset' that is being returned by your function. This example works fine for dataframes:> x <- list(matrix=data.frame(x = c(1, 2, 3), y = c(0, 10, NA))) > x$matrix x y 1 1 0 2 2 10 3 3 NA> na.omit(x$matrix)x y 1 1 0 2 2 10> na.omit(as.data.frame(x$matrix))x y 1 1 0 2 2 10>You might also look at 'complete.cases', but a real example would be helpful in providing information. On Fri, May 22, 2009 at 9:41 AM, Moumita Das <das.moumita.online@gmail.com>wrote:> Hi friends, > I have a query regarding na.omit function.Please ,someone help me. > > I have a function > xyz_function<-function(arguments) > { > some code > return(list(matrix=dataset)) > } > > xyz_function_returnvalue<-xyz_function(passed argumentss) > > *Case-I* > > xyz_function_returnvalue_deletingNArows<-na.omit((xyz_function_returnvalue)) > *Case-II* > > xyz_function_returnvalue_dataframe_deletingNArows<-na.omit(as.data.frame((pair_raw_data$matrix))) > > Both case I and II don't work.My dataset has rows with NA values,that's for > sure. > > > > Whereas this simple code,works fine.I mean from the data frame the rows > containing NA values could be easily deleted. > > DF <- data.frame(x = c(1, 2, 3), y = c(0, 10, NA)) > DF<-na.omit(DF) > print(DF) > > -- > Thanks > Moumita > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html<http://www.r-project.org/posting-guide.html> > and provide commented, minimal, self-contained, reproducible code. >-- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? [[alternative HTML version deleted]]
Hi Jim, xyz_function<-function(arguments)> { > some codepair_raw_data<-changeMissingValuestoNA(pair_raw_data$matrix,pair_raw_data$dim,missing_values)> > return(list(matrix=pair_raw_data)) > }Type of my dataset was a "list".I tried checking that ,changing my dataset to some other types. Thanks Moumita On Fri, May 22, 2009 at 7:11 PM, Moumita Das <das.moumita.online@gmail.com>wrote:> > Hi friends, > I have a query regarding na.omit function.Please ,someone help me. > > I have a function > xyz_function<-function(arguments) > { > some code > return(list(matrix=dataset)) > } > > xyz_function_returnvalue<-xyz_function(passed argumentss) > > *Case-I* > > xyz_function_returnvalue_deletingNArows<-na.omit((xyz_function_returnvalue)) > *Case-II* > > xyz_function_returnvalue_dataframe_deletingNArows<-na.omit(as.data.frame((pair_raw_data$matrix))) > > Both case I and II don't work.My dataset has rows with NA values,that's for > sure. > > > > Whereas this simple code,works fine.I mean from the data frame the rows > containing NA values could be easily deleted. > > DF <- data.frame(x = c(1, 2, 3), y = c(0, 10, NA)) > DF<-na.omit(DF) > print(DF) > > -- > Thanks > Moumita >-- Thanks Moumita [[alternative HTML version deleted]]
Reasonably Related Threads
- Insert rows in between dataframes
- Error: system is computationally singular: reciprocal condition number
- How to get the unique pairs of a set of pairs dataframe ?
- Fwd: Cannot allocate a new database connection error
- How to generate mean anova value row in anova table, instead of individual value for each predictor