Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Jul 05 06:33
    0803tina commented #30
  • Jul 04 12:08
    tpemartin closed #31
  • Jul 04 12:08
    tpemartin closed #30
  • Jul 03 16:16
    tpemartin commented #31
  • Jul 03 15:22
    tpemartin closed #29
  • Jul 03 15:22
    tpemartin closed #27
  • Jul 03 15:17
    tpemartin milestoned #31
  • Jul 03 15:17
    tpemartin labeled #31
  • Jul 03 15:17
    tpemartin assigned #31
  • Jul 03 15:17
    tpemartin commented #31
  • Jul 03 15:03
    ailienchen edited #31
  • Jul 03 15:03
    ailienchen opened #31
  • Jul 03 10:51
    tpemartin milestoned #26
  • Jul 03 10:51
    tpemartin labeled #26
  • Jul 03 10:37
    tpemartin milestoned #30
  • Jul 03 10:37
    tpemartin labeled #30
  • Jul 03 10:37
    tpemartin assigned #30
  • Jul 03 10:37
    tpemartin commented #30
  • Jul 03 10:34
    tpemartin milestoned #29
  • Jul 03 10:34
    tpemartin labeled #29
HHY2000
@HHY2000
fizzbuzz_fun <- function(x){
  if(x %% 3 == 1){
    print("Fizz")
    }
  else if(x %% 3 == 2){
    print("Buzz")
  }
  else if(x %% 3 == 0){
    print("FizzBuzz")
  }
  else{
    print(x)
  }
}
PeiYuChenn
@PeiYuChenn
fizzbuzz <- function(x){
  k <- x%%3
  j <- x%%5
  if(k==0){
    message("fizz")
  }
  else if(j==0){
    message("buzz")
  }
  else if(j==0 & k==0){
    massage("fizzbuzz")
  }
  else{
    return(x)
  }
}
Daphne-Flash
@Daphne-Flash
fizzbuzz <- function(x){
  if(x %% 15== 0){
    print("fizzbuzz")}
    else if(x%% 3 ==0){
      print("fizz")
    }else if (x%% 5 == 0){
      print("buzz")
    }else {
      return(x)
    }
  }
roderick11
@roderick11
utility_cobb_douglass(1,.beta=0.8,2,.alpha=0.5)
mrstadashi
@mrstadashi
utility_cobb_douglass2(1,2,.beta = 0.8,.alpha = 0.5)
kaeru1226narukami
@kaeru1226narukami
utility_cobb_douglass(1,.beta=0.8,.alpha=0.5,2)
KaEDe1106
@KaEDe1106
utility_cobb_douglass(.beta=0.8,2,0.5,x=1)
Martin老師
@tpemartin
utility_cobb_douglass(1,2,0.5,0.8)
utility_cobb_douglass(1,2,.beta=0.8,.alpha=0.5)
utility_cobb_douglass(1,.beta=0.8,2,0.5)
utility_cobb_douglass(1,.beta=0.8,.alpha=0.5,2)
shuyulin97
@shuyulin97
utility_cobb_douglass(y=2,x=1,0.5,0.8)
amypiggy
@amypiggy
utility_cobb_douglass(.alpha=0.5,2,x=1,0.8)
bill0201
@bill0201
utility_cobb_douglass(.alpha=0.5,.beta=0.8,x=1,y=2)
ailienchen
@ailienchen
utility_cobb_douglass(.beta=0.8,.alpha=0.5,1,2)
bobbidi0122
@bobbidi0122
utility_cobb_douglass(y=2, x=1,.beta=0.8,05)
jane629
@jane629
utility_cobb_douglass(.beta = 0.8,x=1,.alpha = 0.5,y=2)
Daphne-Flash
@Daphne-Flash
utility_cobb_douglass(y=2,x=1,0.5,0.8)
funkjerry
@funkjerry
utility_cobb_douglass2(y=2,x=1,.beta=0.8,.alpha=0.5)
hereisjulia
@hereisjulia
utility_cobb_douglass(y=2,1,0.5,0.8)
Martin老師
@tpemartin
# 作法一
for(i in gmailAddress){
  print(i)
}
# 作法二
for(i in c(1:4)){
  print(i)
  print(gmailAddress[[i]])
}
# 作法三
for(i in seq_along(gmailAddress)){
  print(i)
  print(gmailAddress[[i]])
}
funkjerry
@funkjerry
for(i in seq_along(gmailAddress)){
  print(gmailAddress[[i]])
}
yureginayu2321
@yureginayu2321
for (i in gmailAddress) {
  print(i)

}
for (i in c(1:4)) {
  print(gmailAddress[[i]])

}

for (i in seq_along(gmailAddress)) {
  print(gmailAddress[[i]])

}
Daphne-Flash
@Daphne-Flash
for (i in gmailAddress) {
  print(i)
}
for (i in c(1:4)) {
  print(i)
  print(gmailAddress[[i]])
}
for (i in seq_along(gmailAddress)) {
  print(i)
  print(gmailAddress[[i]])
}
hereisjulia
@hereisjulia

for (g in gmailAddress) {
  print(g)
}

for (g in c(1:4)) {
  print(g)
  print(gmailAddress[[g]])
}

for (g in seq_along(gmailAddress)) {
  print(gmailAddress[[g]])
}
KaEDe1106
@KaEDe1106
任務:一一檢查gmailAddress每個元素,若沒有寫"@gmail.com"則加上。
gmailAddress <- c(
  "tim@gmail.com",
  "anita",
  "yellen@gmail.com",
  "huang@gmail.com"
)

library(stringr)

for(i in seq_along(gmailAddress)){
  if(!(str_detect(gmailAddress[[i]],"@gmali.com"))){
    gmailAddress[[i]] <- str_c(gmailAddress[[i]],"@gmali.com")
  }
}
gmailAddress
Martin老師
@tpemartin
@KaEDe1106 很棒,超前老師進度。🤓👍🏽👍🏽👍🏽💯
0803tina
@0803tina
library(stringr)
for(i in seq_along(gmailAddress)){
  if (str_detect(gmailAddress[[i]],"@gmail.com")){
    print(gmailAddress[[i]])}
  else{
    print(str_c(gmailAddress[[i]],"@gmail.com"))
  }

}
xiao89S
@xiao89S
library(stringr)
for (i in seq_along(gmailAddress)) {
  if(str_detect(gmailAddress[i],"gmail.com")){
    print(gmailAddress[i])
  }else{
    print(str_c(gmailAddress[i],"@gmail.com"))
  }
}
hereisjulia
@hereisjulia
##sequence source
##body
##for loop
library(stringr)
for (i in seq_along(gmailAddress)) {
  if(str_detect(gmailAddress[i],"@gmail.com")){
    print(gmailAddress[i])
  }else{
    print(str_c(gmailAddress[i],"@gmail.com"))
  }
}
Daphne-Flash
@Daphne-Flash
library(stringr)
for(i in seq_along(gmailAddress)){
  if(!(str_detect(gmailAddress[[i]],"@gmali.com"))){
    gmailAddress[[i]] <- str_c(gmailAddress[[i]],"@gmali.com")
  }
}
gmailAddress
Martin老師
@tpemartin
# 開始設定
gmailAddress <- c(
  "tim@gmail.com",
  "anita",
  "yellen@gmail.com",
  "huang@gmail.com"
)
cat("起始狀況\n")
gmailAddress

# for loop
for(i in seq_along(gmailAddress)){
  if(!str_detect(gmailAddress[[i]],"@gmail.com")){
    correctGmailAddress <-
      str_c(gmailAddress[[i]],"@gmail.com")
    gmailAddress[[i]] <- correctGmailAddress
  }
}

cat("修正後狀況\n")
gmailAddress
KaEDe1106
@KaEDe1106
for(i in seq_along(commitHistory)){
  print(commitHistory[[i]]$commit$author$name)
}
Martin老師
@tpemartin

for(i in seq_along(commitHistory)){
  print(
    str_c(
      "Author is ",
      commitHistory[[i]][["commit"]][["author"]][["name"]],
      ". Committer is ",
      commitHistory[[i]][["commit"]][["committer"]][["name"]]
      )
    )
}
roderick11
@roderick11
for(i in seq_along(commitHistory)){
  print(commitHistory[[i]]$commit$author$name)
}
for(i in seq_along(commitHistory)){
  print(commitHistory[[i]]$commit$committer$name)
}
funkjerry
@funkjerry
for(i in seq_along(commitHistory)){
  print(commitHistory[[i]][["commit"]][["committer"]][["name"]])
}
bobbidi0122
@bobbidi0122
for(i in seq_along(commitHistory)){
  print(commitHistory[[i]][["commit"]][["author"]][["name"]])
}

for(i in seq_along(commitHistory)){
  print(commitHistory[[i]][["commit"]][["committer"]][["name"]])
}

for(i in seq_along(commitHistory)){
  print(commitHistory[[i]][["commit"]][["committer"]][["date"]])
}
0803tina
@0803tina
for (i in seq_along(commitHistory)){
  print(commitHistory[[i]]$commit$author$name)
}
yureginayu2321
@yureginayu2321

for (i in seq_along(commitHistory)) {

  print(commitHistory[[i]]$commit$author$name)

}
0803tina
@0803tina
for (i in seq_along(commitHistory)){
  print(commitHistory[[i]]$commit$author$name == commitHistory[[i]]$commit$committer$name)
}
mrstadashi
@mrstadashi
for(i in seq_along(commitHistory)){
  print(commitHistory[[i]]$commit$author$name)
}
Martin老師
@tpemartin

任務0:print「每個」commit的author等於committer的邏輯判斷結果。

sequence source

commitHistory

body

print「第i個」commit的author等於committer的邏輯判斷結果。

i <- 1

(commitHistory[[i]][["commit"]][["author"]][["name"]]==commitHistory[[i]][["commit"]][["committer"]][["name"]]) -> logiResult
print(logiResult)

for loop

