Hi all,
Would be great if you could help me get my head around the "further
arguemnts" in the optim function. Let's say we have f and g as shown:
f<-function(x,a,b){(x-a)^2+b}
optim(100,fn=f,gr=NULL,2,5) #the NULL is annoying
g<-function(x,a){2*(x-a)} optim(100,fn=f,gr=g,2,5)
1. How does opti
> Hello,
>
> I am new to R (and a novice at statistics). I have a list of objects,
with
> (ideally) 10 different attributes measured per object. However, in
reality,
> I was not able to obtain all 10 attributes for every object, so there is
> some data missing (unequal number of measured attribut
On May 9, 2013, at 7:06 PM, jpm miao wrote:
> Hi,
>
> As an example, how can I get the data such that field a of ab, ab["a"],
> equals 3? I expect the answer to be the union of 2 and 4, as
>
> Thanks,
>
>> a<-c(1,3,4,3,5,6,5)
>> b<-c(2,4,6,7,3,1,2)
>> ab<-data.frame(a,b)
>> ab
> a b
> 1 1
Hi,
Try ab[a==3,]
You're selecting only rows for which a==3 (before the comma), and all
columns (empty condition for column index, after the comma)
Patrick
2013/5/9 jpm miao :
> Hi,
>
>As an example, how can I get the data such that field a of ab, ab["a"],
> equals 3? I expect the answer to
I am surprised David failed to comment on your choice of variable name. "sd" is
an extremely commonly-used function, and defining a variable with that name
will make it difficult for you to use that function. "data" is another common
function. Some safer options would be "dta" or "sdata". If in
Hi,
As an example, how can I get the data such that field a of ab, ab["a"],
equals 3? I expect the answer to be the union of 2 and 4, as
Thanks,
> a<-c(1,3,4,3,5,6,5)
> b<-c(2,4,6,7,3,1,2)
> ab<-data.frame(a,b)
> ab
a b
1 1 2
2 3 4
3 4 6
4 3 7
5 5 3
6 6 1
7 5 2
> ab[a==3]
Error in `[.da
On 05/10/2013 07:22 AM, Carol Van Hulle wrote:
Hi all,
I am trying to create a barplot for the following data:
ssmsm, ssaudmn, sstacmn
.35, .93, .63
1.9, 1.51., 1.8
.78, 1.6, 1.24
1.10, 1.60, 1.24
I used the following code:
sd<-read.table("dat.csv", header=T, sep=",")
barplot(as.mat
On 05/09/2013 11:06 PM, Meenu Chopra wrote:
Hiii
I am trying to install R-2.15.2
after doing ./configure its showing error: --with-x=yes (default) and X11
headers/libs are not available
and when i am running make its showing
make: *** No targets specified and no makefile found. Stop.
Even I rea
On May 9, 2013, at 2:22 PM, Carol Van Hulle wrote:
> Hi all,
>
> I am trying to create a barplot for the following data:
>
> ssmsm, ssaudmn, sstacmn
> .35, .93, .63
> 1.9, 1.51., 1.8
> .78, 1.6, 1.24
> 1.10, 1.60, 1.24
>
> I used the following code:
> sd<-read.table("dat.csv", header=T, s
Hi all,
I am trying to create a barplot for the following data:
ssmsm, ssaudmn, sstacmn
.35, .93, .63
1.9, 1.51., 1.8
.78, 1.6, 1.24
1.10, 1.60, 1.24
I used the following code:
sd<-read.table("dat.csv", header=T, sep=",")
barplot(as.matrix(sd), main="Figure 1", ylab= "Mean", beside=TRUE,
I am not a GIS expert, but I would be curious to know: Where is the variance
information supposed to come from? And, do you have the map positions and
scaling aligned already?
---
Jeff NewmillerThe
On Thu, May 9, 2013 at 8:09 PM, Gabor Grothendieck
wrote:
> On Thu, May 9, 2013 at 7:24 PM, Ye Lin wrote:
>> Hey All,
>>
>> I want to duplicate the records but add a new "timestamp" columns as new
>> time series, but I dont know how to do that.
>>
>> my dataset(dat1) looks like this:
>>
>> No.
On Thu, May 9, 2013 at 7:24 PM, Ye Lin wrote:
> Hey All,
>
> I want to duplicate the records but add a new "timestamp" columns as new
> time series, but I dont know how to do that.
>
> my dataset(dat1) looks like this:
>
> No. TimeStamp Var1
>
> 1 2012-06-18 06:00:003
Hey All,
I want to duplicate the records but add a new "timestamp" columns as new
time series, but I dont know how to do that.
my dataset(dat1) looks like this:
No. TimeStamp Var1
1 2012-06-18 06:00:003
2 2012-06-18 06:06:00 4
I use this code to do dup
On May 9, 2013, at 8:50 AM, Pooya Lalehzari wrote:
> Hello,
> When I use "apply" on a data frame, it seems like I get an error when I have
> a column that is not numeric. Via trial and error I realized that if I remove
> that column, I can get it to run. Is there a better way to tell the functi
Ah! That works. Thank you very much. I interpreted from ?symbols that
with inches=F getting the units from x, it was enough to coordinate
the units in y. I did not know about asp.
Thanks again
D
On 9 May 2013 15:12, David Carlson wrote:
> Change the first line to
>
> plot(c(0, 2), c(0, 2), asp
Change the first line to
plot(c(0, 2), c(0, 2), asp=1)
That will set the aspect ratio between the vertical and horizontal axes to
be equal.
-
David L Carlson
Associate Professor of Anthropology
Texas A&M University
College Station, TX 77840-4352
-Origin
Hi,
On Thu, May 9, 2013 at 4:58 PM, Damián Cirelli wrote:
> Hello nice R people,
>
> I'm struggling with the following code:
>
> plot(c(0, 2), c(0, 2))
> symbols(1, 1, circles=0.5, add=T, inches=F)
> symbols(1, 1, squares=1, add=T, inches=F)
> abline(v=c(0.5, 1.5), lty=2)
> abline(h=c(0.5, 1.5),
Hello nice R people,
I'm struggling with the following code:
plot(c(0, 2), c(0, 2))
symbols(1, 1, circles=0.5, add=T, inches=F)
symbols(1, 1, squares=1, add=T, inches=F)
abline(v=c(0.5, 1.5), lty=2)
abline(h=c(0.5, 1.5), lty=2)
The a-b lines in the vertical direction coincide perfectly with the
Dear all,
I'm looking for a test to identify significant differences
(p-value) between 2 raster maps.
Can you suggest me a way to solve this problem?
Thank you in advance.
Paul
[[alternative HTML version deleted]]
__
R-help@r-project.org ma
Hello R-helpers,
I have a data set of points in three dimensions (x, y, z), each with an
associated amplitude. These are data collected using a radar, and of tree
roots.
There are holes in the data, and I'm interested in interpolating the
missing values to create a root map. This could simply be
The apply() function works on an array or a matrix. There is no need to
guess, just read the manual page:
? apply
So including a character variable forces the entire matrix to characters.
Excluding character variables will let you operate on the numeric values,
but your code suggests you are tryi
Without a reproducible example it's hard to say for certain, but I
imagine you want
buybdge != badge
or
!(buybdge == badge)
Note that ?"==" (the help for == ) would have told you that.
Sarah
On Thu, May 9, 2013 at 4:05 PM, ramoss wrote:
> Hello,
>
> I have a simple question:
>
> I know how to s
I want to clarify we are talking about 2 variables in a datframe here.
--
View this message in context:
http://r.789695.n4.nabble.com/subsetting-by-is-not-tp4666706p4666707.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r-pro
Hello,
I have a simple question:
I know how to subset by is: buy1 <- subset(buy,buybdge==badge)
How do I subset if I don't want buybdge to equal badge?
Thanks ahead for your help
--
View this message in context:
http://r.789695.n4.nabble.com/subsetting-by-is-not-tp4666706.html
Sent from
What is rbern()? Assuming it should be rbinom(), this can be simplified:
> set.seed(42)
> y <- rbinom(100, 1, .5)
> x.1 <- rnorm(100, .02, 1)
> x.2 <- rnorm(100, .07, 1)
> x <- ifelse(y==0, x.1, x.2)
>
> glm.out = glm(formula = y ~ x, family = binomial(logit))
> summary(glm.out)
Call:
glm(formu
You can also turn off DEoptim's trace code and add your own to the function
that you supply to DEoptim. You can add print statements to your function
by hand or use trace() on it or use the following tracer that keeps track of how
many times your function has been called and prints a report once e
Hello,
Em 09-05-2013 20:44, Sarah Goslee escreveu:
Hi,
On Thu, May 9, 2013 at 12:28 PM, KatrinH Heimann
wrote:
Dear all,
I would like to subset a dataframe using multiple conditions.
So if I have two columns 1 and 2, I would like to EXCLUDE all rows in which
the value of column 1 is "a" AND t
Hello,
It's difficult to know what's going on without a data example. Can you
post the output of
dput(head(data, 30))
?
Maybe the columns are not of class "character" but of class "factor".
You should also post the output of
str(data)
In the mean time, try
subset(data, column1 != "a" &
Hi,
On Thu, May 9, 2013 at 12:28 PM, KatrinH Heimann
wrote:
> Dear all,
> I would like to subset a dataframe using multiple conditions.
> So if I have two columns 1 and 2, I would like to EXCLUDE all rows in which
> the value of column 1 is "a" AND the value of column 2 is "b".
> I tried data[(da
Hello,
When I use "apply" on a data frame, it seems like I get an error when I have a
column that is not numeric. Via trial and error I realized that if I remove
that column, I can get it to run. Is there a better way to tell the function
not to worry about the character columns, especially sinc
Well, in general, you can use the following functions:
http://stat.ethz.ch/R-manual/R-patched/library/stats/html/Binomial.html
See the examples at section "Examples".
You may want to try the following:
n<-10
k <- seq(0, n, by = 1)
plot (k,dbinom(k,n,0.5,log =FALSE),type="l")
plot(k,pbinom(k,n,0.5,
Dear list,
I am trying to decompose a distribution into 4 normal distributions using
the function normalmixEM from package mixtools. This works well, I get four
mus and sds. I am now wondering how to get the 3 x values where the
distributions intersect. I have tried the following:
> summary(gemix
Dear David,
The package doesn't have an option to customize the output of the trace.
However, you can create a custom version of the package that doesn't print
the
parameters. Get the package source code, uncompress it, and find the file
de4_0.c in the src/ directory. Then comment out the calls
Dear all,
I would like to subset a dataframe using multiple conditions.
So if I have two columns 1 and 2, I would like to EXCLUDE all rows in which
the value of column 1 is "a" AND the value of column 2 is "b".
I tried data[(data$column1 != "a" & data$column2 != "b"),] but that deletes
me every row
Dear R experts,
I am trying to create a dataset, with one dependent binomial and one
independen (normal) variable.
I have the condition that my x should be created in the following way:
if y=0 my x should have mean=0.2 and variance=1
if y=1 my x should have mean=0.7 and variance=1
Furthermore, my
Thank-you very much Richard! This is extremely helpful. I would have
never thought of approaching it this way but it makes perfect sense.
I'm in awe of the promptness and quality of help/advice I'm receiving on
this topic - it reflects very well on the R community.
All the best!
Cyril Lundrigan
Hi David,
Unfortunately, there's no way for the user to do that. You would need
to change line 522 in de4_0.c (where the printing occurs) and
rebuild/install the package.
Best,
--
Joshua Ulrich | about.me/joshuaulrich
FOSS Trading | www.fosstrading.com
R/Finance 2013: Applied Finance with R
Thanks Peter!
I sent the link to the entire manual since the intermediate steps in that
section refer to many other chapters in the book and thought that may be
helpful in achieving a solution. I apologize for any inconvenience this may
have created for you.
Cyril
-Original Message---
I'm running DEoptim - it works great!
(A HUGE THANK YOU to David Ardia, Katharine Mullen, Brian Peterson, and Joshua
Ulrich, and Kris Boudt!!!).
Sometimes I set trace to a number so I can see a few intermediate points in the
optimization.
However, I have a large number of variables and would lik
Thank you for this example.
The way to handle it is with the split argument to the summary.aov function.
Look at ?summary.aov for details.
I use the reshape package to get the data ordered the way aov wants it.
I use the HH package for the graph.
## from:Lundrigan, Cyril
## to: r-help
hi all -- i looked through the R Language Definition document, but couldn't
find any particular warning or example that would clarify the best use of
attribute setting for R objects.
let x be some R object, and i'd like to add attribute "foo" with value
"bar".
case 1:
> attr(x, "foo") <- "bar"
c
On May 9, 2013, at 13:58 , Lundrigan, Cyril wrote:
> Hello
> I'm a new user of R and I'm using Deducer as the interface but also
> making use of the command interface where necessary. I'm trying to
> replicate Table 6.18 on page 262 in Statistical Procedures in
> Agricultural Research, by K. A.
Le jeudi 09 mai 2013 à 14:06 +0100, Meenu Chopra a écrit :
> Hiii
>
> I am trying to install R-2.15.2
> after doing ./configure its showing error: --with-x=yes (default) and X11
> headers/libs are not available
>
> and when i am running make its showing
> make: *** No targets specified and no mak
Hi
you will get probably better help from others but I would recommend you trying
to install recent version of R (3.0.0 I believe)
And you will be probably asked also about your OS and what exactly you did
during installation.
Regards
Petr
> -Original Message-
> From: r-help-boun...@
For information on binomial distribution functions:
> ?dbinom
For example:
> dbinom(0:10, 10, 0.5)
[1] 0.0009765625 0.0097656250 0.0439453125 0.1171875000 0.2050781250
[6] 0.2460937500 0.2050781250 0.1171875000 0.0439453125 0.0097656250
[11] 0.0009765625
> pbinom(0:10, 10, 0.5)
[1] 0.00097656
Hi
see
?rbinom
or other distribution functions
?Distributions
for plottting see
?plot
?curve
and for cdf see
?ecdf
and learn from examples in help pages.
Regards
Petr
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
> project.org] On Behalf Of ?
Hi
My name is Jeong In Sim, and I'm korean.
I'm learning 'R' on my own, so I have a question.
I want to make probability density function and cumulative density function
when X~Bin(10,0.5)
How can I draw graph? Which function do I have to use?
I want your help as soon as possible. Thank yo
Hello
I'm a new user of R and I'm using Deducer as the interface but also
making use of the command interface where necessary. I'm trying to
replicate Table 6.18 on page 262 in Statistical Procedures in
Agricultural Research, by K. A. Gomez and A. A. Gomez. New York,
Chichester, etc.: Wiley (1984)
Hi,
I want to fit a standardized generalized hyperbolic distribution to my
data, I am using the dsgh command of the fBasics package and the optim
command.
I tried the following:
---
Hiii
I am trying to install R-2.15.2
after doing ./configure its showing error: --with-x=yes (default) and X11
headers/libs are not available
and when i am running make its showing
make: *** No targets specified and no makefile found. Stop.
Even I read the install file also but i am not getting a
Hello,
Maybe the following will do it. Note, however, that in your data, for
start day 2012-02-11, the end day is always 2012-02-12 so the time
differences will be negative.
fun2 <- function(x){
d <- numeric(nrow(x) - 1)
for(i in seq_len(nrow(x))[-1]){
start
Since you pass your entire data.frame to metaMDS(), your first error
probably comes from the fact that you have included ID as one of the
variables. You should look at the results of
str(dat)
You can drop cases with missing values using
> dat2 <- na.omit(dat)
> metaMDS(dat2[,-1])
would run th
Hi Rui,
thanks for the quick fix. I am still wrapping my mind around your
expression, but unfortunately it doesn't quite give me what I want. You are
calculating differences between the start times. However, I would like to
know the 'idle' periods between the events, ie the time between the end of
Hi
Use drop=TRUE argument in interaction for removing unused levels.
Petr
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
> project.org] On Behalf Of Adel ESSAFI
> Sent: Wednesday, May 08, 2013 12:48 PM
> To: r-help
> Subject: Re: [R] R prints empty g
Hello,
If I understand it well, try the following.
tmp <- lapply(tapply(as.POSIXct(paste(df[,1], df[,2])), df[,1], diff),
`*`, 60)
lapply(tmp, as.integer)
Hope this helps,
Rui Barradas
Em 09-05-2013 11:45, Kai Mx escreveu:
Hi everybody,
I have an analysis problem that seems a little over
HI,
Try this:
dat1<- read.table(text="
V1 V2
A 1
B 2
A 1
B 3
",sep="",header=TRUE,stringsAsFactors=FALSE)
library(plyr)
ddply(dat1,.(V1),summarize, V2=list(V2))
# V1 V2
#1 A 1, 1
#2 B 2, 3
#or
aggregate(V2~V1,data=dat1,FUN= function(x) x,simplify=FALSE)
# V1 V2
#1 A
Hi,
dat1<- read.table(text="
Restaurant owner purchase_date
23 Chuck 3/4/2011
23 Chuck 3/4/2011
23 Chuck 3/4/2011
23 Chuck 3/4/2011
23 Bob 1/1/2013
23 Bob 1/1/2013
23 Bob 1/1/2013
1
Hi everybody,
I have an analysis problem that seems a little overwhelming to me, but is
probably not too hard to solve for you guys. I have a (fairly large)
dataframe that indicates usage of a resource on different days:
df <-data.frame (
dstartday =c(rep('2012-02-10', 4), rep('2012-02-11', 5)),
On 09-May-2013 01:42:07 Pascal Oettli wrote:
> On 05/09/2013 10:29 AM, Gundala Viswanath wrote:
>> I have the following list of data each has 10 samples.
>> The values indicate binding strength of a particular molecule.
>>
>> What I want so show is that 'x' is statistically different from
>> 'y', '
As I understand, it is an optimization problem.
LeastSquare=sum[y-f(x)]^2
Minimize least square by solving equations about a, b, and c. An iterative
method could be developed to get the result or some R functions might be
found useful. Please refer
http://r.789695.n4.nabble.com/Is-there-any-Gaus
61 matches
Mail list logo