Giter Club home page Giter Club logo

rbasic_revised's Issues

#100

在windows 7

tmp <- read.table('cl_info_other.csv', sep = ',',stringsAsFactors = F, header = T, nrows = 1000)

Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, :
line 1 did not have 14 elements

可用read.csv

p63頁

建議加入str函數 說明my_data變數的class

#125

希望可以有產生magic vector的code chunk

ubuntu cannot run say command ...

  • please replace the following codes:
for (i in 1:5){
    system("say 'Nann Moll Ah Mi Tow Fo'")
    system("say 'Ah Men'")
}
  • with
for (i in 1:5){
    system("espeak 'Nann Moll Ah Mi Tow Fo'")
    system("espeak 'Ah Men'")
}

espeak error msg on Ubuntu 12.04 (p.122)

ALSA lib pcm_dmix.c:1018:(snd_pcm_dmix_open) unable to open slave
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib audio/pcm_bluetooth.c:1614:(audioservice_expect) BT_GET_CAPABILITIES failed : Input/output error(5)
ALSA lib audio/pcm_bluetooth.c:1614:(audioservice_expect) BT_GET_CAPABILITIES failed : Input/output error(5)
ALSA lib audio/pcm_bluetooth.c:1614:(audioservice_expect) BT_GET_CAPABILITIES failed : Input/output error(5)
ALSA lib audio/pcm_bluetooth.c:1614:(audioservice_expect) BT_GET_CAPABILITIES failed : Input/output error(5)
ALSA lib pcm_dmix.c:957:(snd_pcm_dmix_open) The dmix plugin supports only playback stream
ALSA lib pcm_dmix.c:1018:(snd_pcm_dmix_open) unable to open slave
Cannot connect to server socket err = No such file or directory
Cannot connect to server socket
jack server is not running or cannot be started
ALSA lib pcm_dmix.c:1018:(snd_pcm_dmix_open) unable to open slave
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib audio/pcm_bluetooth.c:1614:(audioservice_expect) BT_GET_CAPABILITIES failed : Input/output error(5)
ALSA lib audio/pcm_bluetooth.c:1614:(audioservice_expect) BT_GET_CAPABILITIES failed : Input/output error(5)
ALSA lib audio/pcm_bluetooth.c:1614:(audioservice_expect) BT_GET_CAPABILITIES failed : Input/output error(5)
ALSA lib audio/pcm_bluetooth.c:1614:(audioservice_expect) BT_GET_CAPABILITIES failed : Input/output error(5)
ALSA lib pcm_dmix.c:957:(snd_pcm_dmix_open) The dmix plugin supports only playback stream
ALSA lib pcm_dmix.c:1018:(snd_pcm_dmix_open) unable to open slave
Cannot connect to server socket err = No such file or directory
Cannot connect to server socket
jack server is not running or cannot be started

#145

用 utils::browseURL 使用預設瀏覽器打開 .R 檔案

[Win8] #100

[win8] cl_info_other.csv 要改成 cl_info_other_windows.csv 才讀的了

[WIN 8.1] Template 檔中文註解顯示亂碼 (p. 147, p. 149, p. 159)

OS: Windows 8.1

P.147
path <- DSC2014Tutorial::Basic_file("barnsley_fern_template.R")
utils::browseURL(path)

P.149
path <- DSC2014Tutorial::Basic_file("barnsley_fern_answer.R")
utils::browseURL(path)

P.159
path <- DSC2014Tutorial::Basic_file("battleship_template.R")
utils::browseURL(path)

template 檔中文註解顯示亂碼。

R Markdown第54頁的程式碼%>%無法使用

mtcars %>%
ggvis(x = ~wt, y = ~mpg) %>%
layer_smooths(se=TRUE, opacity := 0.5, opacity.hover := 0.75) %>%
layer_points(fill = ~factor(cyl), size := 50, size.hover := 200) %>%
set_options(hover_duration = 250)

Error: could not find function "%>%"
Error: unexpected SPECIAL in "%>%"

R Basic的第156頁簡報,Template無法使用

battleship <- function(num_guess){

由電腦隨機決定一組坐標。

ship_x <- _____
ship_y <- _____

初始的地圖。

map =list(c('O', 'O', 'O', 'O', 'O'),
c('O', 'O', 'O', 'O', 'O'),
c('O', 'O', 'O', 'O', 'O'),
c('O', 'O', 'O', 'O', 'O'),
c('O', 'O', 'O', 'O', 'O'))

描繪地圖。

for (row in map){
______
}

trial: 玩家已猜測次數。

trial <- 0
while (){
# 玩家選定坐標 x 與 y 。
x <- as.numeric(readline('Guess the x:'))
y <- as.numeric(readline('Guess the y:'))
# 根據玩家選定之 x 與 y 更新 map。
map[[**
]][**
] <- 'X'
# 繪製地圖。
for (
){
print(row)
}
# 根據玩家猜測的結果,顯示適當資訊與更新相關變數。
if (________){
cat('Oh NO~~~You shrink my boat!!')
break
} else{
cat('You miss.')
trial <- ____
}
# 當玩家用完所有機會,顯示遊戲結束的訊息與電腦的 x 與 y 坐標。
if (_______){
cat('You loss.\n')
cat("The battleship's x-coordinate is", ship_x, '\n')
cat("The battleship's y-coordinate is", ship_y, '\n')
}
}

}

註解部分的建議 (p.160)

建議將
sample.int(5, 1) # 從 15 中隨機抽取 1 個數字。
修改為
sample.int(5, 1) # 從 1
5 中隨機抽取 1 個正整數。

159頁

  while (trial < num_guess){
                x <- as.numeric(readline('Guess the x:'))
                y <- as.numeric(readline('Guess the y:'))
                if (x <= 5 && y <= 5 && x > 0 && y > 0){ 
                        map[[y]][x] <- 'X'
                        for (r in map){
                                print(r)
                        }
                        if (x == ship_x & y == ship_y){
                                cat('Oh NO~~~You shrink my boat!!')
                                break
                        } else{
                                cat('You miss.')
                                trial <- trial + 1
                        }

下面少兩個括號

R Basic的第146頁簡報,Template畫不出來

畫不出來 冏

rm(list = ls())
set.seed(3690)

設定起始點為 (0, 0) 的行向量。(以矩陣表示)

p = matrix(c(0, 0), ncol = 1)

建立名為 coord 的 data.frame。

coord = rbind(data.frame(), t(p))
for () {
# 從 uniform(0, 1) 中抽取 indicator 決定當次遞迴式。
indicator = runif(1, 0, 1)
# 根據抽樣結果決定遞迴式。
if (indicator <= 0.05) {
m = __________
const = matrix(c(0, 0), ncol = 1)
} else if (
) {
m = matrix(c(0.85, -0.04, 0.04, 0.85), nrow = 2, ncol = 2)
const = ______
} else if (
____) {
m = ______
const = ______
} else {
m = ______
const = ______
}
# 計算新的 p 坐標值。
p = _______
# 將新的 p 點坐標合併至 coord 中。
coord = _______
}

作圖。

plot(x = coord[, 2], y = coord[, 1], plt = c(0, 10, -5, 5), cex = 0.1, asp = 1)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.