for(i in seq_along(commitHistory)){
  (commitHistory[[i]][["commit"]][["author"]][["name"]]==
     commitHistory[[i]][["commit"]][["committer"]][["name"]]) ->
    logiResult
  print(logiResult)  
}
yui6532
@yui6532
for (i in seq_along(commitHistory)){
  print(
    commitHistory[[i]][["commit"]][["author"]][["name"]] == commitHistory[[i]][["commit"]][["committer"]][["name"]]
  )
}
funkjerry
@funkjerry
for(i in seq_along(commitHistory)){
  (commitHistory[[i]][["commit"]][["committer"]][["name"]])==(commitHistory[[i]][["commit"]][["author"]][["name"]]) ->logiresult
  print(logiresult)
}
KaEDe1106
@KaEDe1106
for(i in seq_along(commitHistory)){
  log1 <- commitHistory[[i]]$commit$author$name == commitHistory[[i]]$commit$committer$name
  cat(log1)
}
Lihsin0816
@Lihsin0816
for(i in seq_along(commitHistory)){
  print(
    commitHistory[[i]]$commit$author$name==commitHistory[[i]]$commit$committer$name
  )
}
hereisjulia
@hereisjulia
for (i in seq_along(commitHistory)){
  print(
    (commitHistory[[i]][["commit"]][["author"]][["name"]] )== (commitHistory[[i]][["commit"]][["committer"]][["name"]])
  )}
c00093090
@c00093090
for(i in seq_along(commitHistory)){
  (commitHistory[[i]][["commit"]][["committer"]][["name"]])==(commitHistory[[i]][["commit"]][["author"]][["name"]]) ->logiresult
  print(logiresult)
}
yinghsuan726
@yinghsuan726
for (i in seq_along(commitHistory)) {
  (commitHistory[[i]][["commit"]][["committer"]][["name"]]==commitHistory[[i]][["commit"]][["author"]][["name"]])->logisame
  print(logisame)
}
Martin老師
@tpemartin

練習

任務一:存下來每個commit的author。

load(url("https://www.dropbox.com/s/qnz9paigf61yjus/commitHistory.Rda?raw=1"))

0. saving container

saveCommitAuthor <-
  vector("character",length(commitHistory))

1. sequence source

commitHistory

2. body

存下來「第i個」commit的author。

i<- 1

commitHistory[[i]]$commit$author$name -> saveCommitAuthor[[i]]

檢查一下

saveCommitAuthor

3. for loop

saveCommitAuthor <-
  vector("character",length(commitHistory)) # 0.
for(i in seq_along(commitHistory)){
  commitHistory[[i]]$commit$author$name -> saveCommitAuthor[[i]]
}

saveCommitAuthor
ArthurGuangTing
@ArthurGuangTing
logiresult <- vector("logical",length(commitHistory))
for (i in seq_along(commitHistory)) {
  logiresult[[i]] <- (commitHistory[[i]]$commit$author$name
        ==commitHistory[[i]]$commit$committer$name)
}
commitDATE <- vector("character",length(commitHistory))
for (i in seq_along(commitHistory)) {
  commitHistory[[i]]$commit$committer$date -> commitDATE[[i]]
}
commitDATE[logiresult] -> commitDatee
commitDatee
yui6532
@yui6532
isSame <-  vector("logical",length(commitHistory))
for (i in seq_along(commitHistory)){
  isSame[[i]] <- commitHistory[[i]][["commit"]][["author"]][["name"]] == commitHistory[[i]][["commit"]][["committer"]][["name"]]
  b <- commitHistory[isSame]
}
commitdate <- vector("character",length(b))
for (i in seq_along(b)){
  commitdate[[i]] <- b[[i]][["commit"]][["author"]][["date"]]

}



commitdate
Martin老師
@tpemartin

任務三:存下來每個author與committer同人的commitDate。

過渡任務:
存下來每個commit的author, committer, commitDate.
存下來每個commit的author==commiter的結果

0. saving container

saveEveryThing <- vector("list",length(commitHistory))
saveSameLogi <- vector("logical",length(commitHistory))

1. sequence source

commitHistory

2. body

i <- 1

author_i <- commitHistory[[i]]$commit$author$name
committer_i <- commitHistory[[i]]$commit$committer$name
commitDate_i <- commitHistory[[i]]$commit$committer$date

(author_i==committer_i) -> saveSameLogi[[i]]
list(
  author=author_i,
  committer=committer_i,
  commitDate=commitDate_i
) -> saveEveryThing[[i]]

檢查一下

saveEveryThing
saveSameLogi

3. for loop

saveEveryThing <- vector("list",length(commitHistory))
saveSameLogi <- vector("logical",length(commitHistory))
for(i in seq_along(commitHistory)){
  author_i <- commitHistory[[i]]$commit$author$name
  committer_i <- commitHistory[[i]]$commit$committer$name
  commitDate_i <- commitHistory[[i]]$commit$committer$date

  (author_i == committer_i) -> saveSameLogi[[i]]

  list(
    author=author_i,
    committer=committer_i,
    commitDate=commitDate_i
  ) -> saveEveryThing[[i]]  
}
saveEveryThing
print(saveSameLogi)
saveEveryThing[saveSameLogi] -> saveValidCommitDate
saveValidCommitDate