I have a single Dataframe with the following structure:
A.Data is a vector with numeric data
A.Quartile is a vector with the calculation of quartiles for each A.data and which quartile belongs to this data. (Q1,Q2,Q3,Q4).
I used a very similar code to create the quantile and the Q which belongs to.
quantile(x <- rnorm(1001))
list2env(setNames(as.list(quantile(x <- rnorm(1001))),paste0("Q",1:5)),.GlobalEnv)
Now, ( and here is my problem) I have a .csv that I imported into R, with more than 400 elements with XYZ.Data vectors
So when I imported the .csv file into my environment, I would like to create a function to create in one time all the XYZ.Quartile vectors and I don't know how.
The point would be to read all elements in my list loaded into environment from a .csv file with a function and have the function to create the B.Quartile,C.Quartile,D.Quartile, vectors... one for each element in the list.
Anyone can help please?
Thank you very much for any comment.
PD: New Code Example
quantile(x <- Orange$circumference)
Orange<- within(Orange, Quartile <- as.integer(cut(Orange$circumference, quantile(Orange$circumference, probs=0:4/4), include.lowest=TRUE)))
Your example data is confusing. It's not clear what the structure of your data is so I'm just pretending your lists are columns of a matrix/data.frame.
EDIT 1 See the following code: