Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Amine GHOZLANE
shaman
Commits
d82b7044
Commit
d82b7044
authored
Oct 02, 2019
by
Amine GHOZLANE
Browse files
Solve a defective case with the weighted normalization
parent
87292543
Pipeline
#15659
passed with stage
in 7 minutes and 29 seconds
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Rfunctions/Data_Management.R
View file @
d82b7044
...
...
@@ -770,12 +770,12 @@ w.sizefactor <- function(CT)
CT
[
which
(
CT
<
1
)]
=
NA
gm
=
apply
(
CT
,
1
,
geometric.mean
,
na.rm
=
TRUE
)
weights
=
nbsamp
-
apply
(
CT
,
1
,
FUN
=
function
(
x
){
tmp
=
length
(
which
(
is.na
(
x
)))
;
return
(
tmp
)})
weights_tmp
=
weights
for
(
i
in
1
:
ncol
(
CT
))
{
ind
=
which
(
is.na
(
CT
[,
i
]))
gm_tmp
=
gm
weights_tmp
=
weights
tmp
=
CT
[,
i
]
if
(
length
(
ind
)
>
0
)
{
tmp
=
CT
[
-
ind
,
i
];
gm_tmp
=
gm
[
-
ind
];
weights_tmp
=
weights
[
-
ind
]}
sf
[
i
]
=
w.median
(
tmp
/
gm_tmp
,
weights_tmp
,
na.rm
=
TRUE
)
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment