Displaying 20 results from an estimated 200 matches similar to: "R loop help"
2012 Sep 12
3
how to create a substraction matrix (subtract a row of every column from the same row in other columns)
Hello
I have data like this
x1 x2 x3 x4 x5
I want to create a matrix similar to a correlation matrix, but with the
difference between the two values, like this
x1 x2 x3 x4 x5
x1 x2-x1 x3-x1 x4-x1 x5-x1
x2 x3-x2 x4-x2 x5-x2
x3 x4-x3 x5-x3
x4 x5-x4
x5
Then I
2004 Apr 05
0
Selecting Best Regression Equation : leaps() in R and stepwise() in S+
Dear all,
First of all - thanks to the R-users who replied my previous mail
"Selecting Best Regression Equation". However, seems i've got some other
problems now -
My data in c:\leafbrn.txt file is-
--------------------------------------
i x1 x2 x3 y
1 3.05 1.45 5.67 0.34
2 4.22 1.35 4.86 0.11
3 3.34 0.26 4.19 0.38
4 3.77 0.23 4.42 0.68
5 3.52 1.10 3.17 0.18
6 3.54 0.76 2.76
2006 Mar 06
9
Apache + Displaying images
Hi,
I''m new to Rails, sorry if I''m repeating the question, but I couldn''t
find a solution for my problem so far :(
I''m using Apache2 as the web server of my Rails application. I keep my
images in public/images and tried inserting images to the page like
this;
<%= image_tag "rails.png" %>
But the image is not displayed on the browser. Can
2019 May 26
2
rbind has confusing result for custom sub-class (possible bug?)
On Sun, May 26, 2019 at 4:06 AM Michael Chirico
<michaelchirico4 at gmail.com> wrote:
>
> Have finally managed to come up with a fix after checking out sys.calls()
> from within the as.Date.IDate debugger, which shows something like:
>
> [[1]] rbind(DF, DF)
> [[2]] rbind(deparse.level, ...)
> [[3]] `[<-`(`*tmp*`, ri, value = 18042L)
> [[4]] `[<-.Date`(`*tmp*`,
2019 May 27
2
rbind has confusing result for custom sub-class (possible bug?)
Yes, thanks for following up on thread here. And thanks again for clearing
things up, your email was a finger snap of clarity on the whole issue.
I'll add that actually it was data.table's code at fault on the storage
conversion -- note that if you use an arbitrary sub-class 'foo' with no
methods defined, it'll stay integer.
That's because [<- calls as.Date and then
2019 Jun 02
1
rbind has confusing result for custom sub-class (possible bug?)
I thought it would be good to summarize my thoughts, since I made a
few hypotheses that turned out to be false.
This isn't a bug in base R, in either rbind() or `[<-.Date`.
To summarize the root cause:
base::rbind.data.frame() calls `[<-` for each column of the
data.frame, and there is no `[<-.IDate` method to ensure the
replacement value is converted to integer. And, in fact,
2019 May 26
2
rbind has confusing result for custom sub-class (possible bug?)
Debugging this issue:
https://github.com/Rdatatable/data.table/issues/2008
We have custom class 'IDate' which inherits from 'Date' (it just forces
integer storage for efficiency, hence, I).
The concatenation done by rbind, however, breaks this and returns a double:
library(data.table)
DF = data.frame(date = as.IDate(Sys.Date()))
storage.mode(rbind(DF, DF)$date)
# [1]
2010 Aug 05
1
rbind on data.frame that contains a column that is also a data.frame
Hi,
The following was already a topic on r-help, but after understanding what is
going on, I think it fits better in r-devel.
The problem is this:
When a data.frame has another data.frame in it, rbind doesn't work well.
Here is an example:
--
> a=data.frame(x=1:10,y=1:10)
> b=data.frame(z=1:10)
> b$a=a
> b
z a.x a.y
1 1 1 1
2 2 2 2
3 3 3 3
4 4 4 4
5
2012 Aug 02
1
finding the MLEs of IG parameters by EM-Alorithm
Dear all
I'm trying to caculate the MLEs for parameters of Inverse Gaussian
distribution (in a k-sample problem with common mean) by using
EM-Algorithm. I found some package for EM-Algorithm that are useful
for missing or incomplete data and are not helpful for solving my
problem.
(Exactly, the problem is: Let Xij, i=1,..,k , j=1,...,ni, be a random
sample from IG(?,?i). So the
2011 Nov 17
1
Vectorizing for weighted distance
Hi All,
I am trying to convert the following piece of matlab code to R:
XX1 = sum(w(:,ones(1,N1)).*X1.*X1,1); #square the elements of X1,
weight it and repeat this vector N1 times
XX2 = sum(w(:,ones(1,N2)).*X2.*X2,1); #square the elements of X2,
weigh and repeat this vector N2 times
X1X2 = (w(:,ones(1,N1)).*X1)'*X2; #get the weighted
'covariance'
2006 Apr 23
2
distribution of the product of two correlated normal
Hi,
Does anyone know what the distribution for the product of two correlated
normal? Say I have X~N(a, \sigma1^2) and Y~N(b, \sigma2^2), and the
\rou(X,Y) is not equal to 0, I want to know the pdf or cdf of XY. Thanks
a lot in advance.
yu
[[alternative HTML version deleted]]
2011 Apr 18
1
covariance matrix: a erro and simple mixed model question, but id not know answer sorry
Dear list
I need your help: Execuse me for my limited R knowledge.
#example data set
set.seed (134)
lm=c(1:4)
block = c(rep(lm,6))
gen <- c(rep(1, 4), rep(2, 4), rep(3, 4), rep(4, 4),rep(5, 4),rep(6, 4))
X1 = c( rnorm (4, 10, 4), rnorm (4, 12, 6), rnorm (4, 10, 7),rnorm (4, 5, 2),
rnorm (4, 8, 4), rnorm (4,7, 2))
X2 = X1 + rnorm(length(X1), 0,3)
yvar <- c(X1, X2)
X <- c(rep( 1,
2017 Jan 17
2
bug in rbind?
I suspect there may be a bug in base::rbind.data.frame
Below there is minimal example of the problem:
m <- matrix (1:12, 3)
dfm <- data.frame (c = 1 : 3, m = I (m))
str (dfm)
m.names <- m
rownames (m.names) <- letters [1:3]
dfm.names <- data.frame (c = 1 : 3, m = I (m.names))
str (dfm.names)
rbind (m, m.names)
rbind (m.names, m)
rbind (dfm, dfm.names)
#not working
rbind
2006 Oct 17
1
About compositional data analysis
The compositional data xi=(x_i1,x_i2,...,x_in), for each fixed i , xij>0,
and sum(xij)=1;
I want to compare the mean( u_i) of several groups
i.e.
H0: u_1=u_2=...=u_N
or
H0: u_11=u_21=...=u_N1
Are there any ANOVA tpye tools to do this work in R?
Thanks,
WEN S Q
[[alternative HTML version deleted]]
2020 Oct 09
1
Aide pour finaliser ce code
Hello.
Here is my R code. I used the functional data . Now I need to use the
functional data by applying the kernels instead of the xi, yi functions.
Bonjour.
Voici mon code en R . J'ai utiliser les donn?es fonctionnelles . Maintenant
j'ai besoin d'utiliser les donn?es fonctionnelles en appliquant les noyaux
? la place des fontions xi, yi
library(MASS)
2020 Oct 13
1
Please need help to finalize my code
Hm. Google tells me that kernel function is in stats package which comes with base installation and is invoked when you start R.
search()
[1] ".GlobalEnv" "package:stats" "package:graphics"
[4] "package:grDevices" "package:utils" "package:datasets"
[7] "package:methods" "Autoloads"
2020 Oct 10
3
Please need help to finalize my code
Good evening dear administrators,
It is with pleasure that I am writing to you to ask for help to finalize my
R programming algorithm.
Indeed, I attach this note to my code which deals with a case of
independence test statistic . My request is to introduce the kernels using
the functional data for this same code that I am sending you. So I list the
lines for which we need to introduce the
2010 Jul 23
2
randomness using runif
I'm working on a problem where I'm introducing random error and have
been using the built in function runif to provide that random error.
However, I realized that I seem to be getting some unexpected behavior
out of the function and was hoping someone could share some insight.
I don't know the runif algorithm at all, but from the behavior I'm
seeing, it seems that whenever I open
2007 Jan 25
4
rbind-ing with empty data frame produces error
Hi all,
I'm having some trouble with rbind - this may be a bug or it may be my
misunderstanding. If I do
fileName <- paste(tempdir(),"test.txt",sep="/")
file.create(fileName)
x <- read.table(fileName, col.names=c("one","two","three"))
I get a data frame with no rows, as documented. If I then try to rbind
this with another data frame
2009 Mar 13
1
Hierarchical Bayesian Modeling in R
Hi Friends,
I'm trying to model the consumer decisions (Click-Through Rate and
Conversion) in Search Engine Advertising using a hierarchical Bayesian
binary logit. The input data is the weekly CTRs and Avg. Position for each
search keyword.
CTR is modeled as (for each keyword i and week j):
Pij = exp(C + Bi x Positionij + A1 x Lengthi + A2 x Brandi + A3 x
ProductSpecifici) / [1 + exp(C +