猿问

请问R语言升级会不会覆盖旧的版本?

R语言升级会不会覆盖旧的版本


素胚勾勒不出你
浏览 968回答 5
5回答

手掌心

Q1n <- 1:30f <- c(1,1)for (i in n) f <- c(f, f[length(f)-1]+f[length(f)])for (i in 1:(length(f)-1)) print(f[i]/f[i+1])从结果可以看到,貌似收敛到 0.618Q21) answer <- c(3)在for循环里:#每次都从answer中取最后一项,并把计算结果存到answer中(作为最后一项);2) j =1时: answer <- c(answer, ( 7* answer[ 1 ] ) %% 31) ==> answer = c(3, 21)3) j =2时:answer <- c(answer, ( 7* answer[ 2 ] ) %% 31) => answer = c(3,21, 21*7%%31)--->23<-----4) ...16)j=15时: answer中有16个元素;

UYOU

updateR()在其他目录下安装 R ,再将旧版本保留的 library 目录下的文件拷贝至新版本 library 目录下,然后update.packages() ;或卸载 R ,把 R 装到旧的目录下,然后 update.packages()。

白衣染霜花

f[1]<-f[2]<-1&nbsp;&nbsp;和&nbsp;我的f<-c(1,1)&nbsp;是等价的&nbsp;,仅仅是风格不同而已; f[1]&nbsp;<-&nbsp;f[2]&nbsp;<-&nbsp;1&nbsp;可以大致表示成: &nbsp;&nbsp;1)&nbsp;f&nbsp;<-&nbsp;c(0,&nbsp;1) &nbsp;&nbsp;2)&nbsp;f[1]&nbsp;<-&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;==>&nbsp;&nbsp;&nbsp;f&nbsp;=&nbsp;c(1,1)&nbsp; f[i]&nbsp;<-&nbsp;f[i-2]&nbsp;+&nbsp;f[i-1]&nbsp;的意思是第三项是第一项和第二项的和&nbsp;,和我的也是风格不同,你的代码更符合r的风格 r语言的数组可以增长,当下标超出当前的实际长度时,数组就增长到下标长度; 所以F[i]&nbsp;<-&nbsp;F[i-2]&nbsp;+&nbsp;F[i-1]的意思是:数组F长度增长1,增长的这项的取值是前两项的和; 我的代码把这个过程展开了,f&nbsp;<-&nbsp;c(f,&nbsp;f[length(f)-1]+f[length(f)])的意思是 f重新赋值,取值是这样一个数组,这个数组包含原来的f全部,并在最后追加一项,这一项的值是数组f的最后两项的和;其中length(f)是取数组f的最后一项的下标,length(f)-1是倒数第二项的下标;c(数组,元素)的意思是把用数组和元素构成一个新的数组,新数组的长度是旧数组的长度+1;

桃花长相依

#Q1f&nbsp;=&nbsp;c(1,1)for(i&nbsp;in&nbsp;2:30)&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;print(sprintf("i=%i,&nbsp;f[i-1]=%i,&nbsp;f[i]=%i,&nbsp;f[i-1]/f[i]=%.4f",&nbsp;i,&nbsp;f[i-1],&nbsp;f[i],&nbsp;f[i]/f[i-1]))&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;f=c(f,&nbsp;(f[i-1]+f[i]))&nbsp;&nbsp;#&nbsp;sum&nbsp;of&nbsp;last&nbsp;two&nbsp;element&nbsp;in&nbsp;f&nbsp;}&nbsp;123456789101112131415161718192021#&nbsp;Q2.&nbsp;每一步都打印出值,你可以参照一下>&nbsp;for&nbsp;(&nbsp;j&nbsp;in&nbsp;1:15)&nbsp;{+&nbsp;&nbsp;&nbsp;&nbsp;print(sprintf("j=%i,&nbsp;answer[j]=%i,&nbsp;7*answer[j]=%i,&nbsp;7*answer[j]%%31=%i",&nbsp;j,&nbsp;answer[j],&nbsp;7*answer[j],&nbsp;(7*answer[j])%%31))+&nbsp;&nbsp;&nbsp;&nbsp;answer&nbsp;<-&nbsp;c(answer,&nbsp;(&nbsp;7*&nbsp;answer[&nbsp;j&nbsp;]&nbsp;)&nbsp;%%&nbsp;31)+&nbsp;}[1]&nbsp;"j=1,&nbsp;answer[j]=3,&nbsp;7*answer[j]=21,&nbsp;7*answer[j]%31=21"[1]&nbsp;"j=2,&nbsp;answer[j]=21,&nbsp;7*answer[j]=147,&nbsp;7*answer[j]%31=23"[1]&nbsp;"j=3,&nbsp;answer[j]=23,&nbsp;7*answer[j]=161,&nbsp;7*answer[j]%31=6"[1]&nbsp;"j=4,&nbsp;answer[j]=6,&nbsp;7*answer[j]=42,&nbsp;7*answer[j]%31=11"[1]&nbsp;"j=5,&nbsp;answer[j]=11,&nbsp;7*answer[j]=77,&nbsp;7*answer[j]%31=15"[1]&nbsp;"j=6,&nbsp;answer[j]=15,&nbsp;7*answer[j]=105,&nbsp;7*answer[j]%31=12"[1]&nbsp;"j=7,&nbsp;answer[j]=12,&nbsp;7*answer[j]=84,&nbsp;7*answer[j]%31=22"[1]&nbsp;"j=8,&nbsp;answer[j]=22,&nbsp;7*answer[j]=154,&nbsp;7*answer[j]%31=30"[1]&nbsp;"j=9,&nbsp;answer[j]=30,&nbsp;7*answer[j]=210,&nbsp;7*answer[j]%31=24"[1]&nbsp;"j=10,&nbsp;answer[j]=24,&nbsp;7*answer[j]=168,&nbsp;7*answer[j]%31=13"[1]&nbsp;"j=11,&nbsp;answer[j]=13,&nbsp;7*answer[j]=91,&nbsp;7*answer[j]%31=29"[1]&nbsp;"j=12,&nbsp;answer[j]=29,&nbsp;7*answer[j]=203,&nbsp;7*answer[j]%31=17"[1]&nbsp;"j=13,&nbsp;answer[j]=17,&nbsp;7*answer[j]=119,&nbsp;7*answer[j]%31=26"[1]&nbsp;"j=14,&nbsp;answer[j]=26,&nbsp;7*answer[j]=182,&nbsp;7*answer[j]%31=27"[1]&nbsp;"j=15,&nbsp;answer[j]=27,&nbsp;7*answer[j]=189,&nbsp;7*answer[j]%31=3">&nbsp;

慕容708150

read.transactions("文件名",format="single",sep="\t",cols<-c(1,2),rm.duplicates=TRUE)其中format表示输入数据的格式,transactions可以接受两种数据格式,即single型和basket型single型表现为两列,第一列为交易号,第二列为该交易中包含的一项,例如:1可乐1雪碧2芬达1美年达2王老吉basket型一行表示一条交易记录,交易项之间用分隔符分开,分隔符在sep参数中设定:可乐雪碧美年达芬达王老吉
随时随地看视频慕课网APP
我要回答