R
Sent: Mon, May 9, 2022 12:44 pm
Subject: Re: [R] Filtering an Entire Dataset based on Several Conditions
Dear Rui,
I was trying to dput() the datasets I am working on, but since it is a bit
large (42,000 rows by 60 columns) couldnĀ“t retrieve all the structure of
the data to include it here
This is trivial, so perhaps there is a miscommunication. How do you want to
handle values outside your desired range? I would simply change them to NA
(see below), but perhaps you have something else in mind that you need to
describe more explicitly. Anyway, below is a simple example of what I
Hello,
My code seems to work with your data, except that the first column is
not to be scaled.
# file names
xlsfile <- file.path("~/dados", "trainFeatures42k.xls")
csvfile <- file.path("~/dados", "Normalized_Data.csv")
# read in the data files
df1 <- readxl::read_excel(xlsfile, col_names =
Hello,
Something like this?
First normalize the data.
Then a apply loop creates a logical matrix giving which numbers are in
the range -3 to 3.
If they are all TRUE then their sum by rows is equal to the number of
columns. This creates a logical index i.
Use that index i to subset the scaled
Hi Paul,
Based on my guess that all values have been normalized, I would say:
mat<-(matrix(runif(16,-5,5),4))
df<-as.data.frame(mat)
df[abs(df) < 3]<-NA
df
V1 V2 V3V4
1 NA 4.675699 3.166625NA
2 NA NA NA 3.463660
3 4.288831 NA
Dear friends,
I have a dataframe which every single (i,j) entry (i standing for ith row,
j for jth column) has been normalized (converted to z-scores).
Now I want to filter or subset the dataframe so that I only end up with a a
dataframe containing only entries greater than -3 or less than 3.
6 matches
Mail list logo