The full code and error message i get is...
> cleanse <- function(a){
+ data1<-a
+ for (i in 1:dim(data1)[1])
+ {
+ if (data1[i,"legal_status"] == "Private"){
+ data1[i,"legal_status"]<-data1[-i,]
+ if (data1[i,"legal_status"] == "Private (Op"){
+ data1[i,"legal_status"]<
The solution is much simpler (thanks Phil!)
new_data = data[!data$"legal status" %in% c("Private","Private
(Op","Unknown"),]
...works nicely.
frenchcr wrote:
>
> hello folks,
>
> Im trying to clean out a large file with data i dont need.
> The column im manipulating in the file i
On Nov 13, 2009, at 2:32 PM, frenchcr wrote:
hello folks,
Im trying to clean out a large file with data i dont need.
The column im manipulating in the file is called "legal status"
Their are three kinds of rows i want to remove.
Those that have "Private", "Private (Op", or "Unknown" in the
l
?subset
- Original message -
From: "frenchcr"
To: r-help@r-project.org
Date: Fri, 13 Nov 2009 11:32:35 -0800 (PST)
Subject: [R] cleanse columns and unwanted rows
hello folks,
Im trying to clean out a large file with data i dont need.
The column im manipulating in the file
hello folks,
Im trying to clean out a large file with data i dont need.
The column im manipulating in the file is called "legal status"
Their are three kinds of rows i want to remove.
Those that have "Private", "Private (Op", or "Unknown" in the legal_status
column.
I wrote this code but it sy
5 matches
Mail list logo