Hello,
You must run the line defining function countTrait first in order to
create it. Then run the rest.
Rui Barradas
Em 25-09-2012 13:42, Benjamin Gillespie escreveu:
Hi Rui, thanks, but I get this:
result <- apply(presence, 2, function(x) apply(dat2[, -1]*x, 2, countTrait))
Error
Hello,
Or ?tapply.
ave will return a vector with the length of the input, tapply just one
value per group.
ave(test$Score, test$Name, FUN = mean) # 24 values
tapply(test$Score, test$Name, FUN = mean) # 3 values
Hope this helps,
Rui Barradas
Em 25-09-2012 15:54, Bert Gunter escreveu
fails. Or
subsets of them.
Hope this helps,
Rui Barradas
Em 25-09-2012 15:29, Dimitris r escreveu:
hi,
steps taken :
files<-lapply(list.files(),read.csv,header=T)
numberOfFiles<-length(list.files())
good<-lapply(files,complete.cases)
cleanDataSets<-list()
for (i in 1:numberOfFiles)
lapply(fls, read.csv, header=T)
good <- lapply(files, complete.cases)
cleanDataSets <- lapply(seq_along(fls), function(i) files[[i]][
good[[i]], ])
Hope this helps,
Rui Barradas
Em 25-09-2012 15:29, Dimitris r escreveu:
hi,
steps taken :
files<-lapply(list.files(),read.csv,hea
Hello,
Maybe the code below answers to both your questions (Q1 and Q2)
cnames <- colnames(dat)
cnames <- sub("WHIRR\\.", "WHIRR_", cnames)
for(which_col in seq_len(ncol(dat)))
{
subset_data <- dat[which_col:ncol(dat)] # change 1, Q2
file_name <- sprintf('%s.csv', cnames[which_col]
Price", cnames)]
resp <- cnames[1]
regr <- cnames[7:8]
#lm.list <- vector("list", 5)
for(i in 1:5){
regress <- paste(price[i], paste(regr, collapse = "+"), sep = "+")
fmla <- paste(resp, regress, sep = "~")
print(fmla)
ot;,
"25.09.2012 10:00"), Hunger=c("1","5","2","2"), Temp=c("25","30","27","28")
)
str(myframe)
myframe$Hunger <- as.numeric(levels(myframe$Hunger)[myframe$Hunger])
myframe$Temp <- as.numeric(levels(myframe
,17,19)
DF$Station <- ifelse(DF$number %in% v1, "V1",
ifelse(DF$number %in% v2, "V2", "V3"))
Hope this helps,
Rui Barradas
Em 26-09-2012 11:49, jeff6868 escreveu:
Hi everyone,
I have a small problem in my R-code.
Imagine this DF for example:
DF &
tch.fun(method)
scl(x, ...)
}
Scale3(ex, method=median, na.rm=TRUE) # Error
Scale3(ex, method="median", na.rm=TRUE) # Right
Scale3(ex, method="var", na.rm=TRUE) # Other type of error
Hope this helps,
Rui Barradas
Em 26-09-2012 16:56, K. Brand escreveu:
Esteemed R UseRs,
Sorry, but in my previous post I've confused the columns. It's by
REQ.NR, not by date
REQ.NR <- 1:4
REQ.NR <- c(REQ.NR, sample(REQ.NR, 2))
dat <- data.frame(date = Sys.Date() + 1:6, REQ.NR = REQ.NR, value =
rnorm(6))
aggregate(dat, by = list(dat$REQ.NR), FUN = tail, 1)
Ru
Hello,
If I understand it correctly, something like this will get you what you
want.
d <- Sys.Date() + 1:4
d2 <- sample(d, 2)
dat <- data.frame(id = 1:6, date = c(d, d2), value = rnorm(6))
aggregate(dat, by = list(dat$date), FUN = tail, 1)
Hope this helps,
Rui Barradas
Em 26-09-2
Hello,
Try the following.
sapply(seq_len(nrow(dat) - 4), function(i){
w <- window(dat$value, start = i, end = i + 4)
mean(w[w < 0])})
Hope this helps,
Rui Barradas
Em 26-09-2012 16:38, Eko andryanto Prakasa escreveu:
haiii
i want to know, is there any script in R to m
nge, ylim = c(0, ymax))
par(op)
Hope this helps,
Rui Barradas
Em 27-09-2012 01:53, Meredith Ballard LaBeau escreveu:
Good Evening-
I have a set of nine scenarios I want to plot to see how the distribution
is changing, if one tail is getting larger in certain scenario, currently I
am
Hello, again.
I forgot, but the subject line also says "same axes", not just same axes
scale.
If you want all densities on the same graph, use ?matplot (matrix plot).
Rui Barradas
Em 27-09-2012 02:08, Rui Barradas escreveu:
Hello,
Something like this?
sag <- matrix(rnorm(1e3 *
better choice.
Hope this helps,
Rui Barradas
Em 26-09-2012 22:11, RCar escreveu:
All,
Relatively new R user so this is probably an easy question to answer.
I am able to generate a cluster for my dataset using hclust() then ploting
the data with plot().
This results in an image with a dendrogram
Hello,
Just to add that you can also
lapply(lm.list, coef)
with a different output.
Rui Barradas
Em 27-09-2012 09:24, David Winsemius escreveu:
On Sep 26, 2012, at 10:31 PM, Krunal Nanavati wrote:
Dear Rui,
Thanks for your time.
I have a question though, when I run the 5 regression
As as column 'str' values.
So the hack is to fake we want three coluns and then set the first one
to NULL.
df2 <- data.frame(df1, colsplit(df1$x, pattern = pat, names=c("Null",
"str","name")))
df2$Null <- NULL
df2
I don't like it very much b
uot;Volume"
trendseason <- "Trend+Seasonality" # do this only once
lm.list2 <- list()
for(i in seq_along(pricemedia)){
regr <- paste(pricemedia[i], trendseason, sep = "+")
fmla <- paste(response, regr, sep = "~")
lm.list2[[i]] <- lm
Hello,
That way of refering to variables can be troublesome. Try
PairIDs[, "Pairiddups"]
Hope this helps,
Rui Barradas
Em 27-09-2012 20:46, GradStudentDD escreveu:
Hi,
I have a data set of observations by either one person or a pair of people.
I want to only keep the pair ob
PairIDs[ which(PairIDs[, "Pairiddups"] == TRUE), ]
Hope this helps,
Rui Barradas
Em 27-09-2012 20:46, GradStudentDD escreveu:
Hi,
I have a data set of observations by either one person or a pair of people.
I want to only keep the pair observations, and was using the code below
until it
g message:
In writeChar(character(1), fl, nchars = 1, useBytes = TRUE) :
writeChar: more characters requested than are in the string - will
zero-pad
> close(fl)
File "Test.txt" is now 1Kb in size.
Hope this helps,
Rui Barradas
Em 27-09-2012 20:17, Jonathan Greenberg escreveu:
> Folks
Hello,
To access list elements you need `[[`, like this:
summ.list[[2]]$coefficients
Or Use the extractor function,
coef(summ.list[[2]])
Rui Barradas
Em 28-09-2012 07:23, Krunal Nanavati escreveu:
Hi Rui,
Excellent!! This is what I was looking for. Thanks for the help.
So, now I have
ative, exact =
exact)$p.value
#options(warn = w)
p
}
n <- 1e1
dat <- data.frame(X=rnorm(n), Y=runif(n), Z=rchisq(n, df=3))
apply(dat, 2, function(x) apply(dat, 2, function(y) f(x, y)))
Hope this helps,
Rui Barradas
Em 28-09-2012 11:10, Johannes Radinger escreveu:
Hi,
I have
Hello,
Try
names(lm.list2[[2]]$coefficient[2] )
Rui Barradas
Em 28-09-2012 11:29, Krunal Nanavati escreveu:
Ok...this solves a part of my problem
When I type " lm.list2[2] " ...I get the following output
[[1]]
Call:
lm(formula = as.formula(fmla), data = tryout2)
Coefficients:
Ok, if I'm understanding it well, you want the mean value of Price1, ,
Price5? I don't know if it makes any sense, the coefficients already are
mean values, but see if this is it.
price.coef <- sapply(lm.list, function(x) coef(x)[2])
mean(price.coef)
Rui Barradas
Em 28-09-2012
RIC=C
[3] LC_TIME=pt_PT.UTF-8LC_COLLATE=pt_PT.UTF-8
[5] LC_MONETARY=pt_PT.UTF-8LC_MESSAGES=pt_PT.UTF-8
[7] LC_PAPER=C LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=pt_PT.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graph
Hello,
Try the following.
idx <- duplicated(df) | duplicated(df, fromLast = TRUE)
df[idx, ]
Note that they are returned in their original order in the df.
Hope this helps,
Rui Barradas
Em 28-09-2012 21:11, Adam Gabbert escreveu:
I would like to select a all the duplicate rows of a d
lot(x, col ="blue", notch = TRUE) # Can also be 'boxfill'
boxp(x, col ="blue", notch = TRUE) # Must be 'boxfill'
boxp(x, boxfill ="blue", notch = TRUE)
Hope this helps,
Rui Barradas
Em 29-09-2012 18:46, David Winsemius escreveu:
On Sep 29, 2012
"ind1", timevar = "ind2",
direction = "wide")
Hope this helps,
Rui Barradas
Em 01-10-2012 17:17, AHJ escreveu:
Hi,
I have a table of pairs of individuals and a coefficient that belongs to the
pair:
ind1ind2coef
1 1 1
1 2 0.25
1
file R-intro.pdf in the doc
directory of your R installation, Chapter 8. All computer languages have
some learning time and as far as statistics is concerned, learning R pays.
Hope this helps,
Rui Barradas
Em 01-10-2012 16:28, jas4710 escreveu:
> Thanks Jeff
> The documentation pages, if
Hello,
Or maybe %in%.
x <- Sys.Date() + 1:10
y <- Sys.Date() + 7:15
x %in% y # logical index into 'x'
x[x %in% y] # common
x[!x %in% y] # not common
setdiff(x, y) # doesn't keep class Date
Hope this helps,
Rui Barradas
Em 01-10-2012 15:57, R. Michael Weylandt escreveu
Hello,
Try the following.
fun <- function(x){
a <- min(x)
b <- max(x)
(x - a)/(b - a)
}
mat <- matrix(rnorm(12), ncol=3)
apply(mat, 2, fun)
Hope this helps,
Rui Barradas
Em 02-10-2012 10:51, Rui Esteves escreveu:
Hello,
I have a matrix with values, with columns c1
utput of this in a post
Hope this helps,
Rui Barradas
Em 02-10-2012 05:50, Leung Chen escreveu:
How to run pie chart for each categorical variable in a dataset?
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do
h(1:(y[i]+1))
l <- 1 # <--- To here
for(j in 1:(Nx[i])){
for(k in 1:(Ny[i])){
Hope this helps,
Rui Barradas
Em 02-10-2012 15:20, Loukia Spineli escreveu:
I want to make a multi-dimensional array. To be specific I want to make the
following array
results<-arra
lt;-1
x1 <- x[1]
x2 <- x[2]
x3 <- x[3]
x4 <- x[4]
z1 <- exp(x1+x2*dose)
z2 <- exp(x3+x4*dose)
psi0<-1/((1+z1)*(1+z2))
psi1<-z1*psi0
v <- (psi0^y0)*(psi1^y1)*((1-psi0-psi1)^y2)
return( prod(v) )
}
lf2.c <- cmpfun(lf2)
Hope this helps,
Hello,
Em 02-10-2012 19:18, Berend Hasselman escreveu:
On 02-10-2012, at 20:01, Rui Barradas wrote:
Hello,
Yes, it's possible to remove the loop. Since the loop is used to compute a
running product and all we want is the final result, use the vectorized
behavior of R and a final
27;ll see what can be done.
Hope this helps,
Rui Barradas
Em 03-10-2012 00:33, Sam Asin escreveu:
Hello,
Sorry if this process is too simple for this list. I know I can do it, but
I always read online about how when using R one should always try to avoid
loops and use vectors. I am wonderi
>75"))
aggregate(Area ~ Range, data = dat1, FUN = sum)
# Range Area
#1 <=0 2043
#2 0-25 3535
#3 50-75 67
#4 >75 4321
Hope this helps,
Rui Barradas
Em 03-10-2012 01:43, arun escreveu:
Hi,
I guess this is what you wanted:
dat1<-read.table(text="
Area Percent
456 0
3400
t;- c((0:x[i])[j], (0:y[i])[k],-(0:x[i])[j], -(0:y[i])[k])
results[[i]][,, l] <- mat.stat[,,i] + matrix(tmp, nrow=2,
ncol=2,byrow=T)
l <- l + 1
}
}
}
results
I think this is it. Let us now if not.
Rui Barradas
Em 03-10-2012 08:48, Loukia Spineli escreveu
Hello,
Homework? We don't do homework. Why do you want the ks test and not,
say, a chi-squared test? Tips: 1)ks is for contiuous data and 2) who
told you this comes from a poisson population if it doesn't really seem so?
Hope this helps,
Rui Barradas
Em 03-10-2012 05:30, yang j
Hello,
Try
Fnum <- function(x, beta){
sapply(x, function(x) integrate(f,lower=-x,upper=0,beta=beta)$value)
}
And all results were the same.
Hope this helps,
Rui Barradas
Em 03-10-2012 21:59, Gerrit Draisma escreveu:
Dear R-users,
I want to use the function Fnum below
in anot
ample rows, try sampling row numbers:
row_ostrya <- sample(nrow(ostrya),200, replace=F)
Hope this helps,
Rui Barradas
Em 04-10-2012 11:06, Gian Maria Niccolò Benucci escreveu:
> Hi again to everybody,
>
> I incountered the following error when I try to make a sample inside a
&
t.test
gives a confidence interval for the difference in the means, so maybe
you'll have to look there for what you want.
Hope this helps,
Rui Barradas
Em 04-10-2012 10:34, Nico Met escreveu:
Dear Group,
I want to do a t-test calculation on a large data set.
I am pasting some part of it
<- c(20, 2) # 2-dim points
dist(matrix(c(x, y), ncol=2))
mydist(x, y)
Also, it's better to post data using ?dput().
Hope this helps,
Rui Barradas
Em 04-10-2012 09:07, nadiah escreveu:
Hi, can anyone help me in this problem :(. I am a total beginner in R
software. It took me 2 day
Hello,
Without sample data it's difficult to give an answer but see ?cut.
To give a data example, the best way is to use ?dput().
dput( head(mydata, 30) ) # Paste the output of this in a post
Hope this helps,
Rui Barradas
Em 04-10-2012 08:27, Jhope escreveu:
Hi R listers,
I am tryi
))
filled.contour(cos(r^2)^2, frame.plot = FALSE,
plot.axes = {}, col = mypal)
grid()
Hope this helps,
Rui Barradas
Em 04-10-2012 13:25, Loukia Spineli escreveu:
> Dear R users,
>
> I have a 51 by 51 matrix of p-values (named as pvalue_MA). I want to
> present graphically this matrix
-1
8 -1-1
9 -1-1
10 -1-1
", header=TRUE)
idx <- dat$Cola != dat$Colb
split(dat, 2*cumsum(idx) - idx)
Hope this helps,
Rui Barradas
Em 04-10-2012 15:20, Ian Arvin escreveu:
Hi,
I am making my way down the lea
uot;Landeck", by.y = "Date")
str(dat3)
head(dat3, 20) # See first 20 rows
Hope this helps,
Rui Barradas
Em 04-10-2012 12:18, lucy88 escreveu:
Hello,
I have two different files which I'd like to combine to make one data frame
but I've no idea how to do it! The first file ha
Hello,
You're thinking of ?aov. anova() does _not_ have a formula interface, it
would be
anova(lm(HSuccess ~ Veg, data = data.to.analyze))
or
aov(HSuccess ~ Veg, data = data.to.analyze)
Hope this helps,
Rui Barradas
Em 05-10-2012 09:27, Jhope escreveu:
Hi R-listers,
I am trying to
<- sub(".*,([[:digit:]]+).*", "\\1", l[-1])
l.new <- c(l1, paste0("(", l2, ",", l3, ")"))
levels(y) <- l.new
str(y)
barplot(table(y))
Instead of 'y' use data.to.analyze$VegIndex and it should give what you
want.
Hope this
Hello,
Comment out the second apply and all following instructions using 'r2'.
In the end return 'r1', not cbind.
Hope this helps,
Rui Barradas
Em 04-10-2012 23:38, genome1976 escreveu:
Hi Rui,
A while ago you helped me with calculaing all possible ratios from a dat
urely the same but not if it's a one sample test.
Hope this helps,
Rui Barradas
Em 05-10-2012 12:15, user1234 escreveu:
Rui,
Your response nearly answered a similar question of mine except that I also
have ecdfs of different lengths.
Do you know how I can adjust x <- seq(min(loga, lo
Trabalho de casa? Não fazemos trabalhos de casa.
Ao menos podia ter tentado correr esse código...
Rui Barradas
Em 05-10-2012 14:56, Diego Pujoni escreveu:
> Olá pessoal, estou realizando uma ANOVA com medidas repetidas e estou
> utilizando a função "Anova" do pacote "car"
head(MyData, 20) ) # Then paste the output of this in a post.
Hope this helps,
Rui Barradas
Em 05-10-2012 14:26, Rerda escreveu:
Dear everyone
I am a bit of a computer imbecile and are having problems with R.
I am using R in my research project to do chi-square tests on data imported
from
4], 100, TRUE)
multi.boxplot(a, fac)
Hope this helps,
Rui Barradas
Em 05-10-2012 17:01, David Gramaje escreveu:
Dear all
I am trying to represent a dependent variable (treatment) against different
independent variables (v1, v2, v3v20). I am using the following command:
boxplot(v1~trea
Hello,
1. Let me refrase it a bit. For each column, sum all others and take the
symmetric.
mat <- matrix(1:30, ncol = 3)
sapply(seq_len(ncol(mat)), function(i) -rowSums(mat[, -i]))
2. write.table (maybe using sep = "\t" ?) and send the file to printer.
Hope this helps,
Rui
Or, using your mapply solution, compute
rs <- rowSums(mat1)
and then use it for all subtractions. With a larger dataset this would
be probably faster.
Rui Barradas
Em 05-10-2012 22:41, arun escreveu:
Hi,
Sorry, I think I misunderstand your question (after reading Rui's solution).
And was it it?
Rui Barradas
Em 05-10-2012 21:44, genome1976 escreveu:
Thanks Rui.I actually exactly did that.
Date: Fri, 5 Oct 2012 05:49:20 -0700
From: ml-node+s789695n4645154...@n4.nabble.com
To: genome1...@hotmail.com
Subject: Re: Calculating all possible ratios
Hello,
Comment
, ")"))
Error: could not find function "paste0"
paste0 was introduced with R 2.15.0, update your version of R and in the
mean time use
paste(...etc..., sep = "")
Rui Barradas
levels(data.to.analyze$VegIndex) <- l.new
Error: object 'l.new' not fo
ame goes with indices 9 and 10.
Avoid this type of indexing. And if possible use the vectorized
instruction b2 <- breaks.
Hope this helps,
Rui Barradas
Em 06-10-2012 07:14, 周果 escreveu:
Hi there,
Here is a minimum working example:
---
perate on a copy
dat2$Tahun <- with(dat2, ifelse(Tahun < 71, 2000 + Tahun, 1900 + Tahun))
agg_dt1 <- aggregate(x=dat2[,3],by=dat2[,c(1,2)],FUN=sum)
head(agg_dt1)
Hope this helps,
Rui Barradas
Em 06-10-2012 03:38, arun escreveu:
Hi,
I hope this helps you.
I created a small dataset: 3 r
Hello,
Yes, your Spanish is close enough to Portuguese for you to understand it.
I thought it was homework and didn't read untill the end. Apologies to
Diego, and thanks to John.
Rui Barradas
Em 05-10-2012 22:48, John Fox escreveu:
Dear Diego,
This is close enough to Spanish for
Sorry,
Phone, daughter, forgot to sign.
Rui Barradas
Em 06-10-2012 12:28, Rui Barradas escreveu:
Hello,
Yes, your Spanish is close enough to Portuguese for you to understand it.
I thought it was homework and didn't read untill the end. Apologies to
Diego, and thanks to John.
Rui Bar
EMENT=pt_PT.UTF-8LC_IDENTIFICATION=pt_PT.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] rkward_0.5.6
loaded via a namespace (and not attached):
[1] tools_2.15.1
Rui Barradas
Em 07-10-2012 10:34, R. Michael We
7;)
vignette(package = 'rugarch')
vignette('Introduction_to_the_rugarch_package', package = 'rugarch')
The first 'vignette' instruction gives you a list of available
vignettes, the second one opens the vignette file in a new window.
Hope this helps,
Rui Barrad
;, 1:250))
pattern <- "^Sp[[:digit:]]+$"
whichCols <- grep(pattern, nms)
whichNames <- nms[whichCols]
reshape(..., varying = whichCols, times = whichNames, ...)
Hope this helps,
Rui Barradas
Em 07-10-2012 15:35, agoijman escreveu:
The problem with that, is that I just wrote an e
Hello,
If all your species have different names, you can allways try one of
1. if the non-species follow a pattern, negate those columns and you'll
have the species columns.
2. are the species the last columns? Use positional referencing.
Rui Barradas
Em 08-10-2012 00:16, Andrea Go
Hello,
Try the following.
BOD <- data.frame(Time = 1:3, demand=runif(3))
mat <- data.matrix(BOD)
rownames(mat) <- rep("", nrow(mat))
mat
Rui Barradas
Em 08-10-2012 04:33, killerkarthick escreveu:
>From the following image I need to remove the obs column for my docume
Hello,
See ?rle
Hope this helps,
Rui Barradas
Em 08-10-2012 13:55, Mike Spam escreveu:
Hi,
just a simple question.
Assumed i have a vector,
FALSE TRUE TRUE TRUE FALSE TRUE FALSE TRUE FALSE
or
NA 1 1 1 NA 1 NA 1 NA
what i need is the position where an element is the same - three
, table(V1, V2))
Hope this helps,
Rui Barradas
Em 08-10-2012 13:42, Nico Met escreveu:
Dear all,
Need a help. I would like to count combination of two columns:
structure(list(V1 = structure(c(4L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L), .Label = c(&quo
xlim = c(0, 16))
with(dat, arrows(1:15, fit, 1:15, lwr, angle = 90, length = 0.1))
with(dat, arrows(1:15, fit, 1:15, upr, angle = 90, length = 0.1))
Hope this helps,
Rui Barradas
Em 08-10-2012 20:11, liang@us.pwc.com escreveu:
fit lwrupr
1 218.4332 90.
argument to that function.
Try pdfc <- function (file = "Rplot.pdf", ...) and see what happens.
Hope this helps,
Rui Barradas
Em 08-10-2012 14:39, Christian Hoffmann escreveu:
Hi,
Iwrote 'pdfc' in analogy to 'lpr':
pdfc <- function (file = "Rplot.pdf
Hello,
Also, since the values are always 0/1, this should also do it.
with( dat, table( Rash, Hypotension ) )
Hope this helps,
Rui Barradas
Em 09-10-2012 00:36, David Winsemius escreveu:
On Oct 8, 2012, at 9:06 AM, Rerda wrote:
Dear Rui and David
Thank you very much for taking your time
Hello,
Try
qq <- qnorm(0.975)
x <- 90 + c(-1, 1)*qq*10
f <- function(x) dnorm(x, 90, 10)
curve(f, from = 60, to = 120)
segments(x, 0, x, f(x))
Hope this helps,
Rui Barradas
Em 09-10-2012 00:48, dLevy escreveu:
Its not homework, it is a seminar exercise that I need to complete in
rix you'll need
extra work. Try the code above and say whether it's on the right track.
Also, take a look at package Matrix. It's a recommended package and it
implements sparse matrices.
Hope this helps,
Rui Barradas
Em 09-10-2012 05:56, Noah Silverman escreveu:
I have a bu
Residuals & 18 & 16.58 & 0.92 & & \\
\hline
\end{tabular}
\end{center}
\end{table}
Hope this helps,
Rui Barradas
Em 09-10-2012 04:47, killerkarthick escreveu:
Thanks arun,
But what is the alternative solution in windows. Please
reply me...
Hello,
Try the following.
fun <- function(n = 100){
x <- sample(c("H","T"),3*n,replace=TRUE)
dim(x) <- c(3,n)
num_heads <- apply(x,2,function(x) sum(x=="H"))
table(num_heads)/n
}
Runs <- 1e1
t(replicate(Runs, fun()))
Hope this he
= sep)[-n, ]
filename <- sprintf("%s_%03d", prefix, filenumber)
write.table(tbl, filename, row.names = FALSE)
filename
}
NRows <- 256
NMat <- 100
fc <- file("test.txt", open = "rb")
lapply(seq_len(NMat), fun, fc, n = NRows + 1)
close(fc)
Hope
Hello,
As for creating the new variable try
dataSet <- within(dataSet,
deal_category <- ifelse(trans_value < 200, "low",
ifelse(trans_value < 500, "medium", "high")))
And the rest seems ok. Run the code and see if it is.
Hope this helps,
Hello,
Try
do.call(data.frame, by.list)
Hope this helps,
Rui Barradas
Em 09-10-2012 17:53, Jesus Frias escreveu:
> Dear R-helpers,
>
>
>
> I've got a summary of results from a by() call that I am making with a list
> of more than two of factors not very different fro
You're right, I was in a hurry. This one works.
x <- rnorm(100)
a <- sample(letters[1:4], 100, T)
by.list <- by(x, a, summary)
do.call(rbind, as.list(by.list))
(I would also prefer aggregate.)
Rui Barradas
Em 09-10-2012 19:46, ilai escreveu:
On Tue, Oct 9, 2012 at 12:25 P
Hello,
Try the following.
rownames(df) <- seq_len(nrow(df))
Hope this helps,
Rui Barradas
Em 10-10-2012 08:41, CrimMagic escreveu:
Hi Everyone! :D
Just need a little help on data frames. I was wondering if anyone would know
a way to rename the row numbers on a data frame.
e.g.
head
Hello,
Yes, since yesterday. I thought it was a virus in my system but after
running the anti-virus twice and after your mail I guess it's something
else.
Rui Barradas
Em 10-10-2012 12:50, Jessica Streicher escreveu:
From: 발송실패알림
Subject:[발송실패 안내]
env
near those. Can you
rethink what goes on before the algorithm?
Also, you're timing everything, it would be better to just
system.time({j <- apply(xy, 1, outer)})
Hope this helps,
Rui Barradas
Em 10-10-2012 11:15, tonja.krue...@web.de escreveu:
Hi all,
I wrote a function that actually
Hello,
Try the following.
pattern <- "between [[:digit:]]+ to [[:digit:]]+"
re <- regexpr(pattern, string)
regmatches(string, re)
Hope this helps,
Rui Barradas
Em 10-10-2012 12:45, arunkumar escreveu:
hi
My string contain
string = "The sales is good when my num1
Hello,
If 'by' is giving you trouble, why not 'aggregate'?
agg.df <- aggregate(iris, list(iris$Species), FUN = summary)
str(agg.df)
Hope this helps,
Rui Barradas
Em 10-10-2012 15:02, Alex van der Spek escreveu:
Thank you Petr,
Try this
str(by(iris, iris$Species, summ
Hello,
Your model is equivalent to the model below. As for standard errors, try
predict.lm with the appropriate argument.
?predict.lm
model <- lm(decrease ~ rowpos + colpos*treatment, data = OrchardSprays)
predict(model, se.fit = TRUE, interval = "confidence")
Hope this helps,
")
36return(invisible())
It means the call to `?` is messed up. Maybe someone with more knowledge
of the sources can give a more meaningfull answer.
Hope this helps,
Rui Barradas
Em 10-10-2012 17:59, Christian Hoffmann escreveu:
What does the sudden appearance of "Contacti
Unsuccessfull? Why unsuccessfull? Have you noticed the call to rpois? It
beats runif by potential infinity.
Rui Barradas
Em 10-10-2012 18:30, David Winsemius escreveu:
On Oct 10, 2012, at 9:59 AM, Christian Hoffmann wrote:
What does the sudden appearance of "Contacting Delphi
Hello,
Try instead
?levels
abc <- factor(c(2,2,3,4,7,7))
as.numeric(levels(abc)[1])
Hope this helps,
Rui Barradas
Em 10-10-2012 19:39, Brigid Mooney escreveu:
Sorry, I'm sure I'm not using the appropriate vocab here, which is
undoubtedly why I can't seem to find a fix to th
Sorry, not one of my days. Forgot to Cc the list.
Rui barradas
Em 10-10-2012 20:28, Sarah Goslee escreveu:
Sent just to me?
On Wed, Oct 10, 2012 at 3:26 PM, Rui Barradas wrote:
You're right, apologies to the op and the list. I was thinking of the more
complicated
as.numeric(levels(abc
Hello,
Could you post a data example? Using, with data.frame named 'dat'
dput( head(dat, 30) ) # paste the output of this in a post
I have written code that creates pairs pre/post columns but it can't
really be tested.
Hope this helps,
Rui Barradas
Em 11-10-2012 00:09,
pre, getpair, post)
pairs <- matrix(c(pre, post), ncol = 2)
# now the tests
result <- doTests(dat2, pairs)
rownames(result) <- vmat[pre, 1]
result
In your results I believe that the values for meandifference are the
means of x[, 1], at least that's what I've got.
Anyway, I'll
dat)
vars <- gsub("_pre", "=pre", vars)
vars <- gsub("_post", "=post", vars)
vars <- gsub("pre_", "pre=", vars)
vars <- gsub("post_", "post=", vars)
vars <- gsub("_", "\\.", vars)
.
Rui Barradas
A.K.
- Original Message -
From: Rui Barradas
To: arun ; "Nundy, Shantanu"
Cc: R help
Sent: Thursday, October 11, 2012 9:25 AM
Subject: Re: [R] multiple t-tests across similar variable names
Hello,
I have a problem, with your data example my results are di
3 0 0
6 2 2/14/10 4 1 0
7 3 7/27/11 3 1 0
8 3 7/28/11 7 2 2
9 3 7/29/11 3 1 0
And take a look at package boot. Maybe you'll find something there.
Hope this helps,
Rui Barradas
Em 11-10-2012 16:55, Paul Wennekes escreveu:
Hi all,
New to R, so this may be
itional sd.
x$garch
x$sigma
Hope this helps,
Rui Barradas
Em 11-10-2012 21:29, mina izadi escreveu:
Dear R-helpers,
I need to read some data from output of garchFit in fGarch.
my model is garch(1,1) and i want to read
coefficients(omega,alpha,beta) and timeseries(x) and conditional
SD(s). beca
Hello,
Try the following.
data[ , 2:3][is.na(data[ , 2:3] ) ] = 0
You have to tell the interpreter which columns you want to change.
Hope this helps,
Rui Barradas
Em 11-10-2012 23:05, scoyoc escreveu:
I've been beating my head on the table for hours now and don't understand why
th
list(D = mean(D), p.value = mean(p), nboots = nboots)
}
Hope this helps,
Rui Barradas
Em 12-10-2012 04:09, louise.wil...@csiro.au escreveu:
Hi,
I am performing GEV analysis on temperature/precipitation data and want to use
the ks.boot function but I am unsure of how to implement it using the pgev
Hello,
Something like this?
g[rowSums(g) == 100, ]
Hope this helps,
Rui Barradas
Em 12-10-2012 15:30, wwreith escreveu:
I wish to create a matrix of all possible percentages with two decimal place
percision. I then want each row to sum to 100%. I started with the code
below with the intent
1701 - 1800 of 3010 matches
Mail list logo