Displaying 20 results from an estimated 20000 matches similar to: "rbind() overwriting data.frame()"
2010 Sep 20
4
how to show the number of each axis interval (plot)
Dear List,
I am using plot for homework.
The x-axis covered from 0 to 80, with 4 intervals.
However, the plot only showed 0, 40, 80.
20 and 60 disappeared.
Please kindly advise how to show 0, 20, 40, 60, 80 for the axis interval.
Thank you.
Elaine
[[alternative HTML version deleted]]
2009 Dec 07
2
column statistics
Hi everybody,
I would like to compute the mean for 1 variable between the rows with
the same levels.
For example, with the dataset below:
Factor1 Factor2 Value
A X 1
A X 2
A Y 3
A Y 4
B X 5
B X 6
B Y
2010 Sep 06
2
dataframe row names from list
Hi,
I have a list which looks like this...
> str(y)
List of 10
$ : chr [1:4] "ABCD" "5" "0" "1"
$ : chr [1:4] "DEF" "15" "1" "16"
$ : chr [1:4] "AAA" "2" "17" "8"
$ : chr [1:4] "SSS" "15" "25" "1"
$ : chr [1:4] "III"
2009 Aug 19
3
ggplot 2 semi-transparency error
Hi,
I used the command ggplot as follows...
p<-ggplot(a,aes(x=a$V1,colour=a$V2,fill=a$V2))
p + geom_density(alpha = 0.2,xlim=c(-10,10),ylim=c(0,0.5))
when I say,
dev.print(device=postscript,file="/alpha/dct.pdf")
I get
Warning message:
In grid.Call.graphics("L_polygon", x$x, x$y,
list(as.integer(1L:length(x$x)))) :
semi-transparency is not supported on this device:
2012 Jun 29
5
assign object with loop (translation from SAS to R)
I have a dataset named DM with p1, p2, ...., p9 (9 columns, numerical values)
I would like to calculate to multify each pair of columns (p1p2, p1p3,...
p1p9, p2p3, p2p4.... p8p9) and assign them in p1p2, p1p3,... p1p9, p2p3,
p2p4.... p8p9
In SAS,
l=0;
p_int_sum=0;
do i=1 to 8;
do j=(i+1) to 9;
l=l+1;
p{i}p{j}=p{i}*p{j};
end;
end;
I would like to know how to assign them in R
I tried for
2010 Nov 01
2
number of items to replace is not a multiple of replacement length
Hey all,
I am writing a function in which I will have a matrix of 4 columns and a
variable amount of rows.
The first to columns will always contain be of the Character type, the third
and fourth columns
can be a variation of data types, usually characters and integers, but
sometimes lists or matrices.
At one point the code makes, for each row, a copy of that row, then it makes
some adjustments
2010 Oct 12
2
Factors in an regression using lm()
Hi,
I am trying to do a multiple regression on the dataset "Hdma", available in
the Ecdat package.
The data looks like this:
> str(Hdma)
'data.frame': 2381 obs. of 13 variables:
$ dir : num 0.221 0.265 0.372 0.32 0.36 ...
$ hir : num 0.221 0.265 0.248 0.25 0.35 ...
$ lvr : num 0.8 0.922 0.92 0.86 0.6 ...
$ ccs : num 5 2 1 1 1 1 1 2 2 2
2012 Nov 05
2
averaging a list of matrices element wise
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 <- 3
r <- 5
s <- 6
raw <- lapply(seq_len(n), function(i){
matrix(rnorm(r * s), ncol =
2011 May 04
1
Str info. Thanks for helping
It looks from str(SA) that Response IPS1 is a data.frame of class "anova", which probably cannot be coerced to vector.
Maybe you can use unlist() instead of as.vector()
Or something like
SA[["Response IPS1"]]["as.factor(WSD)",] ## to select the first row only, even maybe with unlist()
Without a better REPRODUCIBLE example, I cannot tell more (maybe some others
2010 May 20
6
writing function
Dear group,
I am trying to write functions, but as a beginner, everything is not so
obvious.
Let's say I want the results in a list of elemts like this :
tot1, tot2, etc
Here is a function:
toto <-
function(x,y)
{
for(i in x:y){
paste(c("tot",i),collapse="")<-(i*2)
}
}
If I type this :
>toto(1,5)
I get this message error:
Error in paste(c("tot",
2010 May 19
3
save in for loop
Dear users,
My problem concerns save() within a for loop.
Here is my code:
for (i in 1:4) {
temp <- data.frame(a=(i+1):(i+10), b=LETTERS[(i+1):(i+10)])
filename <- paste("file", i, sep="")
assign(filename, temp)
save(filename, file=paste(filename, ".rda", sep=""))
}
As you can see, save() doesn't work as I would like: (1) the object
2010 Sep 16
2
How to combine matrix and vector
Dear fellows,
I am a novice in R. I would like to combine a matrix and a vector. Assume
that we have the matrix a and the vector b with same length of column.
a<-matrix(seq(1:10),nrow=2,ncol=5,byrow=TRUE)
a=
1 2 3 4 5
6 7 8 9 10
b<-t(c(11,12,13,14,15))
b=
11 12 13 14 15
Then, I want to combine a and b as follows.
c=
1 2 3 4 5
6 7 8 9
2009 Sep 02
2
Average over data sets
Hello,
I have a number of files output1.dat, output2.dat, ... , output20.dat,
each of which monitors several variables over a fixed number of
timepoints. From this I want to create a data frame which contains the
mean value between all files, for each timepoint and each variable.
The code below works, but it seems like I should be able to do the
second part without a for loop. I played
2010 Aug 09
1
bind a data frame columns
Hello guys, I want to rbind the columns of a data frame but I don't know how
to do it, let's say:
A B C
1 2 3
1 2 3
I want to get
1
1
2
2
3
3
It seems very simple but I still didnt get a find of how to do it...Please
help!
--
View this message in context: http://r.789695.n4.nabble.com/bind-a-data-frame-columns-tp2318526p2318526.html
Sent from the R help mailing list archive
2010 Mar 29
2
naming consecutive objects
Dear list,
I would generate a loop:
a<-c(1:98)
for (i in a )
{
cbind(vor.tile[[i]]$x, vor.tile[[i]]$y)->p
rbind(p,c(p[1,]))->p.c
Polygon(p.c)->pc.p
Polygons(list(pc.p),sprintf("p%s",i))->pc.ps
sprintf("pc.ps%s",i)<-pc.ps
}
I need to obtain 98 pc.ps objects (like: pc.ps1, pc.ps2....pc.ps98) but I
d'ont use sprintf for it.
How can made it?
many
2010 Mar 11
3
Help function "?" in R 2.10.1
Hello everyone,
I have versions 2.7.2 and 2.10.1 installed on a machine that has no
access to internet.
In 2.7.2 I can use ? to get help on functions, which in 2.10.1 that
does not work, all I see is "starting httpd help server...done" and
then nothing.
Have I downloaded 2.10.1 incorrectly (=forgot to tick some box for
local help file repository) or is the internet help now the
2013 Mar 04
3
urgent: question concerning data manipulation
Ein eingebundener Text mit undefiniertem Zeichensatz wurde abgetrennt.
Name: nicht verf?gbar
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20130304/62581e97/attachment.pl>
2010 May 18
3
"Re: Change class factor to numeric"
sorry I had a mistake sending my question without a subject. I do resend again. Please excuse me.
> Hello
> I have a data array with soil variables (caperf), in which the variable "clay" is factor (as I see entering str(caperf)) . I need to do a regression model, so I need to have arcilla (=clay) as a numeric variable. For that I have entered
>
>
2011 Aug 15
3
how can I read a xlsx file
Hello,
How can I read a xlsx file using xlsx package?
Thanks
Albert
[[alternative HTML version deleted]]
2010 Sep 21
2
labels in (box)plot
Dear users,
I would like all the ticks on a boxplot (x and y) to be labeled
I have checked all the par() arguments but couldn't find what I'm
looking for
Here is an example to show it:
df <- structure(list(SPECSHOR = structure(c(1L, 1L, 1L, 3L, 3L, 3L, 3L,
3L, 4L, 4L), .Label = c("cotau", "dibic", "eqgre", "gicam"), class =