Hello,
I'm not sure I understand, do you want to treat BCC, CBC and CCB as the
same? If so try
w2 <- apply( y , 1 , function(x) paste0(sort(x) , collapse = "" ))
table(w2)
Hope this helps,
Rui Barradas
Em 26-02-2013 13:58, Niklas Fischer escreveu:
Hi again,
Thanks
Hello,
Try the following.
x <- rnorm(500)^2
split(x, cut(x, quantile(x, probs = seq(0, 1, by = 0.2
Hope this helps,
Rui Barradas
Em 26-02-2013 17:39, Martin Batholdy escreveu:
Hi,
I would like to cut a vector of values in parts.
Each part should have an equal number of elements.
Hello,
This is a statistics question, not an R one.
If you want to fit an ARMA model, your time series can have any values,
zero, negative or positive. Please revise your knowledge of time series.
Hope this helps,
Rui Barradas
Em 28-02-2013 10:40, Nnina escreveu:
Hello,
I would like to
l be selected.
Read An Introduction to R, file R-intro.pdf in the doc directory of your
installation of R, section 2.7 - Index Vectors.
Hope this helps,
Rui Barradas
If I write the code like library(MASS)cats$ratio <-
cats$Hwt/cats$Bwtmale <- cats$ratio[cats$Sex == "M"]... it als
realroots(po.lm, 5.5)
predict(po.lm, newdata = data.frame(b = r)) # confirm
Hope this helps,
Rui Barradas
Em 01-03-2013 18:47, Mike Rennie escreveu:
Hi there,
Does anyone know how I solve for x from a given y in a polynomial
function? Here's some example code:
##example file
a<-1:10
b<-
Thanks.
Rui Barradas
Em 01-03-2013 20:35, arun escreveu:
Hi Rui,
Looks like a bug:
###if(names(model)[1] = "(Intercept)")
Should this be:
if(names(model)[1] == "(Intercept)")
A.K.
- Original Message -
From: Rui Barradas
To: Mike Rennie
Cc: r-help Mailin
coef(model))[1] == "(Intercept)")
r <- polyroot(c(coef(model)[1] - b, coef(model)[-1]))
else
r <- polyroot(c(-b, coef(model)))
Re(r[is.zero(Im(r))])
}
r <- realroots(po.lm, 3)
predict(po.lm, newdata = data.frame(b = r)) # confirm
1 2
Hello,
Try
# for columns a.b it's 1:2, not 1:3
data[data[,4] == 0, 1:3] <- NA # columns a, b and c
Hope this helps,
Rui Barradas
Em 02-03-2013 10:26, Camilo Mora escreveu:
Hi everyone,
Imagine that I have a data frame with four columns:
data<-
a b c d
0
.matrix(dat)
str(dat)
dat[, 1:2] <- sapply(1:2, function(i) ifelse(dat[, i] == 0 & dat[, 4] ==
0, NA, dat[, i]))
Hope this helps,
Rui Barradas
Em 02-03-2013 16:11, arun escreveu:
HI,
Not sure I understand it correctly,
data1<-read.table(text="
a b c d
0
There's a no homework policy in R-help.
Rui Barradas
Em 02-03-2013 18:28, Cedric Sodhi escreveu:
In reference to [1], how would you solve the following regression
problem:
Given observations (X_i,Y_i) with known respective error distributions
(e_X_i,e_Y_i) (say, 0-mean Gaussian with know
Hello,
Like you say, apparently R doesn't have models for error in variables.
But R packages might have.
library(sos)
findFn('errors-in-variables')
Some look promising. Hope you find something.
Rui Barradas
Em 02-03-2013 21:55, Cedric Sodhi escreveu:
Perhaps it would have be
st provide
at least on sample and a CDF. Something like
x <- rnorm(100)
f <- ecdf(rnorm(100))
ks.test(x, f)
Hope this helps,
Rui Barradas
Em 03-03-2013 09:58, Rani Elkon escreveu:
Dear all,
I calculate the test statistic for the KS test outside R, and wish to use R
only to calculate
Hello,
Another document that could help is Friedrich Leisch, Creating R
Packages: A Tutorial, that can be found at
http://cran.r-project.org/doc/contrib/Leisch-CreatingPackages.pdf
Hope this helps,
Rui Barradas
Em 05-03-2013 11:15, Jim Lemon escreveu:
On 03/05/2013 02:42 PM, Jyoti Sharma
China 9
2010Q4 China 14
", header = TRUE)
dat$Time <- as.numeric(sub("Q", "\\.", dat$Time))
p <- ggplot(dat,aes(x=Time,y=Values,colour=Country))
p + geom_line()
Hope this helps,
Rui Barradas
Em 06-03-2013 08:06,
Hello,
Try
x <- scan(text = " 1 1 3 2 3 1 1
2 3 3 2")
sapply(unique(x), function(.x) which(x == .x))
Hope this helps,
Rui Barradas
Em 06-03-2013 11:26, eliza botto escreveu:
Dear useRs,
I have a matrix in the following form
Hello,
Something like this?
sp <- split(test, test$Data)
res <- do.call(rbind, lapply(sp, function(x){
Week <- (seq_len(nrow(x)) %/% 7) + 1
aggregate(Value ~ Data + Week, data = x, FUN = mean)}))
rownames(res) <- seq_len(nrow(res))
res
Hope this helps,
Rui Barrad
(where, length) # count them
Hope this helps,
Rui Barradas
Em 08-03-2013 16:04, Sudip Chatterjee escreveu:
Hi All,
I am wondering if there is any examples where you can count your
interested "word" in each row. For an example if you have data with *'ID*'
and '*w
Hello,
I had thought of something like that, but I'm not sure if the match must
be exact. If not, grep seems better. More complicated and slower but
more flexible.
Rui Barradas
Em 08-03-2013 21:32, arun escreveu:
Hi,
You can also try:
res2<-rowSums(x==word)
res1<-sapply(w
lt;- function(x, y){
s <- as.integer(format(x, "%m")) + y
yx <- as.integer(format(x, "%Y")) + (s %/% 12)
as.Date(paste(yx, s %% 12, "01", sep = "-"))
}
pm <- plusmonths(Date, Vec)
identical(New_Vec, pm) # TRUE
Hope this he
Hello,
The following functions will return an index to the required values, not
the values themselves.
firstzero <- function(x) which(x == 0)[1]
lastone <- function(x){
z <- firstzero(x)
if(z == 1) NULL else z - 1
}
Hope this helps,
Rui Barradas
Em 09-03-2
anges so eat oranges
", sep = ",", header = TRUE, stringsAsFactors = FALSE)
dat
word <- "oranges"
where <- sapply(dat$Data, function(.x) gregexpr(tolower(word), tolower(.x)))
result <- sapply(where, length) # count them
names(result) <- dat$ID
result
Hope t
Hello,
Instead of mfrow use mfcol and the order becomes col by col.
Hope this helps,
Rui Barradas
Em 09-03-2013 20:55, Brian Smith escreveu:
Hi,
I wanted to change the order of how the plots appear in a multiplot
scenario. For example, in the code below:
#
pdf('test.pdf
Hello,
That error occurs if you have Inf values in vekkat. Try to see them with
finite <- is.finite(vekkat)
sum(!finite)
If this is not zero, you can fix your test with
kruskal.test(wis1[finite] ~ vekkat[finite])
Hope this helps,
Rui Barradas
Em 10-03-2013 10:37, Adriana Škrinár
eally important here)
plot(1, type = "n", xlim=c(0, 17), ylim=c(0, 17))
for(x in 1:16) for(y in 1:16)
points(x, y, pch = (x - 1)*16 + y)
They go first column with x = 1, from y = 1 to 16, etc.
Hope this helps,
Rui Barradas
Em 11-03-2013 17:43, eliza botto escreveu:
Dear xpeRts
(PARTIAL) 94.6 at interval beginning 19800329 063532
")
# Simple
data_30min[, c(2, 4, 8)]
# More elaborate, but equivalent
subset(data_30min, select = c("V2", "V4", "V8"))
Hope this helps,
Rui Barradas
Em 12-03-2013 09:03, Roslina Zakaria escreveu:
Dear r-users
try
y <- as.numeric(names(x))
x[y > 1820]
Hope this helps,
Rui Barradas
Em 12-03-2013 17:50, catalin roibu escreveu:
Hello all!
I have a problem to extract values greater that for example 1820.
I try this code: x[x[,1]>1820,]->x1
Please help me!
Thank you!
The data structure is:
stru
Hello,
The following is a bit convoluted but will do it.
dat <- read.table(text = "
a1 b1 1
a2 b2 2
a3 b3 3
a1 b1 4
a3 b1 5
")
xtabs(V3 ~ V1 + V2, data = aggregate(V3 ~ V1 + V2, data = dat, FUN = max))
Hope this helps,
Rui Barradas
Em 12-03-2013 21:45, avinash sahu escreveu:
f <- function(y){
idx <- sample(nrow(y), nrow(y), replace = TRUE)
y[idx, ]
}
res <- do.call(rbind, lapply(split(x, x[, 2]), f))
rownames(res) <- seq_len(nrow(res))
res
}
fun(dat)
Hope this helps,
Rui Barradas
Em 14-
o.call(rbind, lapply(sp, f))
rownames(res) <- seq_len(nrow(res))
res
}
fun(mat)
Hope this helps,
Rui Barradas
Em 14-03-2013 11:34, Rui Barradas escreveu:
Hello,
It doesn't seem very complicated.
First of all, for the function fun below to work, you need the data not
available to the parent.env of
x1(), if x1() succeeds.
Hope this helps,
Rui Barradas
Em 16-03-2013 13:27, Christofer Bogaso escreveu:
Hello again, I was trying to understand how I can assign variables in
some other Environments which is different from that variable's
original Envi
Hello,
The answer to your question is no, you don't have to do anything
special, except, of course, say how many steps ahead you want to predict.
To see this, run the second example in ?predict.Arima. It predicts 6
steps ahead, accounting for the frequency.
Hope this helps,
Rui Barrada
(Y2) - cov(Y1, Y2)^2))
x1 <- rnorm(10)
x2 <- rnorm(10)
fun(x1, x2)
Hope this helps,
Rui Barradas
Em 17-03-2013 15:47, Miguel Eduardo Delgado Burbano escreveu:
hello all
I am writing a quite simple script to study dental wear patterns in humans
and I wrote this function
sqrt(var(Y1)+
e a data example is to use dput():
dput(dat) # paste the output of this in a post.
That's the structure() above.
Hope this helps,
Rui Barradas
Em 17-03-2013 12:50, Larissa Schneider Guilhon escreveu:
I have to make a boxplot with Years 2011 and 2012 on the x axis, and
percentage of full
Hello,
There _is_ a function ?within. Maybe your function can be named 'between'
Rui Barradas
Em 18-03-2013 16:16, S Ellison escreveu:
I want to cont how many
times a number say 12 lies in the interval. Can anyone assist?
Has anyone else ever wished there was a moderately gener
Hello,
Something like this?
plot(1, type = "n")
text(1,1, expression(capacity ~ 10^3 ~ m^3))
Hope this helps,
Rui Barradas
Em 18-03-2013 20:29, Benjamin Gillespie escreveu:
Hi all,
I'm having problems finding the correct format for a command.
I would like to write some
lative eruptions", # y−axis label
xaxt = "n")
lines(breaks, cumfreq0)
axis(1, at = duration)
Hope this helps,
Rui Barradas
Em 19-03-2013 12:34, Shane Carey escreveu:
Hi,
I am trying to create a Cumulative Frequency graph and I am using the
following example:
http://www.r
Hello,
Using a dataset in package datasets,
n <- length(lh)
fit <- arima(lh, order = c(1,0,0))
se <- sqrt(diag(vcov(fit)))
sqrt(n - 1)*coef(fit)/se # T stats
Hope this helps,
Rui Barradas
Em 19-03-2013 20:22, Yuan, Rebecca escreveu:
Hello all,
fit = arima()
and
Summary(fit)
Hello,
Sorry for the error, the sqrt(n - 1) is wrong. Delete it:
t.stat <- coef(fit)/se
Rui Barradas
Em 19-03-2013 21:11, Rui Barradas escreveu:
Hello,
Using a dataset in package datasets,
n <- length(lh)
fit <- arima(lh, order = c(1,0,0))
se <- sqrt(diag(vcov(fit)))
sqrt
Hello,
Try the following.
d0 <- density(myd)
d1 <- density(myd1)
idx0 <- d0$x >= 1 & d0$x <= 4
idx1 <- d1$x >= 1 & d1$x <= 4
yy <- apply(cbind(d0$y[idx0], d1$y[idx1]), 1, min)
xx <- d0$x[idx0]
xx <- c(xx[1], xx, xx[1])
yy <- c(0, yy, 0)
polygon(x
Hello,
In the case of predict.Arima, you can type at an R prompt the following.
stats:::predict.Arima
Hope this helps,
Rui Barradas
Em 20-03-2013 18:43, Yuan, Rebecca escreveu:
Hello all,
I thought I found it, it is in the arima.R if I use arima to fit the model.
But how could we see the
test1<-function(x, d, y){
return(sum(x[d]) - sum(y))
}
b <- boot(red, test1, R=10, y = blue)
b
sum(red) - sum(blue)
Hope this helps,
Rui Barradas
Em 20-03-2013 22:49, paolo brunori escreveu:
Dear all,
a question about the package boot: is it possible to bootstrap a
function of ar
s very clear. What you have is an element of the data.frame
named 'a', that can be accessed like data$a or data[["a"]].
Use the first way of subsetting the data.frame.
Also, 'data' is a bad name for an object, it already is a function name.
Hope this helps,
Rui Bar
Hello,
In fact, it's written there, in ?arima:
"Further, if include.mean is true (the default for an ARMA model), this
formula applies to X - m rather than X."
So, use include.mean = FALSE
Hope this helps,
Rui Barradas
Em 21-03-2013 13:56, Yuan, Rebecca escreveu:
Hello,
to one of your previous posts by Prof.Brian
Ripley. If it's not available in R, there must be a good reason why not.
Rui Barradas
Thanks,
Rebecca
--
This message, and any attachments, is for the intended r...{{d
Hello,
Em 21-03-2013 21:42, Albyn Jones escreveu:
R^n for n > 1 is not an ordered set.
Theorem. All sets are well ordered.
(This theorem is equivalent to the Axiom of Choice.)
Rui Barradas
albyn
On Thu, Mar 21, 2013 at 02:32:44PM -0700, David Winsemius wrote:
On Mar 21, 2013, at 1
se NA, if(y > 0) Vec2 else NA)
}
fn2(-3, -3)
fn2(3, -3)
Hope this helps,
Rui Barradas
Em 22-03-2013 18:43, Christofer Bogaso escreveu:
Hello again,
Let say I have following user defined function:
fn <- function(x, y) {
Vec1 <- letters[1:6]
Vec2 <-
Hello,
Try the following.
idx <- which(subz$fix == "noon")
if(idx[length(idx)] == nrow(subz)) idx <- idx[-length(idx)]
subz$day[idx + 1] <- subz$day[idx]
Hope this helps,
Rui Barradas
Em 22-03-2013 18:18, zuzana zajkova escreveu:
Hi,
I would appreciate if somebody coul
x27;, alpha=0.2)
Hope this helps,
Rui Barradas
Em 22-03-2013 21:01, John Kane escreveu:
Ah , thanks Sarah
So that's why the error message changed! I was getting different one earlier.
I had defined rect earlier and apparently, when stripping down the code I
negelected to include it in t
Hello,
?save can save any R object. To load it back into R, use ?load.
Hope this helps,
Rui Barradas
Em 23-03-2013 10:35, Lorenzo Isella escreveu:
Dear All,
Please consider the snippet at the end of the email
The output of the randomForest model is rf1 (i.e. the trained model).
Now, is there
6], 2) : object 'Result' not found
So there's some debugging to be done.
Anyway, the revised loop should be much faster.
Hope this helps,
Rui Barradas
Em 23-03-2013 11:08, Camilo Mora escreveu:
Hi everyone,
I wonder if I can get your help using a custom function in apply.
Imagi
Hello,
Try this one liner.
g2 <- 50 * prod(exp(-x*a))
identical(g, g2) # TRUE
Hope this helps,
Rui Barradas
Em 23-03-2013 11:27, Andras Farkas escreveu:
Dear All
If you could please help me with a solution on the following:
we have:
a <-matrix(c(1,2,3,4,5))
x <
Hello,
Try the following. It issues a warning because of the second as.numeric.
(It still has the parenthesis.)
ifelse(grepl("\\(", Vec), -as.numeric(sub("\\((.*)\\)", "\\1", Vec)),
as.numeric(Vec))
Hope this helps,
Rui Barradas
Em 23-03-2013 19:51, Chri
i2 <- which(as.character(x$fix) == "midnight")
x$day[i2] <- x$day[i1]
x})
names(tmp) <- NULL
result <- do.call(rbind, tmp)
Hope this helps,
Rui Barradas
Em 25-03-2013 14:15, zuzana zajkova escreveu:
Hi Rui,
thank you for your code, but unfortunately it doe
A
var3[sample(100, 10)] <- NA
mydataset <- data.frame(var1, var2, var3, subject, time)
count_nas <- function(arg1) {
return(sum(is.na(arg1)))
}
aggregate(mydataset[, 1:3], list(mydataset$subject, mydataset$time), FUN
= count_nas)
Hope this helps,
Rui Barradas
Em 25-03-2013 15:
Hello,
Though I have the same doubt as Bert, the following seems to make more
sense.
seq_along(levels(fdata))
Hope this helps,
Rui Barradas
Em 25-03-2013 15:37, Dan Abner escreveu:
Hi everyone,
I understand the process of obtaining the internal integer codes for
the raw values of a
nging the code for barplot().
Hope this helps,
Rui Barradas
Em 26-03-2013 18:09, Francois de Ryckel escreveu:
Dear all,
I have a 2 by 2 matrix and I would like to do a barplot with it. (so 2 bars
with each having 2 stacks.). I would like to have one colors per stack, so 4
different c
Hello,
I forgot to add that if you use argument beside = TRUE, you can have as
many colors as there are bars, but this is not the kind of graph you
want. (This behavior makes a lot of sense if you look at the underlying
code for barplot.)
Rui Barradas
Em 26-03-2013 19:39, Rui Barradas
Hello,
The correct syntax would be
sapply(1:10, function(i) newfun(x=mat[i, 1], y=mat[i, 2], a=a, b=b))
Hope this helps,
Rui Barradas
Em 26-03-2013 21:51, C W escreveu:
Dear list,
I am a little confused as to when to use apply, sapply, tapply, vapply,
replicate. I've encountered
Hello,
The period is a metacharacter so you have to escape it.
The period is escaped with a '\'. In it's turn, '\' is a metacharacter
so it needs to be escaped. Hence the double'\\'.
x <- "LOI ."
gsub("\\.", "(%)", x)
Hope
Hello,
Try
gsub("[$,]", "", "$232,685.35436")
Hope this helps,
Rui Barradas
Em 28-03-2013 15:39, Christofer Bogaso escreveu:
Hello again,
I want to remove "$" sign and replace with nothing in my text.
Therefore I used following code:
gsub("$|
Hello,
You can use
axis(side=2, at=c(10, 30, 50, 70, 90))
or
axis(side=2, at=seq(10, 90, by = 20))
Hope this helps,
Rui Barradas
Em 29-03-2013 09:22, Berg, Tobias van den escreveu:
Thank you Pascal but unfortunelately i still didn't figure out how to change
the numbers presented at
rs in advance
for (i in Time) {
regr <- lm(Price[1:i] ~ Time[1:i])
estim[i] <- coef(regr)[2]
if(is.na(coef(regr)[2]))
error[i] <- NA
else
error[i] <- summary(regr)$coefficients[2,2]
}
Hope this helps,
Rui Barradas
Em 02-04-2013 17
<- lm(example$Price[1:i] ~ example$Time[1:i])
estim[i] <- coef(regr)[2]
if(is.na(coef(regr)[2]))
error[i] <- NA
else
error[i] <- summary(regr)$coefficients[2,2]
}
Hope this helps,
Rui Barradas
Em 03-04-2013 01:57, triskell4-umbre...@yahoo.fr escreveu:
Hello,
Try the following.
h <- hist(rnorm(100), xaxt = "n")
axis(1, at = h$breaks)
Hope this helps,
Rui Barradas
Em 04-04-2013 11:44, Shane Carey escreveu:
Hi,
I would like to places x-axis labels at the edge of bins on a histogram,
i.e. the min value at first bin edge (l
ned by ks.test.
Hope this helps,
Rui Barradas
Em 05-04-2013 15:57, iritgur escreveu:
Hi.
how can i insert the value of p_value from KS.test into vector?
Regards,
Irit.
--
View this message in context:
http://r.789695.n4.nabble.com/retrieveing-value-from-KS-test-tp4663439.html
Sent from the
[-idx[, 1], -idx[, 2]]
}
Hope this helps,
Rui Barradas
Em 06-04-2013 07:55, Abhishek Pratap escreveu:
Hi Guys
I am back with another thing that's puzzling me.
I am creating contingency tables but then I want to filter out certain
columns and also find if any entry in the table
lt;- which(!is.na(x$mth))[1]
x$mth <- x$mth[idx]
x
})
do.call(rbind, tmp)
Hope this helps,
Rui Barradas
Em 06-04-2013 11:33, Leask, Graham escreveu:
Dear List members
I have a
Hello,
Can't you post a data example? If your dataset is named 'dat' use
dput(head(dat, 50)) # paste the output of this in a post
Rui Barradas
Em 06-04-2013 15:34, Leask, Graham escreveu:
Hi Rui,
Thank you for your suggestion which is very much appreciated. Unfortunatel
h <- x$mth[idx]
x
})
Rui Barradas
Em 06-04-2013 18:12, Leask, Graham escreveu:
Hi Arun,
How odd. Directly pasting the code from your email precisely repeats the error.
See below. Any thoughts on the cause of this anomaly?
dput(head(dat,50))
structure(list(dn = c(4, 4, 4, 4, 4, 4,
Hello,
Can't you simply call svm() with scale = FALSE ?
If the variable is constant, it cannot be scaled to unit variance (and
zero mean).
Hope this helps,
Rui Barradas
Em 06-04-2013 17:19, Nicolás Sánchez escreveu:
Hello!
I have this error in R:
In svm.default(x, y, scale =
Hello,
With the attached file, I could reproduce the error but I think the
added line does the trick.
Rui Barradas
Em 06-04-2013 19:20, arun escreveu:
Hi,
dat<- read.csv("test1.csv",sep=",",stringsAsFactors=FALSE)
sp <- split(dat, list(dat$dn, dat$obs))
sp1<-
Hello,
See ?scale
scale(DATA) # mean 0, unit variance
Hope this helps,
Rui Barradas
Em 06-04-2013 21:21, Beatriz González Domínguez escreveu:
Dear all,
I’m finding difficulties to normalize this data. Could you provide some input?
DATA:
c(0.000103113, 0.000102948, 0.000104001
Hello,
What is the output of str(pg)? Is pg a data.frame?
Rui Barradas
Em 07-04-2013 14:14, catalin roibu escreveu:
Dear all!
I have a problem when I use this equation with R.
mpr <- 843.75*exp(-1.119*pg)
Error in FUN(left, right) : non-numeric argument to binary operator
pg
01 02 03
7;s a numeric vector, folds$index$Fold_i[i]
If it's a matrix, folds$index$Fold_i[i, j]
If it's a list, folds$index$Fold_i[[i]]
Hope this helps,
Rui Barradas
Em 07-04-2013 13:24, Nicolás Sánchez escreveu:
Hello!
I have a question. I am working with createFolds:
folds<- trainContr
os. This would allow for placement of the label near the point.
p <- boxplot(dat1$ave, data= dat1, main= "Average Size", yaxt = "n")
text(1, , y = max(dat1$ave), label = dat1$num[which.max(dat1$ave)], cex
= .7, pos = 4)
Hope this helps,
Rui Barradas
Em 09-04-2013 1
Hello,
The answers you had in another thread could lead you to
bp <- boxplot(DATA$ave, data= DATA, main= "Average Size")
idx <- which(DATA$ave %in% bp$out)
text(x= bp$group, y= bp$out, labels= DATA$num[idx], cex = 0.7, pos = 4)
Hope this helps,
Rui Barradas
Em 09-04-201
Hello,
I'm glad it help. You should cc the list, maybe it will be of use to others.
Rui Barradas
Em 09-04-2013 21:00, Beatriz González Domínguez escreveu:
I have solved it, many thanks!
-Original Message- From: Rui Barradas
Sent: Tuesday, April 09, 2013 7:33 PM
To: Beatriz Gon
Hello,
Try
h <- hist(log10(rnorm(0:1000)), xaxt = "n")
axis(1, at = pretty(h$breaks), labels = 10^pretty(h$breaks))
Hope this helps,
Rui Barradas
Em 10-04-2013 14:25, Shane Carey escreveu:
Hi,
If you have the following lets say:
hist(log10(rnorm(0:1000)))
How do you show
plit(test, qq), table)
lapply(split(test, year %/% 10), table)
Hope this helps,
Rui Barradas
Em 09-04-2013 19:45, catalin roibu escreveu:
Hello all!
I have a big problem now. I want a data frame like this:
dput(head(test,100))
structure(c(NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, N
grp <- rep(1:(1 + nrow(dat) / 60), each = 60)[seq_len(nrow(dat))]
do.call(rbind, lapply(split(dat, grp), colMeans))
Hope this helps,
Rui Barradas
Em 10-04-2013 18:46, Ye Lin escreveu:
Hey All,
I have a large dataset and I want to calculate the average of each column
then return a new dataset.
this helps,
Rui Barradas
Em 10-04-2013 19:33, nntx escreveu:
Thank you professor. I think the minimum value of x^2 between -1 and 1 should
be x=0, y=0. but the result is not that. I am thinking is any wrong with my
thought?
Thanks for helping me out!
--
View this message in context:
htt
y the following function
is.zero <- function(x, eps = .Machine$double.eps^0.5) abs(x) < eps
is.zero(your_value) # TRUE?
Or even try ?all.equal
all.equal(your_value, 0)
Hope this helps,
Rui Barradas
Em 10-04-2013 22:13, nntx escreveu:
Rui, thanks for your reply. You meant that it is
Hello,
Just try
?"%*%"
And the hel page title will give you the answer.
Hope this helps,
Rui Barradas
Em 11-04-2013 11:25, Shane Carey escreveu:
What does these operators do: %*%
Thanks
__
R-help@r-project.org mailing
Hello,
Try the following.
dat <- read.table(text = "
ID Value
AL1 1
AL2 2
CA1 3
CA4 4
", header = TRUE, stringsAsFactors = FALSE)
dat$State <- substr(dat$ID, 1, 2)
Note that this dependes on having State being defined by the first two
characters of ID.
Hope this help
Hello,
With the following the order of both rows and columns will be different
than the order of your example output, but the table is basically the same.
xtabs(time ~ people + place, data = Input)
Hope this helps,
Rui Barradas
Em 13-04-2013 22:03, sylvain willart escreveu:
Hello
I have
Hello,
If you run the example in ?bag you can type
data(BloodBrain)
ctreeBag$aggregate
at an R prompt to see an example aggregate function. Note that it dos
_not_ have the parenthesis.
Hope this helps,
Rui Barradas
Em 14-04-2013 11:31, Nicolás Sánchez escreveu:
Good morning all.
I am
[i]][["Rate"]] <- ROC(lst[[i]][["population"]])
}
Hope this helps,
Rui Barradas
Em 14-04-2013 18:19, Sparks, John James escreveu:
Dear R Helpers,
I have a large number of data frames and I need to create a new column
inside each data frame. Because there is a large numb
sim = 48), col = "red")
Hope this helps,
Rui Barradas
Em 15-04-2013 15:13, Stefano Sofia escreveu:
I would like to simulate some SARIMA models, e.g. a SARIMA (1,0,1)(1,0,1)[4]
process.
I installed the package 'forecast', where the function simulate.Arima should do
what I a
210, 210, 505, 1045)
(o <- order(x) )
x[o] # Allright
Hope this helps,
Rui Barradas
Do I have a damaged version of R?
I became still more astonished when I used the sort function and got the
right answer:
sort(c(2465, 2255, 2085, 1545, 1335, 1210, 920, 210, 210, 505, 1045))
[1] 21
function(A, B){
f <- function(X, Y)
!duplicated(rbind(Y, X))[nrow(Y) + 1:nrow(X)]
ix1 <- f(A, B)
ix2 <- f(B, A)
ix1 & ix2
}
ix <- setdiffDF2(Xe, Xf)
Xe[ix,]
Xf[ix,]
Note that this gives no information on the columns.
Hope this helps,
Rui Barradas
Em 16-
Hello,
Try the following.
rep(c("Current_date", as.character(df$dates)), 3)
Hope this helps,
Rui Barradas
Em 17-04-2013 10:11, Katherine Gobin escreveu:
Dear R forum
I have a data.frame
df = data.frame(dates = c("4/15/2013", "4/14/2013", "4/13/2013&quo
Hello,
Try the following.
blocks <- rep(1:(1 + nrow(sim_sub) %/% 5), each = 5)[seq_len(nrow(sim_sub))]
aggregate(sim_sub, list(blocks), FUN = mean)
Hope this helps,
Rui Barradas
Em 17-04-2013 18:04, arun escreveu:
do.call(rbind,lapply(split(sim_sub,((seq_len(nrow(sim_sub))-1)%/%
5
Hello,
Something like this?
grp <- cumsum(abs(c(0, diff(x == 0
tmp <- lapply(split(x, grp), function(x) if(all(x == 0)) NULL else x)
tmp[sapply(tmp, function(x) !is.null(x))]
Hope this helps,
Rui Barradas
Em 18-04-2013 10:33, Igor Mintz escreveu:
hello
i have a very long col
quot;)
x
grp <- cumsum(abs(c(0, diff(x == 0
tmp <- lapply(split(x, grp), function(x) if(all(x == 0)) NULL else x)
tmp[sapply(tmp, function(x) !is.null(x))]
Rui Barradas
Em 18-04-2013 12:24, Rui Barradas escreveu:
Hello,
Something like this?
grp <- cumsum(abs(c(0, diff(x == 0
1996 NANA 7
", header = TRUE)
aggregate(as.matrix(dat[, 3:5]), by = list(dat$year, dat$fid), FUN =
sum, na.rm = TRUE)
Hope this helps,
Rui Barradas
Em 19-04-2013 16:59, shyam basnet escreveu:
Dear R-users,
I have a dataset as like below, and I want to subtot
Hello,
You don't need as.matrix(), the following will do.
aggregate(dat[, 3:5], by = list(dat$year, dat$fid), FUN = sum, na.rm = TRUE)
Rui Barradas
Em 19-04-2013 20:24, Rui Barradas escreveu:
Hello,
Try the following.
dat <- read.table(text = "
fid year rice whe
Hello,
It is possible, but do the other rows have names?
x <- matrix(1:12, 4)
x <- rbind(x, c(13:15))
rownames(x)[5] <- "abcd"
x
Hope this helps,
Rui Barradas
Em 20-04-2013 10:58, Simone Gabbriellini escreveu:
Hello,
I am adding rows to a matrix using rbind() and I wou
xternal.graphics(C_text, xy.coords(x, y, recycle = TRUE),
labels, adj, pos, offset, vfont, cex, col, font, ...)
invisible()
}
Hope this helps,
Rui Barradas
Em 20-04-2013 23:38, Eva Prieto Castro escreveu:
This is what I get when typing text:
text
function (x, ...)
UseMethod("
Hello,
If stock prices are daily data, use frequency = 1.
Hope this helps,
Rui Barradas
Em 21-04-2013 14:22, Lizhu Ren escreveu:
Hi Boss,
i have data of one stock price from 2 January 2006 to 31 December 2012.But each
year had different markert day,
I want to calculate daily returns and
Hello,
You've not Cc'ed the list
If you keep the discussion on the list, you'll have more and better
answers. See the post by Michael Weylandt for a more complete answer to
your question.
Rui Barradas
Em 22-04-2013 12:16, Lizhu Ren escreveu:
> thanks for u replying,
&g
1401 - 1500 of 3010 matches
Mail list logo