Displaying 20 results from an estimated 60000 matches similar to: "expand the inside of command with rep ?"
2015 Sep 24
10
Why is rstudio not in Ubuntu repo or PPA?
Hi,
rstudio is very easy to install, but it would be great if it were just
an apt-get away. Is there a reason it is not in Ubuntu main repos or
in rrutter PPA?
Kind regards,
Xu
2018 Aug 01
2
Why is rstudio not in Ubuntu repo or PPA?
Dear All,
I try not to bump too much, but I just tried Ubuntu 18.04, and it is
not in repo and I still do not see any PPA available. If it would
help, I can spend the time to explain why I believe it helpful to
install using a command rather than webbrowser, but I think this is
already understood why helpful, but it seems there is just a technical
tricky problem to solve to implementation.
Thank
2008 May 07
6
help with the unique function
Hi,
The unique function is easy to understand and use. Beyond that, I want to get also the frequency of repetition of each individual row in a data frame
Let me explain with an example :
x<-data.frame(a=c(1,2,3,1,2),b=c(2,3,4,2,3),c=c(10,20,30,10,20))
xu<-unique(x)
We have,
> x
? a b? c
1 1 2 10
2 2 3 20
3 3 4 30
4 1 2 10
5 2 3 20
> xu
? a b? c
1 1 2 10
2 2 3 20
3 3 4 30
I want to get
2011 Oct 19
1
hypothetical prediction after polr
Dear R-Help listers,
I am trying to estimate an proportional odds logistic regression model
(or ordered logistic regression) and then make predictions by
supplying a hypothetical x vector. However, somehow this does not
work. I guess I must have missed something here. I first used the polr
function in the MASS package, and I create a data frame and supply it
to the predict function (see below):
2012 Jan 01
3
rep() inside of lm()?
HI all,
I'm new to R.
Say I have a multi-layered list called newlist.
############
> str(newlist)
List of 2
$ :List of 5
..$ : num [1:8088] NA 464 482 535 557 ...
..$ : num [1:8088, 1:2] NA 464 482 535 557 ...
..$ : num [1:8088, 1:3] NA 464 482 535 557 ...
..$ : num [1:8088, 1:4] NA 464 482 535 557 ...
..$ : num [1:8088, 1:5] NA 464 482 535 557 ...
$ :List of 3
..$ : num
2013 Mar 15
1
quadprog issues---how to define the constriants
Hi list:
This is my first time to post my question on the list. Thanks for your
help.
I am solving a quadratic programming using R. Here is my question:
w = arg min 0.5*w'Mw - w'N
s. t. sum(w) = 1;
w>0
note: w is weight vector, each w_i must >=0, and the sum of w =1.
Here is my R code:
A <-matrix(c(2.26,1.26,1.12,1.12,2.27,1.13,1.12,1.13,2.2),3,3);
B <-
2003 Jun 25
2
probelem of function inside function
Hi,
I encountered a problem when I am trying to write my
own function which contains another function. To
simplify a problem, I tried the following simplified
function, hope someone can idenfity the problem for
me.
I have a simple data frame called "testdata" as
following:
>
2011 Nov 12
1
changelog for MASS?
Does anyone know where I can find a changelog for MASS?
It's difficult to know whether I should ask my company to update the package
or not. We are usually required to show the changelog, but I can't find one.
Thank you,
Xu
--
View this message in context: http://r.789695.n4.nabble.com/changelog-for-MASS-tp4034473p4034473.html
Sent from the R help mailing list archive at Nabble.com.
2012 Mar 15
1
expand.grid using a matrix and a vector as input
Hello R-users,
I have the following question, for which my search did not really return any usable result.
If I have a matrix a1, and a vector a2 like below
a1<-matrix(c(1:4),2,2)
a2<-c(8,9)
is there any function like the expand.grid (or some clever calling of the function) such that it outputs a matrix or dataframe where the entire a1 matrix is repeated for each value of a2 (the
2012 Nov 07
5
Calling R object from R function
Hi,
Can you please help me with this please?
What I am trying to do is call a vector from R function and used in the new
function
So I create 4 functions with these arguments
M11 <- function(TrainData,TestData,mdat,nsam) {
ls <- list()
I have few statments one of them is
vectx <- c(,1,2,3,4,5,6,6)
vectz <- c(12,34,5,6,78,9,90)
and then................
ls(vectx=vtecx,vectz=vectz)
2012 Jul 11
1
Package MuMIn (dredge): Error in ret[, ] <- cbind(x, se, rep(if (is.null(df)) NA_real_ else df, : number of items to replace is not a multiple of replacement length.
Hello R community,
I am attempting to run multiple logistic regressions (multinomial, via
package 'nnet'), with Automated Model Selection (dredge, package 'MuMIn').
The aim is to reduce the number of predictor variables by assessing relative
performance of each variable, which can be done in a coarse fashion using
the Automated Model Selection option in package 'MuMIn'
2012 Aug 01
1
optim() for ordered logit model with parallel regression assumption
Dear R listers,
I am learning the MLE utility optim() in R to program ordered logit
models just as an exercise. See below I have three independent
variables, x1, x2, and x3. Y is coded as ordinal from 1 to 4. Y is not
yet a factor variable here. The ordered logit model satisfies the
parallel regression assumption. The following codes can run through,
but results were totally different from what I
2009 May 17
2
wireframe 3-D problems
Dear All R Users,
I am trying to graph a 3-D graph of simulated data for logit models using
the powerful wireframe command, but I got stuck. Here are the codes:
x <- seq(-4, 4, by=0.01)
y <- seq(-4, 4, by=0.01)
p <- 1/(1+exp(-0.12*x + 0.35*y))
mydata <- cbind(x, y, p)
require(lattice)
wireframe(p~x*y, data=mydata)
and I received the following message:
Error in
2005 Mar 12
1
MLE for two random variables
Hello,
I've the following setting:
(1) Data from a source without truncation (x)
(2) Data from an other source with left-truncation at threshold u (xu)
I have to fit a model on these these two sources, thereby I assume that both
are "drawn" from the same distribution (eg lognormal). In a MLE I would sum
the densities and maximize. The R-Function could be:
2007 Nov 16
2
expand.grid overflows?
>cbn<-as.matrix(expand.grid( rep( list(0:1), 50)))
Error in rep.int(rep.int(seq_len(nx), rep.int(rep.fac, nx)), orep) :
invalid 'times' value
In addition: Warning message:
In rep.int(rep.int(seq_len(nx), rep.int(rep.fac, nx)), orep) :
NAs introduced by coercion
But I'm only interested in cbn matrix rows where:
cbn<- cbn[rowSums(cbn)==5,]
Is there a way to evaluate it
2012 Jan 25
4
formula error inside function
I want use survfit() and basehaz() inside a function, but it doesn't work.
Could you take a look at this problem. Thanks for your help. Following is my
codes:
library(survival)
n <- 50 # total sample size
nclust <- 5 # number of clusters
clusters <- rep(1:nclust,each=n/nclust)
beta0 <- c(1,2)
set.seed(13)
#generate phmm data set
Z <- cbind(Z1=sample(0:1,n,replace=TRUE),
2001 Apr 27
1
creating expressions inside loop
Hello all,
may be someone can give me a hint how to
solve a little problem.
I'm trying to create some expressions inside
a for-loop which i want to evaluate AFTER this
creation loop (but loop specific).
To explain my problem here comes the code:
y.mat <- t(matrix(rep(84:90,8) + as.numeric(gl(8,7)),nrow=7))
# > y.mat[1:2,]
# [,1] [,2] [,3] [,4] [,5] [,6] [,7]
# [1,] 85 86
2009 Feb 20
1
Using "rep", but don't know what to put after each =
Hello
I have one DF (detheleny1periode), with some variables that mathes, in some
way, variables in another DF (y2).
The DF named detheleny1periode look like this (i have not included alle
variables):
CHR_NR diffdatoperiode
11377 29
11377 59
11377 78
with many different CHR_NR's.
And the other DF named y2 look like this (i have not
2012 Jul 03
2
EM algorithm to find MLE of coeff in mixed effects model
I have a general question about coefficients estimation of the mixed model.
I simulated a very basic model: Y|b=X*\beta+Z*b +\sigma^2* diag(ni);
b follows
N(0,\psi) #i.e. bivariate normal
where b is the latent variable, Z and X are ni*2 design matrices, sigma is
the error variance,
Y are longitudinal data, i.e. there are ni
2011 Aug 31
3
how to create data.frames from vectors with duplicates
Hi R users,
suppose I have two vectors,
> x=c(1,2,3,4,5)
> y=c('a','b','c','a','c')
How can I get a data.frame like this?
> xy
count
a 5
b 2
c 8
I know a few ways to fulfill the task. However, I have a huge number
of this kind calculations, so I'd like an efficient solution. Thanks
--
Best,
Zhenjiang