Displaying 20 results from an estimated 300 matches similar to: "how to loop through variables in R?"
2010 Nov 09
1
library(kernlab) --- unable to load shared library
Dear R users,
I have recently encountered a problem with using the function `library` in
order to load the package `kernlab`.
My output of sessionInfo() is as follows:
R version 2.10.1 (2009-12-14)
x86_64-unknown-linux-gnu
locale:
[1] C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
I have installed the package by
2013 Jun 26
3
match rows of R
Hi all,
What would be an efficient way to match rows of a matrix to a vector?
ex:
m<-matrix(1:9, nrow=3)
m [,1] [,2] [,3]
[1,] 1 4 7
[2,] 2 5 8
[3,] 3 6 9
#################################
which(m==c(2,5,8)) # I want this to return 2
######################
Thanks,
Sachin
[[alternative HTML version deleted]]
2010 Oct 10
1
segfault caused by `icfit` in `interval` package
Dear R community,
I am using the R package `interval` in order to perform some modelling
tests of the
NPMLE convergence in the case of censoring. So all I am doing is drawing a
sample
from exponential distribution, making it a censored sample and computing the
NPMLE of
its distribution function. But when run on Linux Calculate 10.4 the program
keeps
crashing and reporting a segmentation fault
2012 Oct 01
1
Retrieve hypergeometric results in large scale
I'm going to use
dhyper(x, m, n, k)
to get a 95% coverage. Let me use an example to explain my problem:
Suppose I have a urn containing 90 red and 10 black balls.
Now I wanna remove 3 from the urn. By the following codes:
m<-90;n<-10;k<-3;
x<-0:3
dhyper(x,m,n,k)
I can obtain the probability that 0,1,2,3 red balls will be removed.
0.000742115 0.025046382 0.247680891
2011 May 11
1
Recompile a package
Hello, dear R community.
The thing is that I am not in the least a developer, neither do I want to
create a package of my own.
But recently I have found a package LogicForest, which is in the base
written in Fortran I think. And well,
in its manual it is written that there are several parameters there that had
had to be "hard coded", but which
in essence actually have no restrictions.
2010 Nov 23
1
Barplot and plot means with confidence intervals in the same plot
I want to obtain a barplot with error bars and a mean plot with error bars
with other scale on the left in the same plot. I need help to get the same
x axis (centered) when overlay two plots (barplot2 and plotCI (or
lineplot.CI) with errorbars), with diferent y axis. I use par (new=T) but
the X axis names are not centered with the figures.
An example of my data:
2008 May 30
0
imputationlist, update, and recode
I'm stumbling my way through manipulating data in multiply imputed datasets,
and have run into a problem translating code I used to run on my pre-imputed
dataset to multiple datasets. The imputation runs just fine, as does the
reading of the mi data sets into an imputationList. I run into trouble,
though, when I try to construct a scale across all the data sets. Is there
a simple way to do
2010 Jun 16
0
biglm.big.matrix: Problem with weighting
Hello colleagues,
I have tried to use the package bigmemory, biganalytics and biglm. I
want to specify a multivariate regression with a weight.
I have imported a large dataset with the library(bigmemory). I load the
library (biglm) and specified a regression with a weight. But I get
everytime an error message like "object not found" or "`weights' must be
a
2012 Nov 01
0
oblique.tree : the predict function asserts the dependent variable to be included in "newdata"
Dear R community,
I have recently discovered the package oblique.tree and I must admit that
it was a nice surprise for me,
since I have actually made my own version of a kind of a classifier which
uses the idea of oblique splits (splits by means of hyperplanes).
So I am now interested in comparing these two classifiers.
But what I do not seem to understand is why the function
2010 Nov 24
0
4. Rexcel (Luis Felipe Parra)-how to run a code from excel
Hi Louis,
It's simple to run a r script from the excel spreadsheet.
Just write your code, source("C:\\Quantil
Aplicativos\\Genercauca\\BackwardSelectionNC.r"), into a cell of a
workingsheet. Then right-click the cell and select "run code" in the pop-up
menu.
Hope this will help you.
Best,
Bernard
-----????-----
???: r-help-bounces at r-project.org [mailto:r-help-bounces
2002 Nov 26
4
[NB] lm problems
Hi,
I have probably overlooked something obvious, but could anybody
help me with following, please?
Trying to make regression analysis. I have a huge dataframe with
results from National Opinion Survey on Crime and Justice
(www.abacon.com/fox/) with two variables G5 and N3 which are
imported to R as ordered factors:
> levels(noscj$G5)
[1] "Strongly agree" "Agree"
2020 May 05
2
"Earlyclobber" but for a subset of the inputs
Hi Quentin,
> It sounds like you only need the earlyclobber description for the N, N
> variant.
> In other words, as long as you use different opcodes for widen-op NN and
> widen-op WN, you model exactly what you want.
>
> What am I missing?
>
we are using different opcodes for widen-op NN and widen-op WN.
My understanding is that not setting earlyclobber to the W, N
2017 Jun 06
2
integrating 2 lists and a data frame in R
> On Jun 6, 2017, at 4:01 AM, Jim Lemon <drjimlemon at gmail.com> wrote:
>
> Hi Bogdan,
> Kinda messy, but:
>
> N <- data.frame(N=c("n1","n2","n3","n4"))
> M <- data.frame(M=c("m1","m2","m3","m4","m5"))
> C <-
2017 Jun 06
4
integrating 2 lists and a data frame in R
Dear Bert,
thank you for your response. here it is the piece of R code : given 3 data
frames below ---
N <- data.frame(N=c("n1","n2","n3","n4"))
M <- data.frame(M=c("m1","m2","m3","m4","m5"))
C <- data.frame(n=c("n1","n2","n3"),
2017 Jun 06
0
integrating 2 lists and a data frame in R
Hi Bogdan,
Kinda messy, but:
N <- data.frame(N=c("n1","n2","n3","n4"))
M <- data.frame(M=c("m1","m2","m3","m4","m5"))
C <- data.frame(n=c("n1","n2","n3"), m=c("m1","m1","m3"), I=c(100,300,400))
2017 Jun 06
0
integrating 2 lists and a data frame in R
Thank you David. Using xtabs operation simplifies the code very much, many
thanks ;)
On Tue, Jun 6, 2017 at 7:44 AM, David Winsemius <dwinsemius at comcast.net>
wrote:
>
> > On Jun 6, 2017, at 4:01 AM, Jim Lemon <drjimlemon at gmail.com> wrote:
> >
> > Hi Bogdan,
> > Kinda messy, but:
> >
> > N <-
2017 Jun 06
1
integrating 2 lists and a data frame in R
Simple matrix indexing suffices without any fancier functionality.
## First convert M and N to character vectors -- which they should
have been in the first place!
M <- sort(as.character(M[,1]))
N <- sort(as.character(N[,1]))
## This could be a one-liner, but I'll split it up for clarity.
res <-matrix(NA, length(M),length(N),dimnames = list(M,N))
res[as.matrix(C[,2:1])] <-
2020 May 04
2
"Earlyclobber" but for a subset of the inputs
Hi all,
I'm working on a target whose registers have equal-sized subregisters and
all of those subregisters can be named (or the other way round: registers
can be grouped into super registers).
So for instance we've got 16 registers W (as in wide) W0..W15 and 32
registers N (as in narrow) N0..N31. This way, W0 is made by grouping N0 and
N1, W1 is N2 and N3, W2 is N4 and N5, ..., W15 is
2010 Dec 29
2
How to create an array of lists of multiple components?
Hi,
how can I create an array of lists of three components?
This approach does not work:
n1 <- 2
n2 <- 4
n3 <- 5
res <- array(rep(vector("list",3), n1*n2*n3), dim = c(n1,n2,n3))
res[1,1,1] # is not a list with three components...
The goal is that res[1,1,1] is a list with three components. Also, appending the
components didn't work. For example, I tried:
component
2012 Jun 04
1
simulation of modified bartlett's test
Hi, I run this code to get the power of the test for modified bartlett's
test..but I'm not really sure that my coding is right..
#normal distribution unequal variance
asim<-5000
pv<-rep(NA,asim)
for(i in 1:asim)
{print(i)
set.seed(i)
n1<-20
n2<-20
n3<-20
mu<-0
sd1<-sqrt(25)
sd2<-sqrt(50)
sd3<-sqrt(100)
g1<-rnorm(n1,mu,sd1)
g2<-rnorm(n2,mu,sd2)