Skip to content

Commit 52f2195

Browse files
Changes to test files
1 parent 652d2d6 commit 52f2195

File tree

2 files changed

+35
-26
lines changed

2 files changed

+35
-26
lines changed

test/R/objects.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ arr0 <- array(numeric())
4747
arr1 <- array(1:10, c(10, 1, 1))
4848
arr2 <- array(1:10, c(1, 10, 1))
4949
arr3 <- array(1:10, c(1, 1, 10))
50+
arr4 <- array(1:12, c(2,3,2))
5051

5152
# list
5253
lst0 <- list()

test/R/test2.R

Lines changed: 34 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,39 @@
11

2-
gen_data <- function(n) {
3-
x <- rnorm(n)
4-
y <- 2 * x
5-
out <- data.frame(x = x, y = x)
6-
out
7-
}
2+
# options(vsc.showCustomAttributes = FALSE)
3+
# options(vsc.verboseVarInfos=TRUE)
4+
5+
# l <- list(a=1, b=2)
6+
7+
# l <- list(a=1, b=2, c=3)
8+
9+
# l$nested <- l
10+
11+
# x <- array(1:1000000, c(100,100,100))
12+
13+
# v <- 1:10000
14+
815

9-
calc_stats <- function(x, na.rm = TRUE) {
10-
qs <- quantile(x, c(0, 0.25, 0.5, 0.75, 1), na.rm = na.rm, names = FALSE)
11-
data.frame(
12-
mean = mean(x, na.rm = na.rm),
13-
sd = sd(x, na.rm = TRUE),
14-
min = qs[[1]],
15-
q25 = qs[[2]],
16-
median = qs[[3]],
17-
q75 = qs[[4]],
18-
max = qs[[5]]
19-
)
16+
# l <- replicate(10000, v, simplify=FALSE)
17+
18+
# v <- 1:3
19+
20+
21+
f <- function(x=9){
22+
print('ja....')
23+
print(x)
24+
print('..woll')
2025
}
2126

22-
main <- function() {
23-
xy_data <- gen_data(100) ###
24-
lm_obj <- lm(y ~ x, data = xy_data)
25-
beta <- coef(lm_obj)
26-
stats <- lapply(names(xy_data), function(name) {
27-
cbind(name, calc_stats(xy_data[[name]])) ###
28-
})
29-
print(beta)
30-
print(stats)
27+
main <- function(){
28+
print('hello world')
29+
f(4)
30+
print('done.')
3131
}
32+
33+
# main()
34+
35+
print(1)
36+
print(2)
37+
print(3)
38+
39+

0 commit comments

Comments
 (0)