Dear all,
I am running the same model on several datasets, each dataset is a different
species. The problem is that for some datasets the model is not converging.
Currently I have an INLA model running for 35 days and still no results. The
process still uses near 100% of the CPU and less than 1
k.bengts...@gmail.com] Namens
Henrik Bengtsson
Verzonden: donderdag 18 juli 2013 12:43
Aan: ONKELINX, Thierry
CC: r-help@r-project.org
Onderwerp: Re: [R] stopping functions with long execution times
See evalWithTimeout() of R.utils, e.g.
tryCatch({
evalWithTimeout({
slowFunction();
}, timeout=7
Try rescaling your data prior to splitting it up into a training and test set.
Otherwise you end up with two different ways of scaling.
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and
Forest
team Biometrie & Kwaliteitszorg / team Biometrics & Quali
Dear John,
Use xlim() and ylim() instead of expand_limits()
library(ggplot2)
#sample data from ggplot2
data(Cars93, package = "MASS")
dataSet <- Cars93
#variables to calculate the range to extend the axis dataVector <-
unlist(dataSet[,"MPG.city"])
dataRange <- diff(range(dataSet$MPG.city))
g
Dear Sibylle,
Have you tried to create a new variable?
ME$fDiversity <- factor(ME$Diversity)
H08_lme <- lme(
log(Height2008_mean) ~ fDiversity,
data = ME,
random = ~ 1|Plot/SubPlot,
weights = varPower(form = ~Diversity),
na.action = na.omit,
subset = ME$Species == "Ace_pse",
method = "ML"
)
summ
Dear Stathis,
I recommend that you try to get some advice from a local statistician or read
an introductory book on statistics. This kind of question is beyond the scope
of a mailing list.
Best regards,
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature
Dear Jannis,
I think you want \link[package]{function} instead of
\link[package:function]{function}
\link[Rssa]{ssa}
Best regards,
Thierry
Van: r-help-boun...@r-project.org [r-help-boun...@r-project.org] namens Jannis
[bt_jan...@yahoo.de]
Verzonden: vr
Dear Robert,
(1|A/B) is shorthand for (1|A) + (1|A:B)
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and
Forest
team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance
Kliniekstraat 25
1070 Anderlecht
Belgium
+ 32 2 525 02 51
+ 32 54 43
Dear Katherine,
Combine both outputs in a list and return that.
return(list(first = output.1, second = output.2))
Best regards,
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and
Forest
team Biometrie & Kwaliteitszorg / team Biometrics & Quality Ass
You've misplaced the comma.
mysample <- df[, sample(ncol(df), 50, replace=FALSE)]
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and
Forest
team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance
Kliniekstraat 25
1070 Anderlecht
Belgium
I think you want the UsingR package
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and
Forest
team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance
Kliniekstraat 25
1070 Anderlecht
Belgium
+ 32 2 525 02 51
+ 32 54 43 61 85
thierry.onkel
You have to escape the underscore
\Sexpr{gsub("_", "\_", print(version$platform))}
Best regards,
Thierry
Van: r-help-boun...@r-project.org [r-help-boun...@r-project.org] namens David
Epstein [david.epst...@warwick.ac.uk]
Verzonden: maandag 2 september 2
Dear Harold,
An easy work-around would be to pass the names of the variables as a character
vector.
fm <- lm.eiv(y ~ x1 + x2, dat, ind = c(2,3), semDep = 0, semMat = c("sem1",
"sem2"))
And the change your lm.eiv.fit accordingly.
Or you could have a look at the .() function of the plyr package
You have two options.
Q[, 117:ncol(Q)]
Or using the negation, thus not selecting the first 116 cols.
Q[, -1:-116]
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and
Forest
team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance
Klini
I think you want %in%
subpool %in% pool
pool %in% subpool
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and
Forest
team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance
Kliniekstraat 25
1070 Anderlecht
Belgium
+ 32 2 525 02 51
+ 32
Have a look at cast() from the reshape package.
library(reshape)
cast(personId ~ law, data = testdata, value = "article", fun = length)
cast(personId ~ law, data = testdata, value = "article", fun = function(x){1 *
(length(x) > 0)})
Van: r-help-boun...@r-
Have a look at bpy.colors()
Best regards,
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and
Forest
team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance
Kliniekstraat 25
1070 Anderlecht
Belgium
+ 32 2 525 02 51
+ 32 54 43 61 85
thierr
Dear Eliza,
You question is not very clear. I think you are looking for the which()
function.
Best regards,
Thierry
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and
Forest
team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance
Klin
Dear Anna,
Is this what you would like?
Summ <- ddply(mydata, .(factor3,factor1), summarize,
mean = mean(var1, na.rm = FALSE),
sdv = sd(var1, na.rm = FALSE),
se = 1.96*(sd(var1, na.rm=FALSE)/sqrt(length(var1
Summ$Grouping
FAQ 7.31
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and
Forest
team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance
Kliniekstraat 25
1070 Anderlecht
Belgium
+ 32 2 525 02 51
+ 32 54 43 61 85
thierry.onkel...@inbo.be
www.inbo.be
To
Dear John,
According to the Rstudio website you need the latest version of Rstudio to work
with R 3.0.0. I had the same problem yesterday (on WinXP). Installing the
latest Rstudio solved it.
Best regards,
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Natu
Have a look at the warning in ?geepack::geeglm It should be mentioned in
?geepack::geese as well.
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and
Forest
team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance
Kliniekstraat 25
1070 And
Dear Eliza,
If you have the coordinates of the stations you can use the nnwhich() function
from the spatstat package.
Best regards,
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and
Forest
team Biometrie & Kwaliteitszorg / team Biometrics & Quality
Have a look at
library(sos)
findFn("twice filter")
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and
Forest
team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance
Kliniekstraat 25
1070 Anderlecht
Belgium
+ 32 2 525 02 51
+ 32 54 43 61
Dear Sylvia,
R-sig-mixed-models is a better list for questions about mixed models.
The summary gives you the standard error for the fixed effects. See the output
in your mail. E.g. AGQ has a standard error of 0.044
Have a look at http://glmm.wikidot.com/faq, it covers some topics on mixed
mode
You first example is a list of 5 items, each item is a number
The second example is a list with one item: a vector with 5 elements.
You'll need c() to make a vector of the item to get the same result.
all.equal(list(c(0.8,0.9,1.0,1.1,1.2)), list(seq(0.8, 1.2, by = 1.1)))
ir. Thierry Onkelinx
Inst
Dear Michael,
You can use geom_smooth directly.
ggplot(pred, aes(x = Age, y = Better)) + geom_smooth(method = "glm", family =
binomial)
Best regards,
Thierry
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and
Forest
team Biometrie & Kwaliteitszorg
Have a look at the knitr package. http://yihui.name/knitr/demo/minimal/
Best regards,
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and
Forest
team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance
Kliniekstraat 25
1070 Anderlecht
Belg
You have no missing data. Note that the string "" is not missing! You need to
code missings as NA. Have look at ?is.na
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and
Forest
team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance
Klin
Dear Craig,
It is better to ask questions about lme4 at r-sig-mixed-models (in cc).
Are you using a recent version of lme4? Try upgrading lme4 and see if you still
get the error.
Best regards,
Thierry
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature
Dear Caroline,
Check the homogeneity of the variances. If they are inhomogeneous, you can add
a variance function to deal with it. However, you will need to switch to the
lme() from the nlme package.
Best regards,
Thierry
PS R-Sig-mixed-models is a better list for this kind of questions.
ir.
Have a look at evalWithTimeout() from the R.utils package
Best regards,
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and
Forest
team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance
Kliniekstraat 25
1070 Anderlecht
Belgium
+ 32 2 525
insdag 13 mei 2014 22:13
Aan: ONKELINX, Thierry; r-packages-ow...@r-project.org; r-help@r-project.org;
r-help-requ...@r-project.org
Onderwerp: Re: [R] stop a function
Hi,
Another problem arised now. I got this error:
Error in match(x, table, nomatch = 0L) : reached CPU time limit
I googled it
Another option is the plyr package.
library(plyr)
result <- dlply(size, ~ Year +Season, function(.sub){
with(.sub, smooth.spline(Size, Prop, spar = 0.25))
}
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and
Forest
team Biometrie & Kwaliteits
Here is my solution.
falses <- which(!x)
first.false <- head(falses, 1)
last.false <- tail(falses, 1)
which(x[first.false:last.false]) + first.false - 1
Best regards,
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and
Forest
team Biometrie & Kwalite
Have a look at the multcomp package. The examples in glht() demonstrate how to
specify the required contrasts.
Best regards,
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and
Forest
team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assuran
R works faster if you can avoid loops the loops. There is an example. Note that
it required global variables (like your function). You better avoid that.
rspat <- function(rhox, rhoy, s2e = 1){
require(matlab)
R <- s2e * eye(N)
i <- rep(seq_len(N), each = N)
j <- rep(seq_len(N), N)
j <-
Dear Adam,
ggsave() works only with single ggplot object. You need the standard R way of
saving those plots.
1) open a suitable device
2) plot the figures
3) close the device
tiff(filename = "Figure 1.tiff", scale = 1, width = 10, height = 5, units =
"cm", dpi = 300)
grid.arrange(plot1, plot2,
Dear Adrienne,
What is the output of summary(casestudy) and summary(gridmeta)?
What happens if you set nmax to 10?
krige(formula=bias~1,locations=~lon+lat,data=casedata,newdata=gridmeta
,model=v.fit, nmax = 10)
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for
Dear all,
I have a list of n matrices which all have the same dimension (r x s). What
would be a fast/elegant way to calculate the element wise average? So result[1,
1] <- mean(c(raw[[1]][1, 1] , raw[[2]][1, 1], raw[[...]][1, 1], raw[[n]][1, 1]))
Here is my attempt.
#create a dummy dataset
n <
ey
-Oorspronkelijk bericht-
Van: Bert Gunter [mailto:gunter.ber...@gene.com]
Verzonden: maandag 5 november 2012 16:13
Aan: D. Rizopoulos
CC: ONKELINX, Thierry; r-help@r-project.org
Onderwerp: Re: [R] averaging a list of matrices element wise
Gents:
Although it is difficult to say what may be
http://scholar.google.be/scholar?q=www.R-project.org&btnG=&hl=nl&as_sdt=0
http://scholar.google.be/scholar?q=%22R+Core+Team%22&btnG=&hl=nl&as_sdt=0
http://scholar.google.be/scholar?q=%22R+Foundation+for+Statistical+Computing%22&btnG=&hl=nl&as_sdt=0
ir. Thierry Onkelinx
Instituut voor natuur- en
Dear Yulia,
When you have an interaction between a continuous and a categorical variable,
then the multiple comparison on the categorical variabel makes only sense
conditional that the continuous variable is zero. Hence the warning.
Best regards,
Thierry
ir. Thierry Onkelinx
Instituut voor na
I would rather use facet_wrap() instead of multiplot()
Just combine all your data in one data.frame and make sure that you have a
variable indication the iteration.
library(reshape2)
volcano3d <- melt(volcano)
names(volcano3d) = c("x", "y", "z")
volcano3d <- merge(volcano3d, data.frame(Iteration
Van: Loukia Spineli [mailto:spinelilouki...@gmail.com]
Verzonden: vrijdag 9 november 2012 12:06
Aan: Jose Iparraguirre
CC: ONKELINX, Thierry; r-help@r-project.org help
Onderwerp: Re: [R] A panel of contour plots through a iteration process
Hm, the problem is a little bit more complicated than I thought. L
You can use combn(100, 2) to generate the combinations of the plots.
It is not clear to me what you want to do with the diameters. You have 4
diameter for plot 1 and 2 for plot 2. What should the output look like?
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute f
Please be more specific about what you want. Give an example of the required
output. And keep the mailing list in cc when replying.
Van: catalin roibu [catalinro...@gmail.com]
Verzonden: woensdag 14 november 2012 17:54
Aan: ONKELINX, Thierry
Onderwerp: Re: [R
Dear all,
I'm trying to connect to an MSAccess database (ArcGIS personal geodatabase). I
keep getting an error about the channel when using sqlQuery(). However,
sqlTables() does not complain about the channel and lists all tables in the
database. If I try sqlFetch(), then R crashes.
I'm happy
Dear all,
Thanks to Marc and Bart for looking in to this. It turns out to be due to a
typo of me: I misspelled channel.
Best regards,
Thierry
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and
Forest
team Biometrie & Kwaliteitszorg / team Biometric
Dear Chad,
Did you post your entire dataset? If so:
1) your model is too complex for the amount of data you have. See the quotes
below...
2) There is complete separation, leading to large parameter estimates and fits
very close to 0 and 1 (in terms of probabilities)
3) You fit temperature as a
Dear all,
I'm having troubles migrating a large matrix from one system to another.
#system 1: Ubuntu 12.04, 64-bit, running R 2.15.2
# do some simulations
# save the simulations
> save(Output, file = "Simulations.Rdata")
#Output is a numeric matrix with 6 columns and about 2M rows.
Use ftp to tr
Dear Michael,
Calculate the propotions. Then it is easy to use the weight option of glm
data("SpaceShuttle", package="vcd")
SpaceShuttle$trials <- 6
fm <- glm(cbind(nFailures, 6 - nFailures) ~ Temperature, data = SpaceShuttle,
family = binomial)
fm2 <- glm(nFailures/trials ~ Temperature, data =
,
Thierry
Van: Michael Friendly [frien...@yorku.ca]
Verzonden: dinsdag 17 december 2013 19:42
Aan: ONKELINX, Thierry; R-help
Onderwerp: Re: [R] ggplot2: stat_smooth for family=binomial with cbind(Y,
N) formula
Thanks very much for this helpful reply, Thierry
Using aes(wei
You want
y <- ifelse(x == 'a', 1, 2)
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and
Forest
team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance
Kliniekstraat 25
1070 Anderlecht
Belgium
+ 32 2 525 02 51
+ 32 54 43 61 85
thierry.onk
Dear Kristi,
You could do something like this.
ggplot(dat1, aes(x = factor(site), y = Present)) +
geom_boxplot(aes(colour = layer)) +
geom_line(data = dat2, aes(group = 1, y = present)) +
geom_point(data = dat2, aes(y = present))
Note that
- ggplot provides no second axis
- the boxplots di
Dear Dan,
Have a look at ggplot2. It allows to define themes. I've create two theme for
our institution: one according our internal styling guide, one according to the
styling guide for Elsevier journal. Applying the Elsevier theme to all plots in
a script requires just adding theme_set(theme_e
Both are functions (not packages) and available in the stats package.
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and
Forest
team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance
Kliniekstraat 25
1070 Anderlecht
Belgium
+ 32 2 525 02
Dear Michael.
The normality of _covariates_ is seldom relevant. The relevance of normality of
the _response variable_ depends on the model assumptions. In case of linear
models the only the **residuals** (and not the responses) are assumed to be
normally
distributed.
Transformation of response
Dear Violette,
Search for elliptical Fourier analysis. RSiteSearch("elliptical fourier
analysis")
Best regards,
Thierry
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and
Forest
team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance
Dear all,
Consider the simpel RMarkdown file below. I've saved it as test.md with UTF-8
encoding. Notice that I have embedded a custom pandoc variable 'test' in the
file. This variable holds an UTF-8 character ©.
%My title
%The authorslist
# First section
fgsdfg jsdksdfgsdfg
Now I try to com
This is workaround by defining the 'global variables' as NULL. Use it with
caution.
### Fooling R CMD check
transition_group_id <- NULL
### Fooling R CMD check
setkey(aligtable,transition_group_id,align_origfilename)
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institu
You'll need to add quotes
MyAnova$"Pr(>F)"
Or use the bracket notation
MyAnova[, "Pr(>F)"]
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and
Forest
team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance
Kliniekstraat 25
1070 Anderl
You don't need a loop nor a growing object.
data(mtcars)
mtcars
mtcars[seq(1, nrow(mtcars), by = 2), ]
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and
Forest
team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance
Kliniekstraat 25
107
Dear Catalin,
Have a look at the plyr package.
library(plyr)
dlply(
eg,
.(Exp),
function(x) {
aov(masa.uscat.tr~Clona,data=x)
}
)
Best regards,
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and
Forest
Have you tried dput(your.matrix)?
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and
Forest
team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance
Kliniekstraat 25
1070 Anderlecht
Belgium
+ 32 2 525 02 51
+ 32 54 43 61 85
thierry.onkel..
Dear Benedetta,
I think you might want (1+T+Z|subject) as random effects rather than
(1+T|subject) + (1 + Z|subject). The latter has two random intercepts per
subject: a recipe for disaster.
Follow-up posts should only go to the mixed models mailing list which I'm
cc'ing.
Best regards,
ir.
Dear Line,
Have at look at ?scale_colour_manual()
HTH,
Thierry
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek
team Biometrie & Kwaliteitszorg
Gaverstraat 4
9500 Geraardsbergen
Belgium
Research Institute
Or you could use ggplot2
library(ggplot2)
Dataset <- read.csv("file.csv", header=TRUE)
ggplot(Dataset, aes(x = YEAR, y = CASES, colour = AREA)) + geom_line()
HTH,
Thierry
ir. Thierry Onkelinx
Instituut voor natuur- e
Dear Rafael,
The line below had one closing bracket to much. The line below should
work.
am2 <- lmer(dv ~ myfactor + (1|subject), data = mydata)
Furthermore I would advise to change myfactor for a character variable
to a factor.
HTH,
Thierry
--
Have a look at ?cumsum. Apply that on a true/false vector (p-value >
0.05)
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek
team Biometrie & Kwaliteitszorg
Gaverstraat 4
9500 Geraardsbergen
Belgium
Research I
You could have a look at the ggplot2 package to make such plots. The code for
the plots is more readable than with base plots.
a = c(1:10) # create a vector of integers
b = rep(c("a","b"),5) # create a vector of chars, used
# as factor-levels
d = rnorm(10) # some ran
Have a look at the ggplot2 package
install.packages("ggplot2")
library(ggplot2)
ggplot(data, aes(x = sex, y = income, fill = occupation)) +
geom_bar(position = "dodge")
Have a look at http://had.co.nz/ggplot2/ for more information and
examples.
HTH,
Thierry
--
Dear Alison,
Creating a dataset in long format instead of wide format makes things
much easier with ggplot2. You also need a variable with Year. Rownames
will not do.
rwl <- matrix(rnorm(800, 1, sd =0.5), nrow = 100)
colnames(rwl) <- paste('V', 1:8, sep = '')
rwl <- as.data.frame(rwl)
rwl$Year <-
The calculation of semivraiogram is allready implemented is many R
packages. So why do it yourself?
library("sos")
findFn("variogram")
Gives you 190 hits!
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek
tea
Dear Tony,
A mixed models is not a good idea if you have only two levels for sites and two
times two for phase.
The first problem is a mathematical problems. You are estimating variances
based on only two and four values. Which is very small, hence you will not get
reliable estimates of the va
If you want to change the fill colours, then you need to specify fill
instead of colour
ggplot(ageincgraph, aes(x = age, y = rate, fill = era)) +
geom_bar(position = "dodge", stat = "identity") +
scale_fill_manual(values=c("red","orange","yellow"))
--
Textures are currently not possible in ggplot2. Because grid does not
support them.
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek
team Biometrie & Kwaliteitszorg
Gaverstraat 4
9500 Geraardsbergen
Belgium
R
Have a look at ?axis
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek
team Biometrie & Kwaliteitszorg
Gaverstraat 4
9500 Geraardsbergen
Belgium
Research Institute for Nature and Forest
team Biometrics & Quali
Removing elements from a factor does not change the levels of the
factor.
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek
team Biometrie & Kwaliteitszorg
Gaverstraat 4
9500 Geraardsbergen
Belgium
Research In
Dear Jacob,
Do you want something like this? Using dummy data instead of yours.
Copy-paste the output of dput() if you want to pass your data in a
format that is easy to use.
library(ggplot2)
dataset <- expand.grid(X = -3:3, Depth = seq(0, -1, by = -0.25))
dataset$Resistivity <- rnorm(nrow(datase
Another option for doing opertions by grouping variables is to the the
plyr package.
d <- data.frame(x=1:10,
g1=LETTERS[rep(11:12,each=5)],
g2=letters[rep(21:23,c(3,3,4))]
)
library(plyr)
ddply(d, c("g1", "g2"), function(z){
z$x <- z$x / max(z$x)
z
Dear Patrick,
You can fit such a model with the MCMCglmm package. Have a look at the vignette
of that package.
install.packages("MCMCglmm")
vignette("CourseNotes", package = "MCMCglmm")
But I'm affraid that this will require some rockclimbing upon the learning
curve if you are a R novice.
HTH
Dear Felipe,
In the past I have done something similar. I had Access to run an R script in
batch mode. The script reads data from Access, processes the data and puts data
back in Access tables.
The user hit a button in Access and see a blank console window popping up. When
the console window d
Dear Dimitri,
Ggplot2 solves your problem with the gridlines and requires much less
code. You only need to reshape your data somewhat.
library(ggplot2)
#changing the dataset
my.data2 <- my.data
my.data2$x <- my.data$x + my.data$a
my.data2$z <- my.data$y + my.data$z
Molten2 <- melt(my.data2, id.va
t a reasonable answer can be extracted from a given body of data.
~ John Tukey
> -Oorspronkelijk bericht-
> Van: Dimitri Liakhovitski [mailto:dimitri.liakhovit...@gmail.com]
> Verzonden: dinsdag 5 oktober 2010 17:49
> Aan: ONKELINX, Thierry
> CC: r-help@r-project.org
>
Have a look at table
table(na.omit(dta)$grp)
Untested!
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek
team Biometrie & Kwaliteitszorg
Gaverstraat 4
9500 Geraardsbergen
Belgium
Research Institute for Natur
Dear Bert,
Use the plyr package to do the magic
library(plyr)
dataset <- data.frame(COL1 = c("A", "B"), COL2 = 40462, COL3 = c(40482,
40478))
tmp <- ddply(dataset, "COL1", function(x){
delta <- with(x, 1 + COL3 - COL2)
rows <- rep(1, delta %/% 7)
if(delta %% 7 > 0){
This should be easy with apply()
do.call(rbind, apply(dataset, 1, function(x){
list(data.frame(startend = x[1]:x[2], value = x[3])
}))
Untested!
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek
team
The problem is not in the covariates but in the respons variable. lm()
can only handle numerical variables. Deny is a factor, hence you get an
error.
HTH,
Thierry
ir. Thierry Onkelinx
Instituut voor natuur- en bosonder
Dear Vittorio,
Notice that anova(regress) gives a warning: ANOVA F-tests on an
essentially perfect fit are unreliable
Maybe summary(regress) should give a similar warning in case of a
perfect fit. Allthough you should notice that the residual standard
error displayed by summary() is extremly smal
Have a look at qf() and pf()
HTH,
Thierry
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek
team Biometrie & Kwaliteitszorg
Gaverstraat 4
9500 Geraardsbergen
Belgium
Research Institute for Nature and Forest
The easiest way it to create one long dataset with four variables:
Month, avg, stdev and type. Type will be either K, C or S.
Then you just need to add some facetting to your code
ggplot(data = dat, aes(x = Month, y = avg, ymin = avg - stdev, ymax =
avg + stdev)) +
geom_point() +
geom_line()
Split.screen() and par() don't work with ggplot2
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek
team Biometrie & Kwaliteitszorg
Gaverstraat 4
9500 Geraardsbergen
Belgium
Research Institute for Nature and Fo
Have a look at the ggplot2 website. It has a lot of examples
http://had.co.nz/ggplot2/ look at the bottom of this page for
facet_grid() and facet_wrap()
http://had.co.nz/ggplot2/facet_wrap.html direct link to facet_wrap()
--
> install.packages("fortunes")
> library(fortunes)
> fortune("yoda")
Evelyn Hall: I would like to know how (if) I can extract some of the
information from the summary of my nlme.
Simon Blomberg: This is R. There is no if. Only how.
-- Evelyn Hall and Simon 'Yoda' Blomberg
R-help (April 20
Have a look at nncross() from the spatstat package.
Best regards,
Thierry
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek
team Biometrie & Kwaliteitszorg
Gaverstraat 4
9500 Geraardsbergen
Belgium
Research
Dear Nameless,
The quasi distribution can no longer be used in lme4 because a) the
results were not very reliable b) there is an alternative to model
overdispersion.
The alternative is to expand your dataset to bernoulli trials. Then add
a random effect with one level per observation. This random
merge(t1,t2, by="a", all.x = TRUE)
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek
team Biometrie & Kwaliteitszorg
Gaverstraat 4
9500 Geraardsbergen
Belgium
Research Institute for Nature and Forest
team Biom
Dear Sandy,
Have a look at the position argument of geom_histogram.
ggplot(data=dafr, aes(x = d1, fill=d2)) + geom_histogram(binwidth = 1,
position = position_dodge())
ggplot(data=dafr, aes(x = d1, fill=d2)) + geom_histogram(binwidth = 1,
position = position_dodge(width = 0.5), alpha = 0.5)
Best
Dear Eduardo,
This a solution that you seem to want
n <- 1:10
x <- sqrt(n)
y <- log(n)
qplot(n, x, geom="line", colour="darkgreen") + geom_line(data =
data.frame(n , x = y), colour="red")
But please compare it with the solution (code + result) below.
Formatting the data.frame might be a bit more
201 - 300 of 618 matches
Mail list logo