How do you retrieve some data frames or otherwise circumvent the restriction to return one result to R?
-
There's a few Frames.
a <- c(1:4) a <- as.data.table(a) a[[1]] <- c(a:d) a[[2]] <- c(15,20,30,35)
b <- c(1:4)
b <- as.data.table(b)
b[[1]] <- c(1:4)
b[[2]] <- c(15,30,35,20)
I'd like to write a function that accepts a list of Frames.
s <- c("a","b")
and sorts them in the same way
baseSort(s,2,"d")
baseSort = function(list,indexColumn,sortType="a") {
SortTableName <- list[1]
.
код
.
}
The function trimms the first specified frime by increasing or losing one of the columns indexColumn = 2...n of the first frauma in the list.
Where n is the number of Frame poles.The first column in all the Freumas is the same. All of the 2nd Frames listed in the list are further categorized as the first column in the same order as the first column of the first Frame after being sorted by age or departure in the previous step.
How do you get the result back from the function? It would be optimistic to separate directly from function a and b in globalenv() as well as how they are classified within the function.
but not
get(SortTableName) <- array1
neither
assign(get(SortTableName),array1)
Not working.
We need a working solution for R-3.5.2.
-
Any number of tables can be divided into the same column, for example:
library(data.table) a <- data.table(a = c(2, 3, 1, 4), b = 1:4) b <- copy(a) ab <- list(a, b) lapply(ab, function(x) setorder(x, a)) ab