Dear R Helpers,
I need to find the root of following equation.
0.0016^2 = (0.001*x)^2 + (0.002 * (1-x))^2 + 2 * 0.7 *0.001*0.002 * x * (1-x).
I had tried using animation package as follows.
# My Code
library(animation)
ani.options(nmax = 500)
solu = newton.method(function(x) 0.0016^2 -
Hi Amy,
Not using animation, but this seems to work:
f - function(x) 0.0016^2 - 0.001^2*x^2 - 0.002^2*(1-x)^2 -
2*0.7*0.001*0.002*x*(1-x)
curve(f, -1, 1)
abline(h = 0, lty = 2, col = 'gray')
uniroot(f, c(-1,1))
abline(v = .3203, lty = 2, col = 2)
HTH,
Jorge
On Sun, Nov 28, 2010 at 3:43 AM,
Dear Jorge Ivan Velez sir,
Thanks a million for your great solution. You have made my Sunday. Thanks again.
Regards
Amy
--- On Sun, 11/28/10, Jorge Ivan Velez jorgeivanve...@gmail.com wrote:
From: Jorge Ivan Velez jorgeivanve...@gmail.com
Subject: Re: [R] Finding root of quadratic equation
Hi. I am new to R and facing a problem that I cannot solve.
I am writing some basic functions. Then I would like to have a master function
that allows me to call one of the functions which I created, but I cannot
figure out how to do so.
Below is an example. The functions rnormIra and
Am 27.11.2010 09:48, schrieb Stephen Liu:
I found the datasets of AER
cool.
detach(package:AER, unload = TRUE)
detach(package:AER) works for me.
data()
still found car there.
you mean cars ? This is not part of AER but in a base R installation.
install.packages(EcDat)
Where can I
Hi folks,
Win 7 64 bit
R 32 bit
install.packages(gregmisc)
Installing package(s) into
âC:\Users\satimiswin764\Documents/R/win-library/2.12â
(as âlibâ is unspecified)
--- Please select a CRAN mirror for use in this session ---
also installing the dependency âgmodelsâ
trying URL
Hi folks,
Which R packages containing sample .xls files? TIA
B.R.
Stephen L
[[alternative HTML version deleted]]
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
On 2010-11-28 19:46, Stephen Liu wrote:
Hi folks,
Which R packages containing sample .xls files? TIA
why do you need .xls format data file?
B.R.
Stephen L
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
Thank you very much.
What I actually do was
data1 - read.delim(path,head=FALSE,sep=,)
motor_UPDRS -data1[5]
qqnorm(motor_UPDRS)
I eventually noticed that I missed a , in the second command. And I cannot
retrieve a vector correctly.
--
View this message in context:
Hi Stefan,
Tks for your advice.
detach(package:AER)
data()
Data sets in package âcarâ:
detach(package:car)
data()
Data sets in package âdatasetsâ. I have to run detach twice getting back
to
package 'datasets'
install.packages(Ecdat)
Installing package(s) into
Hi,
why do you need .xls format data file?
For learning.
I found following video:
http://www.youtube.com/watch?v=Hq0JmSnBX8Ifeature=mfu_in_orderlist=UL
I need econdat.xls, Excel file
B.R.
Stephen L
From: Jinsong Zhao jsz...@yeah.net
To:
On Sun, Nov 28, 2010 at 12:44 PM, Stephen Liu sati...@yahoo.com wrote:
library(gdata)
gdata
Error: object 'gdata' not found
gdata()
Error: could not find function gdata
Please advise what mistake I have committed. TIA
Try
help(package=gdata)
Regards
Liviu
B.R.
Stephen L
Hi,
Your function fails for a number of reasons. One of them is your
comparison (use browser() to see what is the value taken by f in your
function). Also, n, mean, min and max could not be extracted from ...
with your construction.
Here's my suggestion,
randomIra = function(f=runif, ...){
On 27/11/2010 8:59 PM, John Maindonald wrote:
Actually, I had until I created this file had everything on one line,
or had separate \SweaveOpts commands.
Putting everything on one line ensures that the graphics file
goes to the subdirectory snArt, but the file test1.tex is unchanged.
Note
On Sun, Nov 28, 2010 at 5:53 AM, Ira Sharenow irasharenow...@yahoo.com wrote:
Hi. I am new to R and facing a problem that I cannot solve.
I am writing some basic functions. Then I would like to have a master
function that allows me to call one of the functions which I created, but I
cannot
On 11/27/2010 6:13 PM, Joshua Wiley wrote:
Interesting use of outer, but I think you're overthinking it ;)
expand.grid(dimnames(x3))
Ah, thanks. I guess I was thinking outer the box ;-)
If you want it as a vector separated by colons...
apply(expand.grid(dimnames(x3)), 1, paste, collapse =
On Nov 28, 2010, at 7:16 AM, Stephen Liu wrote:
Hi Stefan,
Tks for your advice.
snipped
Installation went through w/o problem.
library(Ecdat)
data()
Data sets in package ‘datasets’ NOT 'Ecdat'
??Ecdat
...
Ecdat::Caschool The California Test Score Data Set
Ecdat::Griliches
Hi, Greg, Stephen, Liviu:
I tried install.packages('gregmisc'), which Stephen said he
had. Then help(pac=gdata) seemed to work normally. However, when I
then tried library(gdata), I got an error message from the the
operating system, saying perl.exe has stopped working. I cancelled
On Sun, Nov 28, 2010 at 10:40 AM, Spencer Graves
spencer.gra...@structuremonitoring.com wrote:
I tried install.packages('gregmisc'), which Stephen said he had.
Then help(pac=gdata) seemed to work normally. However, when I then
tried library(gdata), I got an error message from the the
Hi David,
Thanks for your advice. I got it.
But I can't resolve:
library(AER)
Loading required package: car
Loading required package: MASS
Loading required package: nnet
Loading required package: survival
Loading required package: splines
Loading required package: Formula
Loading required
On Sun, Nov 28, 2010 at 4:58 PM, Stephen Liu sati...@yahoo.com wrote:
data()
displays Data sets in package ‘AER’:
But;
library(Ecdat)
data()
displays Data sets in package ‘datasets’:
a large datasets including those in package Ecdat? NOt only Ecdat
separately.
Read ?data. Try
Hello, All:
Prof. Ripley suggested I remove RTools/perl from my path. I did
that leaving Strawberry perl. Then everything seemed to work
appropriately.
Thanks to all.
Spencer
On 11/28/2010 7:49 AM, Gabor Grothendieck wrote:
On Sun, Nov 28, 2010 at 10:40 AM, Spencer
On Sun, 28 Nov 2010 03:46:45 -0800 (PST) sati...@yahoo.com wrote:
SL Hi folks,
SL
SL Which R packages containing sample .xls files? TIA
Help yourself! Create your own! If you do not have Excel use
OpenOffice and save as xls!
Stefan
__
R-helpers,
I recently submitted a help request for the predict.drm function found in the
drc package. I am still having issues with the function and I am submitting
reproducible code hoping that somebody can help me figure out what is going on.
library(drc)
# Fit a 4 parameter
On Sun, 28 Nov 2010 07:54:43 + (GMT), Prof Brian Ripley
rip...@stats.ox.ac.uk wrote:
On Sat, 27 Nov 2010, Mike Prager wrote:
I need to generate a plot with both open and filled circles. It is
simple enough, using pch=1 and pch=16.
The R pdf graphics output is going into pdftex 1.40.10
Puzzled. Why are the data you offer to predict() for the independent
variable, conc, all NA's? Is there something reversed or inverted
about how drc functions handle formulas.
--
David.
On Nov 28, 2010, at 2:33 PM, Brant Inman wrote:
R-helpers,
I recently submitted a help request for the
Hi,
I have a matrix, say
m=matrix(c(
983,679,134,
383,416,84,
2892,2625,570
),nrow=3
)
i can find its row/col sum by
rowSums(m)
colSums(m)
How do I divide each row/column by its rowSum/colSums and still return in
the matrix form?
(i.e. the new rowSums/colSums
Hi Casper,
Try
m/colSums(m)
m/rowSums(m)
HTH,
Jorge
On Sun, Nov 28, 2010 at 3:46 PM, casperyc wrote:
Hi,
I have a matrix, say
m=matrix(c(
983,679,134,
383,416,84,
2892,2625,570
),nrow=3
)
i can find its row/col sum by
rowSums(m)
colSums(m)
How do
In that case, there are values 1,
which is clearly not what I wanted.
Thanks.
I think I should use prop.table
--
View this message in context:
http://r.789695.n4.nabble.com/how-to-divide-each-column-in-a-matrix-by-its-colSums-tp3062739p3062752.html
Sent from the R help mailing list archive
Hello!
I stumbled upon something odd that took a while to track down, and I wanted to
run it by here to see if I should submit a bug report. For randomly generated
numbers (from a variety of distributions) rounding them to specifically 2
digits and then multiplying them by 100 produces strange
On Nov 28, 2010, at 4:20 PM, Cory Rieth wrote:
Hello!
I stumbled upon something odd that took a while to track down, and I
wanted to run it by here to see if I should submit a bug report. For
randomly generated numbers (from a variety of distributions)
rounding them to specifically 2
prop.table divides every element by the matrix total, not its colSums:
m - matrix(1:4, 2)
m
[,1] [,2]
[1,]13
[2,]24
prop.table(m)
[,1] [,2]
[1,] 0.1 0.3
[2,] 0.2 0.4
m/rowSums(m) divides every row by its rowSum:
m/rowSums(m)
[,1] [,2]
On 28/11/2010 4:20 PM, Cory Rieth wrote:
Hello!
I stumbled upon something odd that took a while to track down, and I wanted to
run it by here to see if I should submit a bug report. For randomly generated
numbers (from a variety of distributions) rounding them to specifically 2
digits and
On 2010-11-28 13:20, Cory Rieth wrote:
Hello!
I stumbled upon something odd that took a while to track down, and I wanted to
run it by here to see if I should submit a bug report. For randomly generated
numbers (from a variety of distributions) rounding them to specifically 2
digits and then
I am using
prop.table(m,1)
and
prop.table(m,2)
my aim.
which I think is the most 'easy' way.
Thanks.
Casper
--
View this message in context:
http://r.789695.n4.nabble.com/how-to-divide-each-column-in-a-matrix-by-its-colSums-tp3062739p3062797.html
Sent from the R help mailing list archive
I need to solve a system of non-linear fourth-order differential
equations. Is there a command which solves this system?
Thanks in advance.
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting
sweep(m,1,rowSums(m),/)
sweep(m,2,colSums(m),/)
On 11/28/2010 9:55 PM, casperyc wrote:
In that case, there are values 1,
which is clearly not what I wanted.
Thanks.
I think I should use prop.table
__
R-help@r-project.org mailing list
FAQ 7.31
http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-doesn_0027t-R-think-these-numbers-are-equal_003f
You find it odd that the result is not an integer, while I find the fact
that your calculation actually works reliably with any number of digits
surprising, and you should avoid assuming
On Nov 28, 2010, at 4:43 PM, David Winsemius wrote:
On Nov 28, 2010, at 4:20 PM, Cory Rieth wrote:
Hello!
I stumbled upon something odd that took a while to track down, and
I wanted to run it by here to see if I should submit a bug report.
For randomly generated numbers (from a variety
Thanks: I didn't read the prop.table help page with sufficient care.
On 11/28/2010 1:48 PM, casperyc wrote:
I am using
prop.table(m,1)
and
prop.table(m,2)
my aim.
which I think is the most 'easy' way.
Thanks.
Casper
--
Spencer Graves, PE, PhD
President and Chief Operating Officer
Brant,
See below.
On 2010-11-28 12:25, David Winsemius wrote:
Puzzled. Why are the data you offer to predict() for the independent
variable, conc, all NA's? Is there something reversed or inverted
about how drc functions handle formulas.
-- David. On Nov 28, 2010, at 2:33 PM, Brant Inman
I interpreted the to be that predict.drc was expecting a third
argument, curveid, which had no default, and that creating a
dataframe like this was going to solve the problem.
newdt - data.frame( conc= seq(0.2, 9, 0.01) , CURVE=1)
prd.p - predict(fit, newdata=newdt, curveid=CURVE,
I have a glm regression (quasi-poisson) of log(mu) on x but I have varying
degrees of confidence in the x values, and can attach a numerical weighting
to each. Can anyone help me with suggestions of how to analysise this. Is
there an R package that would help?
Wendy
[[alternative HTML
Hi all,
A beginner's question: I have to analyse univariate, strongly periodic data
collected every hour for a period of 1 week and I need to compare 5
different groups for significant differences between them.
Is there a better way to do this in R, other than pairwise t-tests of
summary
Thanks for both the replies.
I think you can come closest to what you want within rgl by using
sprites rather than rendering transparent spheres. See
examples(sprites3d).
Sprites helps a lot indeed. With enough transparency I am close to what I want.
If you only have 2 things with simple
Hi Yanika,
Please try ?uniroot and ?ployroot
f - function(x) x^4-16
uniroot(f, lower= -3, upper=0)
polyroot(c(-16,0,0,0,1))
-
A R learner.
--
View this message in context:
http://r.789695.n4.nabble.com/non-linear-fourth-order-differential-equations-tp3062805p3062894.html
Sent from the R
Hi Andy,
If you could provide a sample data set, it would help others to give a
solution.
I suggest look at the data and select a model, then anova. Take group as one
variable, record time (1 to 24 ) as the second variable and the week day
(Monday to Friday) as the third variable. Then test the
Hi,
I am running the RODBC examples form the help guide. I am trying to
UPDATE a table in an Access data base but I am having an error.
library(RODBC)
library(termstrc)
path = getwd()
setwd(getwd())
dbName = data.mdb
pathdbname = paste(path,/,dbName,sep=)
accesChannel =
Hi Wendy,
In case you haven't see it, the glm function accepts an optional
weights argument.
Michael
On 29 November 2010 09:42, Wendy Anderson newhorizonscand...@gmail.com wrote:
I have a glm regression (quasi-poisson) of log(mu) on x but I have varying
degrees of confidence in the x values,
In case you haven't see it, the glm function accepts an optional
weights argument.
Thanks for the reply. But the philosopy behind weighting is the assumption
of unequal variance in the y values. In normal regression one assumes that
the x values are known without error
Wendy
Sorry Wendy
Hello again Wendy,
Actually, the simex package is probably a more useful suggestion...
http://www.stat.uni-muenchen.de/~helmut/Texte/Simex_Rnews.pdf
Michael
On 29 November 2010 13:55, Michael Bedward michael.bedw...@gmail.com wrote:
In case you haven't see it, the glm function accepts an
Just starting to learn R so excuse me if this is a simple question. I'm
wondering how I get the percent difference in sequential values in one
column of a dataframe. If I had a dataframe and one of the columns was
value, how would I go about calculating (v2-v1)/v1 (v3-v2)/v2
(v4-v3)/v3
Hi! I am learning R and have a question that is probably fairly simple for
those of you much more learned than I.
I am messing with Arrays and am doing some simple stuff to get the hang of
them. I will have a seperate array already pulled up and it will have
columns and rows. I figured out
Hi, Stephen:
What operating system do you have? From the path you cite, I
assume you are using some version of Windows.
Wikipedia on perl says there are two primary version of perl
for Windows Strawberry perl, which is free, open source, and
ActivePerl, which is free but not
Hi Eric,
I think this does what you want. It may be a simple question, but
that does not necessarily mean the easiest/fastest answer is
intuitive. Welcome to R!
dat - data.frame(v = 1:100)
## the with() is just a convenient way to avoid having to type
## dat$v every single time---similar to
Hi B,
What you need to do is pass a vector with the indices you want to
extract. So, you have 1:7 (which expands to 1, 2, 3, ... 7) and 12:34
(which again expands). How would you combine two sets of numbers?
c(), the combine or concatenate function. Putting this in action:
mya - array(1:510,
Hello Folks. This must be a silly question with a (not) obvious (to me)
answer.
Consider this:
tmp - matrix(1:200, nrow = 20)
vec - 300:309
tmp[9,] - vec # replacing one row works fine
p - c(3, 11, 17)
tmp[p,] - vec
# replacing multple rows pastes the values down a column and recycles vec.
Josh, the data set is called StatTemps and is in the PASWR package. I want
to make an array that involves only the 8 a.m. and a separate array that
involves only the 9 a.m. so i can get info on the temperatures in those
groups. So I still want it in the format of StatTemps but in two arrays that
On 2010-11-28 19:38, Joshua Wiley wrote:
Hi Eric,
I think this does what you want. It may be a simple question, but
that does not necessarily mean the easiest/fastest answer is
intuitive. Welcome to R!
dat- data.frame(v = 1:100)
## the with() is just a convenient way to avoid having to type
vec is being recycled column wise, so you can repeat each element the
required number of times:
tmp[p,] - rep(vec, each = length(p))
There's many ways to achieve this though, so it depends on what other
variations you might want to deal with.
Cheers, Mike.
On Mon, Nov 29, 2010 at 2:53 PM,
Hi Bryan,
The reason vec gets recycled is that you are replacing more values
than vec has. Just look at:
tmp[p, ]
this is 3 x 10 matrix, which you are trying to replace with a vector
of length 10. If you want the replacement to occur without any
recycling, you'll need to make vec be a matrix
On Sun, Nov 28, 2010 at 7:58 PM, Peter Ehlers ehl...@ucalgary.ca wrote:
Then, since this is R, here's the next step:
v - sample(50, 100, replace = TRUE)
result - diff(v) / v[-length(v)]
Very nice! It did not even occur to me to use diff() in this case,
though that is exactly what is needed
On 2010-11-28 19:53, Bryan Hanson wrote:
Hello Folks. This must be a silly question with a (not) obvious (to me)
answer.
Consider this:
tmp- matrix(1:200, nrow = 20)
vec- 300:309
tmp[9,]- vec # replacing one row works fine
p- c(3, 11, 17)
tmp[p,]- vec
# replacing multple rows pastes the
Thanks to Michael, Josh and Jorge - Problem fixed. Michael's suggestion was
what I needed, but I wouldn't have ever conceptualized it that way, and
Jorge showed me how simple the function could be (at this hour, I was
imagining it would be more work). Thanks guys. Bryan
On 11/28/10 11:03 PM,
On Sun, Nov 28, 2010 at 11:54 AM, Spencer Graves
spencer.gra...@structuremonitoring.com wrote:
Hello, All:
Prof. Ripley suggested I remove RTools/perl from my path. I did that
leaving Strawberry perl. Then everything seemed to work appropriately.
1. If you have the Rtools perl prior
On Nov 28, 2010, at 10:56 PM, bfhancock wrote:
Josh, the data set is called StatTemps and is in the PASWR package.
I want
to make an array that involves only the 8 a.m. and a separate array
that
involves only the 9 a.m. so i can get info on the temperatures in
those
groups. So I still
## This is an example where ``-quoted non-syntactic names work in
## simple formulas, but not in formulas with an Error() term.
## Is this intentional or an oversight when ``-quoted names were added?
tmp - data.frame(y=1:6,
`x^1`=factor(c(1,2,1,2,1,2)),
On 29 November 2010 15:09, Joshua Wiley jwiley.ps...@gmail.com wrote:
(I hope I'm like wine and get better with age or)
Sigh, me too - but I suspect I'm heading more towards vinegar
Michael
__
R-help@r-project.org mailing list
Hi Spencer,
I don't have RTools installed. Therefore I can't find RTools/perl
library(RTools)
Error in library(RTools) : there is no package called 'RTools'
library(Ecdat)
no complaint
data()
The datasets on Ecdat are added to the big list.
However
data(package='Ecdat')
displays the
Hi, Stephen:
RTools is not a standard R package. It is a collection of
software tools for building R packages. If you use R much, I highly
recommend you learn about R package development, because I believe doing
so can increase your software development productivity.
On Sun, Nov 28, 2010 at 11:49 PM, Stephen Liu sati...@yahoo.com wrote:
Hi Spencer,
I don't have RTools installed. Therefore I can't find RTools/perl
library(RTools)
Error in library(RTools) : there is no package called 'RTools'
Rtools is not an R package. Its a collection of UNIX-like
On Mon, Nov 29, 2010 at 12:06 AM, Gabor Grothendieck
ggrothendi...@gmail.com wrote:
Regarding your question about gdata,
1. if gdata did not get installed then just do this from within R:
install.packages(gdata)
(or use the Packages | Install Package(s) menu to accomplish same).
If that
Hi Gabor,
library(gdata)
no complaint
library(help = gdata)
It works. Thanks
?read.xls
I must run ??read.xls
All the topics I tested must use ??topic_name
B.R.
Stephen L
From: Gabor Grothendieck ggrothendi...@gmail.com
Cc: Spencer Graves
On Mon, Nov 29, 2010 at 7:01 AM, Stephen Liu sati...@yahoo.com wrote:
?read.xls
I must run ??read.xls
Not if you
library(gdata)
first. Then
?read.xls
should work.
Regards
Liviu
__
R-help@r-project.org mailing list
Hi, Liviu:
Doesn't he need a version of perl installed with a particular
perl package for read.xls to work properly?
Spencer
On 11/28/2010 10:40 PM, Liviu Andronic wrote:
On Mon, Nov 29, 2010 at 7:01 AM, Stephen Liusati...@yahoo.com wrote:
?read.xls
I must run ??read.xls
It is perhaps worth mentioning in this context that in the R language,
functions and language components (like formulas, expressions, etc.)
are full first class objects -- which means basically that they can be
treated like any data object: e.g. passed as arguments to a function,
returned as
Dear Spencer
On Mon, Nov 29, 2010 at 8:05 AM, Spencer Graves
spencer.gra...@structuremonitoring.com wrote:
Doesn't he need a version of perl installed with a particular perl
package for read.xls to work properly?
I really don't know. I assume that, if the package was installed and
could
77 matches
Mail list logo