Does anyone know of a function that will return all unordered combinations of n
elements from a list with repetition?
The combs function in caTools will do this without repetition:
combs(1:2, 2)
[,1] [,2]
[1,]12
What I'd like is:
1 1
1 2
2 2
Thank you,
Thomas Chesney
This
Thank you Nicholas.
I've found that Urnsamples in the prob package does it too:
urnsamples(1:2, size = 2, replace = TRUE, ordered = FALSE)
Thomas
From: WRAY NICHOLAS [nicholas.w...@ntlworld.com]
Sent: Tuesday, June 09, 2015 10:52 AM
To: Thomas Chesney
Hi carol,
Have you tried renaming the file to something like my.RData? And
just how big is it?
Jim
On Tue, Jun 9, 2015 at 5:50 AM, carol white via R-help
r-help@r-project.org wrote:
Hi,How is it possible to load a very big .RData that can't be loaded it's
very big and the following error msg
You could try expand.grid -- you'd prob need to modify what's beneath
*a=c(0,1,2)*
*b=c(0,1)*
*c=c(0,1)*
*y-list()*
*y[[1]]-a*
*y[[2]]-b*
*y[[3]]-c*
*expand.grid(y)*
This code gives all combinations
On 9 June 2015 at 10:11, Thomas Chesney thomas.ches...@nottingham.ac.uk
wrote:
Does
Buenos días,
estoy tratando de encontrar la manera de generar tablas en ficheros pdf
(sweave) a través del paquete tables. He mirado que este tema esta activo
en las listas pero no logro localizar las respuestas antes dadas, por eso
lanzo esta consulta.
Mi fichero .rnw tiene el siguiente aspecto:
Thanks Martin.
Yep, I understand it is documented and my code wasn't as it should've been --
the confusion comes from the fact that it worked ok for hundreds of situations
that seem very much alike, but one situation breaks. I agree that you typically
can't be sure about having only numerical
What does the following command print out?
str(test)
The error message indicates that test$CHG_WT is not numeric.
-
David L Carlson
Department of Anthropology
Texas AM University
College Station, TX 77840-4352
-Original Message-
From: R-help
There are several possible reasons and you have really told us nothing that
might help isolating the problem. 600 MB is large, but not very large. R and
your OS should not be expected to have a problem with files of that size. First
of all, you'll need to document why you expect this should
On Tue, Jun 9, 2015 at 11:24 AM, Ye Lin ye...@lbl.gov wrote:
Hey All, I have a txt data file that looks like this:
[{“ID”:“A”,“Name:Tom, Age:18},{“ID”:“B”,“Name:Jim, Age:19}]
How can I read this into R as a data frame? I have used readLines to read
all the lines but dont know how to
combnWithRepetition - function(n, k) combn(n+k-1, k) - seq(from=0, len=k)
combnWithRepetition(2, 2)
[,1] [,2] [,3]
[1,]112
[2,]122
combnWithRepetition(3, 2)
[,1] [,2] [,3] [,4] [,5] [,6]
[1,]111223
[2,]123233
Bueno os dejo para que veais como va la cosa. Gracias por el feedback
*Shell de linux*
Los shells de Linux son superútiles para limpiar grandes bases de datos. En
Linux y mac los tenemos en Windows.
Para utilizar estos sctripts en Windows lo ideal es
1.- Instalar cygwin
#
Hey All, I have a txt data file that looks like this:
[{“ID”:“A”,“Name:Tom, Age:18},{“ID”:“B”,“Name:Jim, Age:19}]
How can I read this into R as a data frame? I have used readLines to read
all the lines but dont know how to deal with column names and inputs.
Thanks for your help!
That combnWithRepetition (based on combn) can use much
less memory (and time) than the algorithm in prob:::urnsamples.default
with replace=TRUE, ordered=FALSE. Perhaps urnsamples()
could be updated to use combn instead of unique(as.matrix(expand.grid())).
See the urn chapter in Feller vol. 1.
Buenas:
Estoy construyendo un paquete, cuyo fuente adjunto y necesito
importar la función runs.test desde el paquete tseries y la
función runs.test desde el paquete randtests. Esto hace que al
hacer un chequeo del paquete con R --check --as-cran me dé como
aviso replacing previous import by
Hi,
As David said have a look at str(test). You have a factor in there or else that
weird list(format(test$CR_DT,%m)) command in aggregate() is mucking things
up. What is list(format(test$CR_DT,%m)) intended to do? No ,a quick test
says it is mucking something else up and not giving the us
Hola compañeros de R,
Antes he utilizado Rcpp (y armadillo) para lograr velocidad en procesos
llenos de bucles y de álgebra lineal; pero no me había visto en la
necesidad de maximizar (optimizar) ninguna función (una verosimilitud, en
este caso).
¿Alguien tiene conocimiento de cuál es la forma
Hi:
I have a huge data with lot of variables and I need to check the trend
variations from year to year. In order to do so, I have to cross tabulate
the year variable as top (constant) and all the remaining variables as side
(attached the cross tabulation report). I have searched the forums but
Lots of ways to do this, I use %in% with bracket notation [row, column].
The empty column argument below returns all columns but you could have
conditional logic there as well.
dd[dd$rows %in% test_rows, ]
On Mon, Jun 8, 2015 at 6:44 PM, Bogdan Tanasa tan...@gmail.com wrote:
Dear all,
I got the following warning message when using the lmer function.
Does anyone know what is the implication? Thanks!
Warning message:
In anova(model, ddf = lme4) : bytecode version mismatch; using eval
__
R-help@r-project.org mailing list -- To
Estimados, he estado mirando en la internet si es posible programar con
R una interfaz grafica para pedir el ingreso de datos por ejemplo, pero
invariablemente obtengo paginas que hablan de interfaces graficas
(rkward, rstudio, r-commander, etc) para R o de las librerias para hacer
graficos
You can also do it with rvest httr (but that does involve some parsing):
library(httr)
library(rvest)
url -
http://nwis.waterdata.usgs.gov/nwis/peak?site_no=12144500agency_cd=USGSformat=img;
html(url) %%
html_nodes(img) %%
html_attr(src) %%
paste0(http://nwis.waterdata.usgs.gov;, .) %%
There are two issues here... calculation and presentation. The table function
from base R can work with many variables. If your data set is so large that you
have problems with memory then you could investigate data.table or sqldf
packages, which perform the computations but do not present the
Estimado Freddy López
Si no entiendo mal usted tiene código en C++ que compila en conjunto a R
(Rcpp). En lo personal nunca compile algo escrito por mi utilizando Rcpp, pero
si algo de C++, hay compiladores (creo que ahora deben ser casi todos), que
tienen una opción de autovectorización,
knouri nouri4 at yahoo.com writes:
Dear all:for the folowing data, a two-period, two treatment (A=1 vs. B=2)
cross-over is fitted
using the folowing SAS code.
data one;
[snip]
run;
proc mixed data=one method=reml;
class Sbj Per Trt;
model PEF = Per Trt /ddfm=kr;
repeated Trt
This is (almost) json data (but see NOTE below); there are several packages
that deal with json, jsonlite for example.
R data - '[{ID:A, Name:Tom, Age:18},{ID:B, Name:Jim,
Age:19}]'
R install.packages(jsonlite)
R library(jsonlite)
R myDf - fromJSON(data, simplifyDataFrame=TRUE)
R
On Jun 9, 2015, at 1:40 AM, jagadishpchary wrote:
Hi:
I have a huge data with lot of variables and I need to check the trend
variations from year to year. In order to do so, I have to cross tabulate
the year variable as top (constant) and all the remaining variables as side
(attached the
Hi,
another naive question (i’m pretty sure :( )
I’m trying to plot a multiple line graph:
regionsample factora factorbfactorc
0.1 10 0.895 0.903 0.378
0.2 10 0.811 0.865 0.688
0.1 20 0.735 0.966 0.611
0.2 20
En algún momento hace un par de años atrás usé gWidgets para ingresar
valores de forma interactiva. No sé como esta su desarrollo actualmente
ni si existen otras mejores opciones actualmente.
Saludos
DMTV Fernando Macedo
Ayudante del área Mejoramiento Genético
Facultad de Veterinaria -
Hello,
I am trying to do something that I am able to do with the by function within
data.frame but can't figure out how to achieve with data.table.
Consider
dt-data.table(name=c(rep(a,5),rep(b,6)),var1=0:10,var2=20:30,var3=40:50)
myFunction - function(x) { mean(x) }
I am aware that I can do
Your model is too complex for the data. This gives you two options: a)
simplify the model and b) get more data.
Best regards,
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and
Forest
team Biometrie Kwaliteitszorg / team Biometrics Quality Assurance
Hi all,
I'd like to fit a random intercept and random slope model. In my
data, there are three groups. I want to have different random
intercept for each group but the same random slope effect for all
three groups. I used the following R command.
However, there seems to be some problem. Any
We probably should have a better idea of what the raw data looks like and
perhaps a bit better idea of what the analyis is to show. Have a look at
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
and http://adv-r.had.co.nz/Reproducibility.html for some
Hi Ramiro,
There is a demonstration of this on the data.table wiki at
https://rawgit.com/wiki/Rdatatable/data.table/vignettes/datatable-intro-vignette.html.
You can do
dt[, lapply(.SD, mean), by=name]
or
dt[, as.list(colMeans(.SD)), by=name]
BTW, there are pretty straightforward ways to do
try this:
dt[
+ , {
+ result - list()
+ for (i in names(.SD)){
+ result[[i]] - myFunction(unlist(.SD[, i, with = FALSE]))
+ }
+ result
+ }
+ , by = name
+ ]
name var1 var2 var3
1:a 2.0 22 42
2:b 7.5 28 48
Jim
li li hannah.hlx at gmail.com writes:
[snip]
I'd like to fit a random intercept and random slope model. In my
data, there are three groups. I want to have different random
intercept for each group but the same random slope effect for all
three groups. I used the following R command.
Dear Rachel,
How about this (using the data and model you sent originally)?
linearHypothesis(EpiLM, GzrTreatpresence = 0)
Linear hypothesis test
Hypothesis:
GzrTreatpresence = 0
Model 1: restricted model
Model 2: log_EpiChla ~ TempTreat * GzrTreat * ShadeTreat
Res.Df RSS Df Sum of Sq
Thierry:
I don't think so. It looks to me like her syntax/understanding is confused.
I think the call should be:
mod2 - lmer(result ~ group*time+(group + time|lot), na.action=na.omit,
data=alldata)
Her request for the same random slope for each group -- I assume it's for
time -- means to me
Hi Petr
I researched a lot over the net and R manual as well based on which I
revamped my code and came to the code as:
test$CR_DT - as.Date(test$CR_DT, '%d-%b-%y')
iii- aggregate(test$CHG_WT,list(format(test$CR_DT,%m)),FUN=sum)
However it still gives me the error as below:
Error in
yes and doesn't help.600MB
Thanks
Carol
On Tuesday, June 9, 2015 12:22 PM, Jim Lemon drjimle...@gmail.com wrote:
Hi carol,
Have you tried renaming the file to something like my.RData? And
just how big is it?
Jim
On Tue, Jun 9, 2015 at 5:50 AM, carol white via R-help
Consider this R code:
time = as.POSIXct(1433867059, origin = 1970-01-01)
print(time)
print( as.numeric(time) )
timeFormat = %Y-%m-%d %H:%M:%OS3
tz = EST
timestamp = format(time, format = timeFormat, tz = tz)
print(timestamp)
timeParsed = as.POSIXct(timestamp, format = timeFormat, tz = tz)
40 matches
Mail list logo