Displaying 20 results from an estimated 400 matches similar to: "Lattice(barchart) related query"
2009 Jun 01
2
Sweave:Figures from plot (LME output) not getting generated (pdf or eps)
Hi,
I seem to be facing a strange problem when I use Sweave for creating a
LaTeX document of the R lme() output --- The EPS and PDF figure files
get created, but are empty. I have attached a reproducible example
below (taken from the R lme() help example).
------------------------------------------------------------------------------------
\documentclass[a4paper,10pt]{article}
2009 Jun 17
1
sapply() related query
Hi folks,
I'm trying to consolidate the outputs (of anova() and lrm()) from
multiple runs of single-variable logistic regression. Here's how the
output looks:
------------------------------------------------------------
y ~ x1 y ~ x2 y ~ x3 y ~
x4
Chi-Square 0.1342152 1.573538 1.267291 1.518200
d.f. 2 2
2012 Mar 29
1
Retrieving matrix column and row names by index value
Hi all,
So let's say I have a matrix, mdat and I only know the index number. How do
I retrieve the column and row names?
For example,
> mdat <- matrix(c(1,2,3, 11,12,13), nrow = 2, ncol=3, byrow=TRUE,
dimnames = list(c("row1", "row2"),
c("C.1", "C.2", "C.3")))
> mdat[4]
[1] 12
>
2010 Sep 18
2
feedback/question on function update()
Hi,
First let me say I am a big fan of R and appreciate all your time and
effort.
The update() function does not seem to work in a for loop. Consider the
following:
mdat <- matrix(c(1,2,3, 11,23,13, 12,4,8), nrow = 3, ncol=3, byrow=TRUE)
reg <- lm(mdat[7:9]~1)
for(i in 1:2) {
reg <- update(reg,.~.+mdat[((i-1)*3 + 1):(i*3)]) #update reg twice
}
reg # reg should have two independent
2009 Mar 05
3
Dropping rows conditionally
Dear R-help team,
I am getting addicted to using R but keep on getting many challenges on the way especially on data management (data cleaning).
I have been wanting to drop all the rows if there values are `NA' or have specific values like 1 or 2 or 3.
mdat <- matrix(1:21, nrow = 7, ncol=3, byrow=TRUE,
dimnames = list(c("row1",
2009 Jan 26
1
reshape problem: id and variable names not being recognized
Hi everyone. Long time listener, first-time caller here.
I have a data set that's been melted with the excellent reshape package, but
I can't seem to cast it the way I need to.
Here's the melted data's structure:
> str(mdat)
'data.frame': 6978 obs. of 4 variables:
$ VehType : Factor w/ 2 levels "Car","Truck": 1 1 2 1 1 2 1 1 1 1 ...
$ Year :
2011 Nov 11
1
barplot names.arg
Hello there,
I have a question regarding bar plots. I am trying to plot the data from
the following matrix as a barplot -
# input data
mdat <- matrix(c(0.1,0.9,0.9,0.1,0.5,0.5,0.45,1-0.45,0.6,0.4,0.8,0.2), nrow
= 6, ncol=2, byrow=TRUE,
+ dimnames = list(c("Mon", "Mon", "Tues", "Tues", "Thurs",
"Friday"),
+
2011 May 18
1
matrix help (first occurrence of variable in column)
Dear R help,
Apologies for the less than informative subject line. I will do my
best to describe my problem.
Consider the following matrix:
mdat <- matrix(c(1,0,1,1,1,0), nrow = 2, ncol=3, byrow=TRUE,
dimnames = list(c("T1", "T2"),
c("sp.1", "sp.2", "sp.3")))
mdat
In my actual data I have time
2005 Jan 06
5
How to avoid rounding of matrix elements?
Hi all R-users,
If I have a matrix with numeric elements as follows, the values are
rounded when I try to refer to a specifici element using [], the value
is rounded.
The same thing happens if the matrix is read from a file, the values are
stored to the correct precision but then when I try to refer to a
specific element (such as using [], it is rounded.
How do I avoid this rounding?
2008 Nov 22
2
ggplot2 - facet_grid and facet_wrap
Hello R users (and Hadley)
I have another question about ggplot2 :-)
(version 0.8)
`dat` <-
structure(list(D = c("a", "b", "c", "d"), G = c(1.51520888871520,
1.88812208268440, -6.60521862, 0.55968739), E = c(1.38888592256404,
1.39366168665589, 1.22509259382058, 1.36617701059296), I =
c(6.92634958902857,
6.94416045215158, 13.2179488828556,
2012 Jun 06
2
ggplot2: legend for geom_rug() ..?
Hi,
I was trying to make another legend for the rug plot. Sample code:
library(ggplo2)
ids <- paste('id_',1:3,sep='')
before <- sample(9)
after <- sample(1:10,9)
dat <- as.matrix(cbind(before,after))
rownames(dat) <- rep(ids,3)
position <- c(rep(10,3),rep(13,3),rep(19,3))
mdat <- cbind(melt(dat),position)
ggplot(mdat, aes(position, value)) +
2007 Jun 12
1
Subset and logical operator error
Hello,
It looks to me as if the ! logical operator cannot be called when
subsetting a data.frame. In the example below, the value column has two
factor levels (but my typical datasets have more), and what I am trying
to do is to exclude all lines for which the "value" is different from
"A". I have got a syntax error message everytime I try to use the
subset() function.
2010 May 11
1
create a data.frame for aov
Hi R-experts,
I try to find a way to transfer a matrix to a data.frame that is used as input of aov.
can you give me advice for that?
>mdat <- matrix(c(1,2,3, 11,12,13), nrow = 2, ncol=3, byrow=TRUE, dimnames = list(c("row1", "row2"), c("Col1", "Col2", "Col3")))
>mdat
Col1 Col2 Col3
row1 1 2 3
row2 11 12 13
===>
2012 Nov 07
5
Calling R object from R function
Hi,
Can you please help me with this please?
What I am trying to do is call a vector from R function and used in the new
function
So I create 4 functions with these arguments
M11 <- function(TrainData,TestData,mdat,nsam) {
ls <- list()
I have few statments one of them is
vectx <- c(,1,2,3,4,5,6,6)
vectz <- c(12,34,5,6,78,9,90)
and then................
ls(vectx=vtecx,vectz=vectz)
2012 May 10
0
Coloring subsets of points of a strip chart by quantiles
Hello All,
I am trying to color five subsets of points in a series of vertical strip
charts by quintiles using the quantile function, but I have not been able to
do this successfully, nor have I been able to find an example of this
online. I would like to have the "E1", "E2", and "E3" columns plotted on a
single plot (containing the three strip charts). I am
2012 Nov 15
0
problem in fitting model in NLS function
Bad scaling will waste a lot of everyone's time.
I put the data in a data frame mdat, then
library(nlmrt)
mdat<-read.csv("muzzamil.csv", header=T)
fmn <- nlxb(y~a * (x^b), data=mdat, start=c(a=1,b=1), trace=T)
fm <- nls(y~a * (x^b), data=mdat, start=c(a=1,b=1), trace=T)
fmn2 <- nlxb(y~a2 * ((x-1979)^b2), data=mdat, start=c(a2=1,b2=1), trace=T)
fm2 <- nls(y~a2 *
2011 Jul 25
1
two sample histogram
dear all,
i am anewcomer. i have a set of paired data, the values are great different from each other. i want to show them in histogram.
first, how to draw each bar for corresponding paired data side by side;
second, how to set the scale of y axis? one is up to 100-fold to the other. ifdoubleslash is used to omit some coordinates, the histogram will looks better.
is there anyone that can help
2012 Dec 17
2
Suggestion: 'method' slot for format.ftable()
Dear R-developers,
I would like to suggest a 'method' slot for format.ftable() (see an adjusted
'format.ftable()' below, taken from the source of R-2.15.2).
At the moment, format.ftable() contains several empty cells due to the way the
row and column labels are printed. This creates problems (= unwanted empty
columns/rows) when converting an ftable to a LaTeX table; see an
2011 Jun 24
0
reshape: cast(x, a ~ b ~ .) vs. cast(x, a ~ b) difference
Hi,
I have a problem with understanding what the function cast() from the package reshape is doing. In the example below I have a 2x2x2 array which I first melt and then cast to get the averages over the field 'strain' for every combination of the fields 'treatement' and 'gene':
------
> mdat <- melt(array(rnorm(8), dim=c(2,2,2),
2009 Jul 16
3
DataFrame help
Alright, so I am trying to write my own function to calculate column sums in
a matrix. I want the result as a single list with the values.
So far I have:
csum<-function(m)
{
a = data.frame(m)
s = lapply(a,sum)
return(s)
}
What is the easiest way to have it return in a format such as [1] 6 15 24 ?
Thanks.
--
View this message in context: