I could use some help generating a time series for the Mackey-Glass equation:
dx/dt = 0.2 x(t-tau)/(1 + x(t-tau)^10) - 0.1 x(t) for the case there tau = 17.
I tried the "ddesolve" package but the dde(...) function seems to hang, not
producing anything. Can someone show me the R script how to do
Try using
source("P_Value")
before anything else.
Also, P_Value can be written as a one-liner:
P_Value <- function(Table) fisher.test(Table)$p.value
so you don't really need a separate function at all.
Bill Venables
CSIRO/CMIS Cleveland Laboratories
-Original Message-
From: r-help-b
Lowie,
You can save the function in a file called
'P_value.txt' or something like it
(I prefer 'P_value.r').
Then you load the function into your R session by
Using:
Source("P_value.txt",sep="") ).
It is better if you keep all your R functions into
The same directory, say directory "my_rfunc",
T
> -Mensaje original-
> De: r-help-boun...@r-project.org
> [mailto:r-help-boun...@r-project.org] En nombre de Ozan Bakis
> Enviado el: domingo, 02 de mayo de 2010 21:25
> Para: r-help@r-project.org
> Asunto: [R] adding year information to a scatter plot
>
> Hi R users,
>
> I would like t
Dear Lowie,
To use a function in R that you have saved in a file, you need to
source it in first (see ?source). Try this,
source(file="pathtoyourfile/P_Value.R") #or whatever your file is named exactly
Once you do that, you should be able to use your function. If you
always want it to load at
Dear R users,
I have a univariate time series and I want to examine the presence of
seasonality in the series without using graphical methods like
autocorrelation(acf) as I need to automate it in a function. Is there any
other way by which I could find the presence of seasonality and if
seasonali
Thanks.
Estimation of the same model with the same dataset gives different results
when "tsls" (from package sem) is used as opposed to "ivreg()" (from package
AER); both parameter estimates and standard errors are different. This is
intriguing. Can anyone throw some light on this? Is there any re
how about:
d=data.frame(ht=rnorm(20,60,20),sex=sample(0:1,20,rep=T)); d
with(d,by(ht,sex,mean))
with(d,by(ht,sex,function(x)mean(x>=60)))
hth, david freedman
--
View this message in context:
http://r.789695.n4.nabble.com/percent-by-subset-tp2123057p2123079.html
Sent from the R help mailing lis
Dear All:
I create a file named :"P_Value" with only one simple function:
P_Value <- function( Table ) {
S = fisher.test(Table, alternative = "two.sided");
return(S$p.value);
}
However, it seems that it's impossible to use this function
dir
Hi folks,
I have a matrix of 3 columns and 17 lines that represents a graph or a
adjacency matrix.
I have also a vector of 30 elements with some of the nodes of the graph
repeated.
seems like:
1. matrix that represents a graph:
1 2 1
1 3 1
1 4 1
2 1 1
2 4 1
3 1 1
4 1 1
4 2 1
2. vector of nodes
Dear R-users,
I am going through the last steps of package prep before submission to CRAN
and I have the following problem. My package contains a single vignette
written in optimbase.Rnw and that in stored in /inst/doc. optimbase.Rnw
contains multiple \input{} statements that refer to .tex files s
I ran this code (several times) from the Quick-R web page (
http://www.statmethods.net/advstats/cart.html) but my cross-validation
errors increase instead of decrease (same thing happens with an unrelated
data set).
Why does this happen?
Am I doing something wrong?
# Classification Tree with rpar
There are quite a few examples in
(1) ?strapply,
(2) on the home page and
(3) in the vignette
(4) on r-help back posts
if you having problems with understanding the textual description.
Note that X and FUN are also arguments to sapply
> args(sapply)
function (X, FUN, ..., simplify = TRUE, USE.N
Here's a simplified code example.
library(grid)
vp1 <- viewport(height=0.8, width=0.8, default.unit="snpc")
vp2 <- viewport(y = 0.5, just="bottom", gp=gpar(col="red", lwd="2"))
# draw triangle
function1 <- function(vp) {
grid.polygon(x=c(0,0.5,1), y=c(0.5,0,0.5), name="triangle", vp=vp)
}
# d
Thanks to all for their answers so far - the following suggestion comes close
to what I was looking for, but perhaps I was not clear enough in my initial
message.
Following the example below, I'd like to be able to interpolate in such a way
that considers adjacent datapoints in both columns and
Gabor Grothendieck wrote:
> The strapply function in gsubfn does that. See
> http://gsubfn.googlecode.com
Ah, thanks. The documentation for that function is pretty
difficult to grasp, but I think I figured it out. . . almost. However,
for some reason I can't seem to make strapply wo
oscar linares gmail.com> writes:
>
> Dear Rxperts,
>
> Running the following code:
> ===
> twlo=10; twhi=20; wt=154; vd=0.5; cl=0.046; tau=6; t=3; F=1;
>
> wtkg <- wt/2.2 # convert lbs to kg
>
> vd.pt <- wtkg * vd # comp
Dear Oscar,
The problem has to do with rounding (because you set the global digits
value to 2). Although what you see is 2.4*270=670; when R actually
calculates it, it is using full precision. If you set
options(digits=7) # the default
you will see that AR=2.357362, not 2.4.
HTH,
Joshua
On
Dear Rxperts,
Running the following code:
===
twlo=10; twhi=20; wt=154; vd=0.5; cl=0.046; tau=6; t=3; F=1;
wtkg <- wt/2.2 # convert lbs to kg
vd.pt <- wtkg * vd # compute weight-based vd (L)
cl.pt <- wtkg * cl # com
The strapply function in gsubfn does that. See http://gsubfn.googlecode.com
On Sun, May 2, 2010 at 6:03 PM, OKB (not okblacke)
wrote:
> I'm trying to figure out how to get the text captured by capturing
> groups out of a regex match. For instance, let's say I have the pattern
> "foo ([^
Is this what you want:
> x <- "This is a foo sentence I am reading."
> # only return the desired match
> sub(".*foo ([^ ]+).*", "\\1 ", x)
[1] "sentence"
>
>
On Sun, May 2, 2010 at 6:03 PM, OKB (not okblacke) wrote:
>I'm trying to figure out how to get the text captured by capturing
> g
I'm trying to figure out how to get the text captured by capturing
groups out of a regex match. For instance, let's say I have the pattern
"foo ([^ ]+)" and I match it against the string "This is a foo sentence
I am reading." The group in the pattern will match the word "sentence"
in
Are you looking for something like this?
data <- data.frame(first= c(1,2,3,4,5,6,7,8), zehn = c(15,NA,NA,NA,NA,18,NA,25),
second = c(4,NA,7,9,NA,10.2,NA,12),
third= c(6,7,NA,NA,10,12,NA,16))
data
library(zoo)
data2 <-na.approx(data,na.rm=F)
data2
?na.approx
Felipe D. Carri
On 3/26/10, Bert Gunter wrote:
> represented) is important for numerical calculations, what is the smallest
> number that anyone has actually seen describing physical phenomena in
> science?
>
There was a recent article in The Economist ("The force is weak with
this one", Apr 22nd 2010, [1]) th
On May 2, 2010, at 5:27 PM, Jessica Schedlbauer wrote:
Hello,
I have a matrix in which two variables, x and y, are used together
to determine z. The variables x and y are sorted into classes.
Specifically, values for variable x range from 0 to 2.7 and are
sorted into class increments o
Hello,
I have a matrix in which two variables, x and y, are used together to determine
z. The variables x and y are sorted into classes. Specifically, values for
variable x range from 0 to 2.7 and are sorted into class increments of 0.15 and
variable y ranges from 0-2100 with class increments
On May 2, 2010, at 4:25 PM, David Winsemius wrote:
On May 2, 2010, at 3:27 PM, Mohan L wrote:
>as.numeric(assame$Login) //convert to numerics
Nooo. You did not do what what I suggested earlier. Do not
reach for your keyboard in the R console until you have read the
FAQ secti
Please ignore my previous message about the difference between "tsls" and
"ivreg" results; that was my mistake.
Deepankar
On Sun, May 2, 2010 at 5:10 PM, Dipankar Basu wrote:
> Thanks.
>
> Estimation of the same model with the same dataset gives different results
> when "tsls" (from package sem
There is a screeplot() function that takes the output from prcomp. It plots
the value of the eigenvalue vs. the eigenvalue's number.
CS
-
Corey Sparks, PhD
Assistant Professor
Department of Demography and Organization Studies
University of Texas at San Antonio
501 West Durango Blvd
Monterey
On May 2, 2010, at 3:27 PM, Mohan L wrote:
>as.numeric(assame$Login) //convert to numerics
Nooo. You did not do what what I suggested earlier. Do not
reach for your keyboard in the R console until you have read the FAQ
section regarding converting factors to numeric. If you don
Many thanks for the suggestion!
That may reduce the computational time needed to find x value given
the y one (for hundreds of pairs). Certainly, I will look into manuals
for approx() and approxfun() in this regard.
Again, thanks for your taking time to read my previous posts and make
this valuab
Many thanks Prof. and Duncan!
Iconv worked like a charm together with CP1252 as the windows
encoding, and now all the text shows up correctly
Because the data frame also contained factors with levels that had
swedish characters, i ended up writing a small function for converting
the encoding of e
Hi Ozan,
The {calibrate} package allows you to do that.
install.packages("calibrate")
library(calibrate)
df=data.frame(year=c(2001,2002,2003),a=c(8,9,7),b=c(100,90,95))
df
plot(b~a,data=df)
textxy(df$a,df$b,df$year)
Muhammad
On 05/02/2010 08:25 PM, Ozan Bakis wrote:
Hi R users,
I would lik
I think that one of the packages, perhaps Hmisc or plotrix does this but you
can also do it just using text()
Example
plot(b~a,data=df, xlim=c(min(df$a)-5,max(df$a)+5), ylim=
c(min(df$b)-5,max(df$b)+5))
text( df$a+1,df$b, labels=df$year)
Alternatively you can do this in ggplot
library(ggplot)
Dear R Community,
I am trying to run a command line in R that will open an external program, have
it import a specific input file, run the program, then close the program. The
command line that I got from the developer of the model to do this looks like
what you see below:
c:\programx.exe -
On Fri, Apr 9, 2010 at 1:46 PM, array chip wrote:
> David,
>
> Thanks for the 2 previous posts from Sarkar. Actually, I am now one step
> closer. I am now able
> to remove the 3 outer lines of the bounding box using par.box argument, even
> Sarkar said in
> his 2008 post that par.box() does not
On Sun, 2 May 2010, Dipankar Basu wrote:
Hi All,
I am using R 2.11.0 on a Ubuntu machine. I estimated a model using "tsls"
from the package "sem". Is there a way to get Newey West standard errors for
the parameter estimates?
When estimating the model by OLS, I used "NeweyWest" from the package
Hi All,
I am using R 2.11.0 on a Ubuntu machine. I estimated a model using "tsls"
from the package "sem". Is there a way to get Newey West standard errors for
the parameter estimates?
When estimating the model by OLS, I used "NeweyWest" from the package
"sandwich" to get HAC standard errors. But,
Thank you for your reply. The application is a Monte Carlo simulation
in environmental planning. Different possible remediation measures
have different costs, and produce different results. For example, a
$20,000 plan may add 10 acres of wetlands and 12 acres of bird
habitat. The desire is to
>
>> >as.numeric(assame$Login) //convert to numerics
>>
>
>
> Nooo. You did not do what what I suggested earlier. Do not reach
> for your keyboard in the R console until you have read the FAQ section
> regarding converting factors to numeric. If you don't want to read the FAQ
Hi David,
N
Hi R users,
I would like to add year information to each point in a scatter plot. The
following
example shows what i mean:
df=data.frame(year=c(2001,2002,2003),a=c(8,9,7),b=c(100,90,95))
df
plot(b~a,data=df)
Now, I would like to see which point belongs to 2001, 2002 and 2003 in the
above
graphic
On May 2, 2010, at 1:58 PM, Geoffrey Smith wrote:
Suppose my data looks like this:
Obs, Male, Female, Height
1, T, F, 66
2, F, T, 64
3, T, F, 59
4, T, F,
On May 2, 2010, at 2:10 PM, Mohan L wrote:
I have no way to determining _why_ it is not numeric, but it simply
is ... not. Your input method turned it into a factor. Perhaps there
was one missing delimiter, or there was a stray character in one of
the entries in the file. Who knows. Wh
Thats right. serves me for not checking the code before posting.
but paste should work in anycase with collapse or when x is a single
parameter.
Nikhil
On Sun, May 2, 2010 at 10:24 AM, David Winsemius wrote:
>
> On May 2, 2010, at 10:10 AM, Nikhil Kaza wrote:
>
> say x is the variable.
>>
>> p
Try this:
prop.table(table(subset(x, Height > 60, select = Male:Female)))
On Sun, May 2, 2010 at 2:58 PM, Geoffrey Smith wrote:
> Suppose my data looks like this:
>
> Obs, Male, Female, Height
> 1, T, F, 66
> 2, F, T,
>
> I have no way to determining _why_ it is not numeric, but it simply is ...
> not. Your input method turned it into a factor. Perhaps there was one
> missing delimiter, or there was a stray character in one of the entries in
> the file. Who knows. Why waste time arguing? Follow the directions f
Suppose my data looks like this:
Obs, Male, Female, Height
1, T, F, 66
2, F, T, 64
3, T, F, 59
4, T, F, 55
5, F, T, 62
6,
Greetings and thank you
Am using GSA and have the GSA.listsets object of class list which displays
fine
But how do I get the object written to a text file?
I see to convert to data frame and then write.table but
> GSAwk1df <- data.frame(GSAwk1list, row.names=NULL, check.rows=FALSE,
check.names
Another option could be:
data$z <- as.numeric(gsub("(^\\d{4}).*", "\\1", gsub("^$", "2009",
data$ukrok))) - data$rocnik
On Sun, May 2, 2010 at 8:25 AM, peterko wrote:
>
> Thank you Jim, it works very well. I do not need do it using tapply, but i
> think that it is the way.
>
> And Patrick than
1) I believe you wanted a scree plot which shows the percentage of
variance explained (y-axis) versus the principal components (x-axis). To
do that, all you needs a simple plot(x,y) function where x = pc and y =
variance. It is called a scree plot because the plot looks like a scree
on the side
Presumably, a scree plot?
Philip may find something useful here
http://www.statmethods.net/advstats/factor.html
--- On Sun, 5/2/10, Ista Zahn wrote:
> From: Ista Zahn
> Subject: Re: [R] Scree diagram,
> To: "Philip Wong"
> Cc: r-help@r-project.org
> Received: Sunday, May 2, 2010, 10:51 AM
>
Gustaf Rydevik wrote:
Hi all,
I hope that there is someone that can help me out here.
I am trying to load() a workspace on os x (R 2.11.0) that was saved in
windows XP (R 2.9). In that workspace, there's a data.frame with names
that contain swedish characters. These characters become garbled,
wh
On May 2, 2010, at 11:22 AM, Mohan L wrote:
Your code has a different name for the sample object. And it would
be more informative if you offered str on "sample1".
This is the result of str on "sample1".
> str(sample1)
'data.frame':35943 obs. of 17 variables:
$ stdate : Factor
Hi all,
I hope that there is someone that can help me out here.
I am trying to load() a workspace on os x (R 2.11.0) that was saved in
windows XP (R 2.9). In that workspace, there's a data.frame with names
that contain swedish characters. These characters become garbled,
which is a major problem.
Paul Hurley wrote:
>
> Is there a known problem with odfWeave on Windows? I've seen some
> messages on R-help from a year or two back where people couldn't install
> the XML package, but XML installed fine on my Windows box (it was more
> tricky on Kubuntu, but worked in the end).
>
Ther
>> Your code has a different name for the sample object. And it would be more
>> informative if you offered str on "sample1".
>>
>> This is the result of str on "sample1".
>> > str(sample1)
>> 'data.frame':35943 obs. of 17 variables:
>> $ stdate : Factor w/ 7 levels "01/11/09 00:00",..: 1
On 01.05.2010 21:09, Giovanni Azua wrote:
Hello,
I have three method types and 100 generalization errors for each, all in the
range [0.65,0.81]. I would like to make a stacked histogram plot using ggplot2
with this data ...
Therefore I need a data frame of the form e.g.
Method
Hi Phillip,
I've never heard of a scree _diagram_, I'm not even sure what that is.
To get started with principal components analysis in R, I suggest the
psych package. The package vignettes are quite detailed, I suggest
starting there.
Best,
Ista
On Sun, May 2, 2010 at 12:06 AM, Philip Wong wro
On May 2, 2010, at 7:01 AM, burgundy wrote:
Hi,
I'm trying to replace all values equal to 1 in one file (a) with the
value
in the corresponding column in a separate file (b). Example below.
Any help (and brief notes if poss) much appreciated. Thanks!!
file a:
0,0,1,1,0
1,0,0,0,1
0,0,0,0,0
The following code might work:
a[a==1] <- b[a==1]
But it depends on what a and b are exactly (vector, matrix, list,
data.frame).
Tal
Contact
Details:---
Contact me: tal.gal...@gmail.com | 972-52-7275845
Read me: www.talgalil
On May 2, 2010, at 10:22 AM, Mohan L wrote:
Your code has a different name for the sample object. And it would
be more informative if you offered str on "sample1".
This is the result of str on "sample1".
> str(sample1)
'data.frame':35943 obs. of 17 variables:
$ stdate : Factor
On May 2, 2010, at 10:10 AM, Nikhil Kaza wrote:
say x is the variable.
plot(..., title=paste(x, "whatever else"), ...) should work as well.
same should work with file names as well.
Perhaps in an alternate universe it might, ... but it doesn't in this
one. "title" is not the correct par
>
> Your code has a different name for the sample object. And it would be more
> informative if you offered str on "sample1".
>
This is the result of str on "sample1".
> str(sample1)
'data.frame':35943 obs. of 17 variables:
$ stdate : Factor w/ 7 levels "01/11/09 00:00",..: 1 1 1 1 1 1 1
Hi,
I'm trying to replace all values equal to 1 in one file (a) with the value
in the corresponding column in a separate file (b). Example below.
Any help (and brief notes if poss) much appreciated. Thanks!!
file a:
0,0,1,1,0
1,0,0,0,1
0,0,0,0,0
1,0,1,1,0
file b:
3,4,6,8,11
output request:
0,
Dear R users,
Please let me know how to plot the forecast in such a model:
First I do it simple with ARIMA model that works ok with the codes provided to
me at the lecture:
arima<-arima(HCPIlong, order=c(1,1,0))
arima.predict<-predict(arima, n.ahead= 5 )
ts.plot(HCPIlong,arima.predict$pred,lty=
say x is the variable.
plot(..., title=paste(x, "whatever else"), ...) should work as well.
same should work with file names as well.
Nikhil
On May 1, 2010, at 9:56 PM, R K wrote:
Hello,
I was wondering if someone could tell me how I can make text
dependent on a variable in a R functio
On May 2, 2010, at 9:39 AM, Mohan L wrote:
Hi all,
I have data size of :
dim(sample)
[1] 3594317
Your code has a different name for the sample object. And it would be
more informative if you offered str on "sample1".
--
David.
The first column is "stdate" - is date ( 01/11/200
On May 2, 2010, at 9:32 AM, Shige Song wrote:
Dear All,
I noticed that the "splines" package is no longer available on CRAN.
Has it been replaced by something else? is it still available in some
other locations?
I believe you will discover that splines is part of the standard
install bundl
Hi all,
I have data size of :
> dim(sample)
[1] 3594317
The first column is "stdate" - is date ( 01/11/2009 00:00:00,02/11/2009
00:00:00,02/11/2009 00:00:00 etc... )
Login is 13th column - is numbers (12,0,1 erc...)
The below operation return the following error.
> sample1 <- read.csv(fi
Dear All,
I noticed that the "splines" package is no longer available on CRAN.
Has it been replaced by something else? is it still available in some
other locations?
Thanks.
Shige
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listi
On 02/05/2010 4:07 AM, Jim Lemon wrote:
On 05/02/2010 11:56 AM, R K wrote:
Hello,
I was wondering if someone could tell me how I can make text dependent on a
variable in a R function I have created.
The function will create plots, thus I would like each plot to have a unique
title based o
Thank you Jim, it works very well. I do not need do it using tapply, but i
think that it is the way.
And Patrick thank you too
--
View this message in context:
http://r.789695.n4.nabble.com/help-with-tapply-or-other-apply-tp2122683p2122728.html
Sent from the R help mailing list archive at Nabbl
On 05/02/2010 08:26 PM, peterko wrote:
Hi, my data looks this:
id forma program kod obor
rocnik
1 10001 kombinovaná Matematika M1101 matematika 1
2 10002 prezenční Informatika N1801 teoretická informatika 1
3 10002 pre
You don't show how you are doing it with
a 'for' loop, but I suspect that you just
need to eliminate the subscript you are
using for rows.
For example:
for(i in 1:nrow(data)) {
data$z[i] <- data[i, 'x'] + data[i, 'y']
}
can be written more simply and much more
efficiently as:
data$z <- data
Hello Ista,
On May 1, 2010, at 8:37 PM, Ista Zahn wrote:
> Hi Giovanni,
> A reproducible example would help. Also, since I think this will be
> tricky, it might be a good idea to post it to the ggplot2 mailing list
> (you can register at http://had.co.nz/ggplot2/ ).
>
> Best,
> Ista
First, thank
Hi, my data looks this:
id forma program kod obor
rocnik
1 10001 kombinovaná Matematika M1101 matematika 1
2 10002 prezenční Informatika N1801 teoretická informatika 1
3 10002 prezenční Informatika B180
On 05/02/2010 11:56 AM, R K wrote:
Hello,
I was wondering if someone could tell me how I can make text dependent on a
variable in a R function I have created.
The function will create plots, thus I would like each plot to have a unique
title based on the inputted variable as well as a unique
77 matches
Mail list logo