Displaying 20 results from an estimated 928 matches for "dice".
Did you mean:
dce
2007 Oct 08
5
Dice simulation: Getting rep to re-evaluate sample()?
I'm trying to get R to simulate the sum of the values on 10 fair dice
(yes, it's related to a homework problem, but is not the problem
itself). I tried to do this:
> rep(sum(sample(1:6,100,replace=T)), times=10)
[1] 341 341 341 341 341 341 341 341 341 341
and noticed that sum(sample()) seems to be only evaluated once. How can
I overcome this, so that I get...
2009 Feb 02
4
New to R
...of the best languages I've found for getting tasks I'm interested in
done. I wrote this simple die roller and was curious to know if it is
R enough.
##############################################################################
#
# Input:
# die_size - 4, 6, 8, 10, 20
# number_of_dice - How many dice to roll
# number_of_rolls - How many times to roll the dice
#
# Output:
# rolls - The array holding the values of the dice
#
##############################################################################
#
function(die_size, number_of_dice, number_of_rolls)
{
rolls <- array...
2010 Apr 24
4
DICE Coefficient of similarity measure
Hi,
I wanted the DICE coefficient (similarity measure for binary variables)
to be calculated in R and found that the "igraph" package has the option
of "similarity.dice" to do this. But, for this command, the input object
should be an igraph object. But, I have a dataframe of columns
containing 1'...
2007 Mar 02
0
Dice dissimilarity output and 'phylo' function in R
...Tip labels:
NULL
Rooted; includes branch lengths".
So I guess this explains why the consensus function
does not work.
Another thing I noticed in the output from the
'dissimilarity' function is that when I compared the
distances computed in R with that from NTSYS or SAS,
for example dice and jaccard coefficients I realised
that the dice distances are very different while the
jaccard distances are the same with those from these
other softwares.
The codes I used for a small example are shown below:
samptest4<- scan (file = "samp-test4.txt")
samptest4<- matrix(data...
2009 Dec 15
1
Starting with R and distributions graphics
HI, i'm really new of R and i need some help.
I have to describe some distributions for some dices throw:
- launching 3 dices i need the distribution of the sum of the two higher
values
- launching 4 dices i need the distribution of the occurrences of the same
value
possibly i need a way to compare the two distribution adding the fourth dice
to the first without summing it (only for occurrence...
2010 Jul 27
1
as.dendrogram for DICE coefficient.
...i R,
I was using 'as.dendrogram' with the DIST coefficient, where the smaller
values of the DIST coefficient, say that the objects are closer to each
other, while the larger values of the coefficient say that the objects
are far from each other.
But now, I have my coefficient as the DICE coefficient(in some sense
similar to correlation coefficient), where the larger coefficient value
indicates closer objects, while the small coefficient values indicate
farther objects. But, once I draw the dendrogram, the initial groupings
happens to the smaller DICE coefiicients and then to the la...
2010 Oct 05
3
R-help
Im trying to simulate the rolling of a pair of dice
this is my function:
#function to simulate tosses of a pair of dice
#from the simulation, the program returns the empirical probability of
#observing a double
count <- 0
for(j in 1:sim){#begin loop
die1 <- sample(1:6,1)
print(die1)
die2 <- sample(1:6,1)
print(die2)
count <- ifelse(di...
2011 Aug 30
3
Simulating distribution of max of two die
Hallo
I am teaching a very elementary intro course about R, and want to show
the students how to find the distribution of the maximum of rolling
two balanced die. Is there perhaps a more elegant way to do this,
other than the way I am using below? (I would like to show them two
ways - the one shown here, and perhaps and improved/elegant approach
(showing off the "beauty" of R.
2018 Oct 21
2
Instalar paquetes antiguos en Windows 10
Hola a todos! Espero que alguien me pueda echar algo de luz al problema que tengo.
Estoy intentando instalar algunos paquetes antiguos en R (3.3.0), como ?devtools? en su penúltima versión, y me está resultando imposible. Instalé Rtools y R me dice que funciona, pero no consigo hacer que se instale el paquete. He probado bajando el paquete en formato .tar.gz y luego con las instrucciones:
filename <- file.choose()
install.packages(filename, type=?source?, repos=NULL)
Entonces, encuentra el paquete, pero luego me dice que no puede abrir...
2010 Aug 18
5
ifelse command
hello people,
I want to make a biased dice using the sample() function and print out the
results after n number of runs, I've successfully generated the dice using
the following command:
mydie2<-function(n=1000,y=NULL,...){
for(i in 1:n){
x<-sample(1:6,n,replace=TRUE,prob=c(1,1,2,3,2,1)/10)
x=runif(n)
if(x<=1/10){y[i]=1}
else i...
2006 May 16
1
Size of observations
Hi All
I had to assure the randomness of backgammon game's two dices.
I took 8,000,000 observations and found that one of the dices is not uniform
distributed.
I took 80,000,000 observations and found that the dice is uniform
distributed.
In both tests I used Pearson Chi Square test.
My questions:
1. How many observations should I take?
2. How...
2008 Mar 17
0
R.matlab errors and slow con
..., port=9999, remote=FALSE)
matlab<- Matlab()
isOpen.Matlab(matlab)
Also, the initial examples in the help file work fine, but I encounter an
error when trying to evaluate the following expression:
# Create a function (M-file) on the Matlab server
setFunction(matlab, " \
function [win,aver]=dice(B) \
%Play the dice game B times \
gains=[-1,2,-3,4,-5,6]; \
plays=unidrnd(6,B,1); \
win=sum(gains(plays)); \
aver=win/B; \
");
> evaluate(matlab, "[w,a]=dice(1000);")
Error in list("evaluate(matlab, "[w,a]=dice(1000);")" = <environment>, :
[2008-03-17...
2011 Mar 21
0
seek advise for slice & dice a table
hi,
im having a table which holds a lot of information. i would like to
slice & dice in a BI-manner the table. u guys have any suggestions?
table looks a bit like this:
user
app [appa, appb, appc]
action [actiona, actionb, actionc]
timestamps
...
so it would be cool to sort, drill in&up based on the various dimensions.
im not asking for a full bi-solution, but maybe the one o...
2007 Mar 06
3
Is there a quick way to count the number of times each element in a vector appears?
Hi there,
I'm writing a function that calculates the probability of different
outcomes of dice rolls (e.g., the sum of the highest three rolls of
five six-sided dice). I'm using the "combinations" function from the
"gtools" package, which is great: it gives me a matrix with all of the
possible combinations (with repetitions allowed). Now I want to count
the number o...
2013 Jul 12
3
Eliminar filas que cumplen con mas de un criterios simultaneamente ...
...NA>
611 dol 1.573 5 182i 2 i 3.179129e-03 2 <NA>
612 dol 1.573 4 160s 0 s 6.663188e-01 3 <NA>
613 dol 1.573 4 161c 1 c 9.283267e-04 3 <NA>
614 dol 1.573 4 161c 1 c 1.239676e-03 3 <NA>
Tengo que eliminar las filas cuya columna SOL dice LIM y cuya columna
DIA dice 2.
Por supuesto he googleado (o duckduckdeado ahora) e intentado algunas
opciones como la siguiente (suponiendo que el archivo se llama graph):
graph <- graph[graph$sol=="lim" & graph$dia==2,]
pero esto elimina TODAS las filas que cumplen ambos crite...
2012 May 09
2
Memoria de R y bucles for
...(una base de datos de 11 años) es demasiado grande;
tengo segun R... un vector de 31,5 Mb... y no lo quiere abrir...
¿cuál es el límite?
y segundo....
para evitar el error por falta de memoria.... tengo segmentada la base de datos por años...
peeeero no me deja meter el fichero en el bucle, porque dice que no existe...
es decir... si mis archivos son a1999.sav a2000.sav .....a2009.sav y lo meto dentro de un bucle desde 1999 a 2009:
for (j in 1999:2009){
datos.j<-read.spss("aj.sav",to.data.frame= TRUE)
attach(datos.j)}
me dice que aj.sav no existe... y si los abro "manualmente&qu...
2006 Feb 12
0
slicing and dicing timestamps by month, week, day, etc
I''m trying to finish up a comp lab sign-in app in RoR that includes a db
table logging each visit with a timestamp. I want to be able to loop
through the visits table and get a weekly or monthly array and print a
table of the last four weeks listing a count for the number of visits
each day. I''ve got it working alright but it''s pretty ugly...overcoded.
Does anyone
2014 May 29
5
ayuda con "unexpected symbol"
Hola,
Tengo la version R 3.1, estoy intentado usar este script pero me dice que
el simbolo " no tiene que estar ahi, ya intente borrando comillas o
diferentes formas y no lo consigo, si alguien sabe agradezco ayuda.
setwd("C:/users/marta/desktop/DB")
library(chron)
library(xlsx)
filename<-"univerest_50.csv"
filename<-"monicap_50.c...
2008 Sep 05
1
Trouble with R CMD check: I can't seem to get dependencies right (maybe I'm using R_LIBS incorrectly?)
Hi there,
I'm in the following directory:
~/Documents/Rstuff/diceFiles/dice_1.1
The directory "dice" is in this directory, with all the usual build
files (DESCRIPTION, NAMESPACE, etc). I'm trying to run the following
command:
R CMD check dice
(where "dice" is the name of the package I'm checking), and I get the following:
* checki...
2014 Jun 04
2
R latex ubuntu
Buenas noches
Instale ubuntu 14.04, corro un archivo que me funcionaba en windows, pero
no se que librería debería cargar (instalar) para solucionar el problema.
El codigo R dice:
function(x)
tools::texi2pdf
El error dice:
Error en texi2dvi(file = file, pdf = TRUE, clean = clean, quiet = quiet,
:
Running 'texi2dvi' on '
Otro archivo se compilo sin problemas (lyx con sreave).
texi2html esta en los repositorios, pero no los anteriores.
¿Sugerencias?
Javi...