Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
friendlyts
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
RfriendlyTS
friendlyts
Commits
ad1bfb8e
Commit
ad1bfb8e
authored
6 years ago
by
jml
Browse files
Options
Downloads
Patches
Plain Diff
possibility to combine many dataset at the same time
parent
8869400e
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
R/combine.R
+14
-10
14 additions, 10 deletions
R/combine.R
man/combine.Rd
+2
-4
2 additions, 4 deletions
man/combine.Rd
with
16 additions
and
14 deletions
R/combine.R
+
14
−
10
View file @
ad1bfb8e
...
...
@@ -2,8 +2,7 @@
#' combine
#' combine
#' @param dataset1 friendlyts object
#' @param dataset2 friendlyts object
#' @param ... friendlyts data.frame
#' @param precision precision
#' @param CHECKNAS CHECKNAS
#' @keywords friendlyts
...
...
@@ -12,16 +11,21 @@
#' \dontrun{
#' combine()
#' }
combine
<-
function
(
dataset1
,
dataset2
,
precision
,
CHECKNAS
=
TRUE
){
if
(
inherits
(
dataset1
,
"tbl_friendlyts"
)
&&
inherits
(
dataset2
,
"tbl_friendlyts"
))
{
icol
<-
get_non_date_col
(
precision
=
precision
)
res
<-
cbind
(
dataset1
,
dataset2
[,
icol
:
ncol
(
dataset2
)])
combine
<-
function
(
...
,
precision
,
CHECKNAS
=
TRUE
){
dataset
<-
list
(
...
)
test
<-
lapply
(
dataset
,
function
(
x
)
inherits
(
x
,
"tbl_friendlyts"
))
test
<-
prod
(
unlist
(
test
))
if
(
test
==
1
)
{
icol
<-
get_date_col
(
precision
=
precision
)
res
<-
dplyr
::
bind_cols
(
lapply
(
dataset
,
function
(
x
){
res
<-
x
[,
-
icol
]
return
(
res
)
}))
res
<-
dplyr
::
bind_cols
(
dataset
[[
1
]][,
icol
],
res
)
res
<-
as_tbl_friendlyts
(
df
=
res
,
date_type
=
"friendlyts"
,
precision
=
precision
,
CHECKNAS
=
CHECKNAS
)
return
(
res
)
}
else
stop
(
"Both datasets must be of class tbl_friendlyts"
)
return
(
res
)
}
This diff is collapsed.
Click to expand it.
man/combine.Rd
+
2
−
4
View file @
ad1bfb8e
...
...
@@ -5,12 +5,10 @@
\title{combine
combine}
\usage{
combine(
dataset1, dataset2
, precision, CHECKNAS = TRUE)
combine(
...
, precision, CHECKNAS = TRUE)
}
\arguments{
\item{dataset1}{friendlyts object}
\item{dataset2}{friendlyts object}
\item{...}{friendlyts data.frame}
\item{precision}{precision}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment