Hi,
May be this also works:
dist(x)
# 1 2 3
#2 2
#3 6 4
#4 12 10 6
as.matrix(dist(x))
# 1 2 3 4
#1 0 2 6 12
#2 2 0 4 10
#3 6 4 0 6
#4 12 10 6 0
which(dist(x)==min(dist(x)))
#[1] 1
A.K.
- Original Message -
From: Ben Bolker bbol...@gmail.com
To:
On Sep 10, 2013, at 12:40 PM, Jonathan Greenberg wrote:
R-helpers:
One of my intrepid students came up with a solution to a problem where
they need to write a function that takes a vector x and a scalar d,
and return the indices of the vector x where x %% d is equal to 0 (x
is evenly
On 13-09-10 06:24 PM, arun wrote:
Hi,
May be this also works:
dist(x)
# 1 2 3
#2 2
#3 6 4
#4 12 10 6
as.matrix(dist(x))
# 1 2 3 4
#1 0 2 6 12
#2 2 0 4 10
#3 6 4 0 6
#4 12 10 6 0
which(dist(x)==min(dist(x)))
#[1] 1
A.K.
Yes, but you need to set
Dear all,
I am following instructions of FAQ 7.2 (
http://cran.r-project.org/doc/FAQ/R-FAQ.html#How-can-I-create-rotated-axis-labels_003f)
to create rotated labels in my plots, but I am facing some problems when
plotting variables with small values (in my case, values between 0.001 and
0.007).
Hello everyone,
Hope everyone is doing great. I would like to know how to use the arima
function in R to fit arima or arma models to daily data, that is, with
period = 365, this taking into account the fact that I have 5 years worth
of daily data (so 365 * 5 = my number of observations).
All I
On 09/11/2013 05:40 AM, Jonathan Greenberg wrote:
R-helpers:
One of my intrepid students came up with a solution to a problem where
they need to write a function that takes a vector x and a scalar d,
and return the indices of the vector x where x %% d is equal to 0 (x
is evenly divisible by d).
Hi,
?.Machine says that 'double.xmin' is 'the smallest non-zero normalized
floating-point number'. On my machine, this is 2.225074e-308. However,
2.225074e-308 / 2 is 0 and smaller than 2.225074e-308, so
double.xmin is not the smallest such number (?) Am I missing anything?
Cheers,
Marius
'normalized' is key. A normalized double precision floating point
number has 52 binary digits of precision and .Machine$double.eps/2
does not. E.g.,
bitsOfPrecision - function(x)max(which( x != x*(1+2^-(1:60
bitsOfPrecision(4)
[1] 52
bitsOfPrecision(.Machine$double.xmin)
[1] 52
arun smartpink111 at yahoo.com writes:
Hi,
Not sure this is what you wanted:
sapply(seq_along(x), function(i) {x1- x[i]; x2- x[-i];
x3-x2[which.min(abs(x1-x2))];c(x1,x3)})
# [,1] [,2] [,3] [,4]
#[1,] 17 19 23 29
#[2,] 19 17 19 23
A.K.
It's a little inefficient
On 09/11/13 09:16, peter dalgaard wrote:
On Sep 10, 2013, at 22:56 , Rolf Turner wrote:
On 09/11/13 07:54, Davis, Brian wrote:
I'm sure this has been answered before but alas my googlefoo is not that strong.
I have several .Rdata files with a single object in them. I need to set the class
You could use assign(name, newValue, envir=env) but I prefer
env[[name]]-newValue
since the env[[name]] works on either side of the assignment operator. E.g.,
env - new.env() # or environment() if you prefer to put things in the
current environment
objNames - load(Robject.RData, envir=env)
Hi,
Try:
library(reshape2)
sample.dat1-ddply(sample.dat,.(pop),mutate, valueper=(value/sum(value))*100)
test-ggplot(sample.dat1, aes(x=response.category,y=valueper, group=pop))
test+geom_bar(stat='identity', position='dodge',aes(fill=pop))
A.K.
- Original Message -
From: Simon Kiss
R-helpers:
One of my intrepid students came up with a solution to a problem where
they need to write a function that takes a vector x and a scalar d,
and return the indices of the vector x where x %% d is equal to 0 (x
is evenly divisible by d). I thought I had a good handle on the
potential
I'm sure this has been answered before but alas my googlefoo is not that strong.
I have several .Rdata files with a single object in them. I need to set the
class of the object to myClass. Unfortunately, I don't know the name of the
object beforehand. Obviously I could ls() and get the name
Hi,
Not sure this is what you wanted:
sapply(seq_along(x), function(i) {x1- x[i]; x2- x[-i];
x3-x2[which.min(abs(x1-x2))];c(x1,x3)})
# [,1] [,2] [,3] [,4]
#[1,] 17 19 23 29
#[2,] 19 17 19 23
A.K.
- Original Message -
From: Michael Budnick mbudnic...@snet.net
To:
Sorry, a mistake:
library(plyr) #instead of library(reshape2)
- Original Message -
From: arun smartpink...@yahoo.com
To: Simon Kiss sjk...@gmail.com
Cc: R help r-help@r-project.org
Sent: Tuesday, September 10, 2013 3:08 PM
Subject: Re: [R] ggplot2 percentages of subpopulations
Hi,
Hello,
I believe you'll have to do some data aggregation first. The following
will do it.
dat2 - merge(sample.dat, aggregate(value ~ pop, data = sample.dat, FUN
= sum), by = pop)
dat2$value.x - dat2$value.x/dat2$value.y
test-ggplot(dat2, aes(x=response.category,y=value.x, group=pop))
Thanks for your reply Pascal.
The alpha argument in binconf() is probability of a type I error, so
confidence coefficient = 1-alpha.
Alternately, binom::binom.confint() is given the argument as confidence
level.
The 'exact' method in both functions gives results as expected. It's
just odd for me
remainderFunction-function(x,d)
{
ifelse(x%%d==0,yes=return(which(x%%d==0)),no=return(NULL))
}
remainderFunction(x=c(23:47),d=3)
The above call returns c(2, 5, 8, 11, 14, 17, 20, 23), the value of (23:47)%%3.
Note that remainderFunction(integer(0), 3) returns logical(0).
The return()
Dear Colleagues,
I'm attempting to use the function aovp in library lmPerm, and am getting
strange results. The package maintainer appears to be deceased, and I'm
wondering if anyone else has experience with this package.
I'm attempting a permutation test for a two-way analysis of
On 09/11/13 07:54, Davis, Brian wrote:
I'm sure this has been answered before but alas my googlefoo is not that strong.
I have several .Rdata files with a single object in them. I need to set the class of the
object to myClass. Unfortunately, I don't know the name of the object
beforehand.
I am trying to figure out how to create a loop that will take the
difference of each member of a vector from each other and also spit out
which one has the least difference.
I do not want the vector member to subtract from itself or it must be able
to disregard the 0 obtained from subtracting
On 10/09/2013 10:58 AM, Andreas Maunz wrote:
Hi all,
I have a shiny app, in which I want to use rgl's snapshot function. I am
running Xvfb on my server so that rgl works. I start my shiny app as
follows:
echo Checking for Xvfb...
pgrep -U username Xvfb /dev/null 21
if [ $? -gt 0 ]; then
Hi there,
I am trying to estimate the mlogit model. but I get the following error.
Error in solve.default(H, g[!fixed]) :
system is computationally singular: reciprocal condition number =
4.65795e-19
I have googled it and found out the collinearity between independent
variables cause this
Hi,
I am using the igraph package to plot a network. I need most of the
vertices to be green and circular. A few selected vertices I need to change
to make them blue squares.
I created this loop to color the necessary nodes blue but I dont know how to
change their shapes:
for(i in
On 09/11/2013 09:06 AM, Charles Novaes de Santana wrote:
Dear all,
I am following instructions of FAQ 7.2 (
http://cran.r-project.org/doc/FAQ/R-FAQ.html#How-can-I-create-rotated-axis-labels_003f)
to create rotated labels in my plots, but I am facing some problems when
plotting variables with
Thank you very much for your help.
Here in Scandinavia the annual average temperature profile looks very much
like sin-function. So it's possible estimate the average daily values using
monthly average values. The future data is climate change scenario data.
Regards Pentti
--
View this
I have seen ?Startup and already update .RProfile in home folder, but as I
already said it just affected user's Rprofile, not the global one.
I might already find the solution for my problem.
I just have to distribute one .Rprofile sscript to all user. That Rprofile
will source files in a shared
28 matches
Mail list logo