Displaying 20 results from an estimated 6000 matches similar to: "reading very large files"
2001 Dec 18
4
chi-squared test
I don't quite understand the difference between the two methods for
performing a chi-squared test on contingency tables: summary(table())
and chisq.test()
They may different results. E.g.:
aa <- gl(2, 10)
bb <- as.factor(c(1,2,2,2,1,2,1,2,2,2,1,2,2,2,1,1,1,2,1,1))
aa <- c(aa, aa)
bb <- c(bb, bb)
table(aa, bb)
summary(table(aa, bb))
chisq.test(aa, bb)
Could somebody give me
2001 Sep 25
2
glm.nb, anova.negbin
Dear R-collegues,
I'm getting an error message (Error in round) when summarising a glm.nb
model, and when using anova.negbin (in R 1.3.1 for windows):
> m.nb <- glm.nb(tax ~ areal)
> m.bn
Call: glm.nb(formula = tax ~ areal, init.theta = 5.08829537115498,
link = log)
Coefficients:
(Intercept) areal
3.03146 0.03182
Degrees of Freedom: 283 Total (i.e. Null); 282
2003 Apr 24
1
matrix to coordinates
Dear R-users,
I'm sure it must be a specific function or a better way to convert
matrix to x,y,z coordinates (and viceversa), than my function below (it
works). Any help?
m2coord <- function(m)
{
k <- nrow(m)*ncol(m)
aa <- data.frame(r=1:k, c=1:k, v=1:k)
k <- 0
for (i in 1:nrow(m))
for (j in 1:ncol(m))
{
k <- k+1
aa$f[k]=i; aa$c[k]=j; aa$v[k]=m[i,j]
}
aa
}
Juli
2005 Oct 04
1
repeated measures with random effects
Dear all,
I'm interested in analysing a reapeated measure desing where plant
height (H) was measured 3 times (Time). The experimental design
include 2 fixed factor (say A and B) in which A is nested in B, and a
random factor (C, the plot), using the aov().
So my first idea would be something like:
aov(H ~ B * A %in% B * Time + Error(id) )
where id is the factor coded for the repeated
2003 Dec 18
2
barplot & plot together
Dear colleges,
I'm trying to combine a barplot and a plot in a single figure as follows:
data <- 1:6
t <- barplot(data, axes=F)
par(new= T)
plot(t, data, type="b")
However, as you can see in the example, the dots of the second plot do
not fall in the midpoint of the bars in the first. Any trick for setting
the 2 plots at the same scale?
I have unsuccessfully tried:
plot(t,
2008 Feb 10
2
reshape
Dear colleagues,
I'd like to reshape a datafame in a long format to a wide format, but
I do not quite get what I want. Here is an example of the data I've
have (dat):
sp <- c("a", "a", "a", "a", "b", "b", "b", "c", "d", "d", "d", "d")
tr <- c("A",
2003 May 01
4
var[i]
Dear all,
How could I use variables in a loop that their names are in a vector?
For example:
aaa <- 1:10
bbb <- aaa*2
ccc <- aaa+bbb
varn <- c("aaa", "bbb", "ccc")
m <- rep(NA, 3)
for (i in 1:length(varn)) m[i] <- mean(varn[i]) # wrong
thanks in advance
Juli
--
"Wars do not solve problems, wars generate even more problems"
2000 Mar 16
2
glm: offset in poisson
R-users,
Can an offset term be included in a Poisson model?
I get an error message when trying that:
>r3o <- glm(tax ~ areal + offset(o), family=poisson)
Error in (if (is.empty.model(mt)) glm.fit.null else glm.fit)(x = X, y = Y, :
inner loop 1; can't correct step size
In addition: Warning message:
Step size truncated due to divergence in: (if (is.empty.model(mt))
2002 Sep 05
4
line thickness in plots
Hi all,,
Is it possible to set a thicker line for the box around the plots? (i.e.
for the four axes)
Something like lwd (lines) but for the box.
Thanks
juli
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the
2008 Jun 26
1
write.table a df with specific column order
Hi
I'd like to write.table a dataframe, but with an specific order of
columns. Is there a direct way to do it? or I have to generate a new
dataframe as follows:
t <- data.frame(c=1:10, b=11:20, a=letters[1:10])
t2 <- data.frame(a=t$a, b=t$b, c=t$c)
write.table(t2, row.names=F)
Thanks for any comment
Juli
--
http://www.ceam.es/pausas
2008 Jun 27
1
removing blanks from a string
Hi
Is there a way to remove blank characters from the end of strings in a
vector? Something like the =TRIM functions of the OpenOffice
spreadsheet. E.g.,
a <- c("hola ", "Yes ", "hello ") # I'd like to get:
c("hola", "Yes", "hello")
Thanks
Juli
--
http://www.ceam.es/pausas
2002 May 11
2
RODBC sqlFetch
Hi,
Thanks for showing me how to use RODBC and odbcConnect.
Now works nicely. The question I've got now is:
noms <- list.files(pattern=".DBF")
# removing extension names:
noms <- sapply(noms, function(x) as.character(strsplit(x,".DBF")) ,
USE.NAMES=F)
for (i in 1:length(noms)) {
s <- sqlFetch(bdades, noms[i])
# etc.
}
But it seems that sqlFetch()
2008 Feb 27
1
glm binomial with no successes
Dear all,
I have a question on glm, family binomial. I do not see significant
differences between the levels of a factor (treatment) if all data for
a level is 0; and replacing a 0 for a 1 (in fact reducing the
difference), then I detect the significant difference that I expected.
Is there a way to overcome this problem? or this is an expected
behaviour ? Here is an example:
s <-
2004 Jan 21
2
subset select within a function
Dear all,
I'd like to subset a df within a function, and use select for choosing
the variable. Something like (simplified example):
mydf <- data.frame(a= 0:9, b= 10:19)
ttt <- function(vv) {
tmpdf <- subset(mydf, select= vv)
mean(tmpdf$vv)
}
ttt(mydf$b)
But this is not the correct way. Any help?
Thanks in advance
Juli
2002 Jul 30
4
chisq.test, basic question
The cells are interpreted as counts, so by scaling you're analyzing a
different experiment (one with fewer observations). So the chi-squared value
will change (the terms (O-E)^2/E in the statistic scale linearly ignoring
rounding and "Yates' continuity correction").
The chisq.test on the original data is a test of association. Conventionally
you decide ahead of time on a
2002 Nov 12
1
is r-help-digest working?
Dear all,
I'm a subscriber of the r-help-Digest; however, currently I'm not
receiving the daily message. The 2 last digest messages I've got are: V3
# 157 (2/11/02) and V3 #165 (12/11/02), and both are incomplete (the
initial indice list many items but only few are of them are shown). I
did resuscribe, but the problem persists.
Is this just my problem (a problem of my system)?
Or is
2003 Sep 17
1
the name of a variable in a function
Dear collegues,
How can I get the name of a variable (and not the variable) within a
function ?
For instance, in the following function, I'd like to create a variable
in the dataframe df with the same name to the variable passed in var:
prova <- function( var )
{
df <- as.data.frame(matrix(nr=20,nc=0))
df[["here"]] <- seq(min(var), max(var), le= 20) #
df
}
for
2003 Mar 05
1
cor.test in matrices
Hi,
For computing correlation among variables in a matrix, I use cor( ), but
for computing the p-values I'm using cor.test in the following way:
cor.p <- function(X)
{
res <- matrix(0, ncol(X), ncol(X))
for (i in 1:ncol(X))
for (j in 1:ncol(X)) res[i, j]<- cor.test(X[, i], X[, j])$p.value
rownames(res) <- colnames(res) <- colnames(X)
res
}
I'm just wondering if there is a
2003 Mar 14
1
any european maps
Dear all,
I've seen that there are some maps, or at least costlines in R. The oz
package is the map of Autralia and in the fields package there is a US
map and a world map. This world map allows to select smaller sections
such Europe:
library(fields)
world(xlim=c(-10,18),ylim=c(36,60))
However, at this scale the map is quite crude (and several important big
islands are messing).
My
2002 Jan 08
6
Subsets without NA
Is there a way of removing all rows with missing values from a data frame?
I usually use
subset(x, var1!="NA")
and repeat for each variable. It would be nice to be able to do it in one
fell swoop. Also, surprisingly, it doesn't always work. Sometimes I'm left
with an empty set even though not all rows have missing values for the
variable.
Cheers,
mikkel
Mikkel Grum,