Because that sets the enclosing environment, not the frame in which the symbol is resolved. There are at least three possible sources of confusion here:
`environment' gets used in two senses in R documentation, one as a frame and one as an environment tree, that is as a frame and its enclosure (and so on recursively). Note that objects do not really `live' in environments: symbols in frames have values and an object can be the value of several symbols. (People talk about bindings here: there are symbols are bound to objects, but objects can be bound to multiple symbols.) Closures (most functions, including all user-written functions) have formals, a body, and an environment tree `attached to' or `associated with' the function. This is called the 'environment' of the function, but the 'enclosure' might be less confusing (since it acts as the enclosure of the frame created for the body of the function when it is evaluated).
ちなみに関連して,R-helpに3.3.1 Lexical scopingという記事もある.
library(rgl) lat <- matrix(seq(90,-90, len=50)*pi/180, 50, 50, byrow=TRUE) long <- matrix(seq(-180, 180, len=50)*pi/180, 50, 50) r <- 6378.1 # radius of Earth in km x <- r*cos(lat)*cos(long) y <- r*cos(lat)*sin(long) z <- r*sin(lat) open3d() persp3d(x, y, z, col="white", texture= "ika.png", specular="black", axes=FALSE, box=FALSE, xlab="", ylab="", zlab="", normal_x=x, normal_y=y, normal_z=z) play3d(spin3d(axis=c(0,0,1), rpm=8), duration=5) # 回転させる
http://www.a-k-r.org/d/2010-09/bmi-gnu_r-ggplot-3.png
なんて操作をして,ついでに
write.table(cards, file = "cards.csv")
を実行して,Excel97で開かせて,もろ文字化けを食らった. とりあえず
write.table(iconv(cards, to="UTF-8"), file = "cards.csv")
としておくと OpenOffice? では開けるが,Excel は化ける. 後でExcel では [外部データの取り込み]メニューを使って UTF-8 を指定して読み込めばよろしい,と教わった.