Displaying 20 results from an estimated 110 matches similar to: "how to get colnames of a dataframe within a function called by 'apply'"
2008 Feb 29
1
setHook and lattice
Hi,
I am trying to find a way to automate production of page numbers in plots
produced using the lattice package. To do this, I started playing around
with setHook which works fine with vanilla plot, but the hook 'plot.new'
doesn't appear to be relevant to the lattice package. I was wondering if
there is a alternative someone can suggest for use with the lattice package.
Example
2012 Sep 16
1
How to plot two lines, and only one line with errorbar by qqplots of R
Here is my code, which plots three lines with errorbar. How could I add an
extra line without errorbar to the plot? Thank you very much.
beta.data <- data.frame (
method = rep(c("Wrong", "Correct", "Full Bayes"), each = T_obs),
mean.beta = c(mean.beta1, mean.beta2, mean.beta3),
t = rep(points, 3),
std.beta = c(std.beta1, std.beta2, std.beta3)
)
limits =
2007 Oct 31
2
Shell Bash with R
Hello,
I try to write a bash skript and I want to use the variables from my
bash skript into R. Ist that possible?
My bash skript creates lots of *.data files. I want forward these
files directly into R (in x.data.bz2), so that R creates a few data
automatically also in PDF.
For example:
bash created files: hello.data , world.data
how R created these files in pdf?
please look my plot.R
2005 Dec 26
8
Add notes to a graph
Hi, I have done a search on this in vain. How can I add a note to the foot of a graph example below
|-----------------------|
| Title |
| -------- |
| | my | |
| | graph | |
| | | |
| | ______| |
|note: source |
|-----------------------|
Many thanks
Ronnie
2015 Feb 07
3
how to draw paired mosaic plot?
If there are many character variables,and I want to get the mosaic plot of every pair of each variable,how to do then?
If the variables are numeric, I can use pairs to get paired scatter plot.
But as to the character variables, how to get the "paired mosaic plot"?
Many thanks.
--
QQ: 1733768559
At 2015-02-07 17:04:26,"Jim Lemon" <drjimlemon at gmail.com>
2007 Jun 02
1
Calculating column percentages of a table
Hello,
I know, this is a real newbie question, but I can't find anything on this in
the manuals! I know that I get calculate the column totals of a table with
`apply(mytable, 2, sum)'. Now I want each column total to be 100% and
calculate the percentage of each field of the column. How would I do that?
Rcommander, the ultimate newb-tool, has a function `colPercents' which is
exactly
2007 Jul 18
0
sqlSave, ...colnames=F, using "odbcConnectExcel" .... I still get colnames in top row of exprted sheet
I am trying to save an R data.frame as an Excel sheet.
I do NOT want the column names saved into row 1.
I set colnames=F.
However, it still seems that the colnames are saved into row 1.
Is this a bug? Or am I coding incorrectly and.or misunderstanding this feature?
#example code:
sheet = "c:/test2.xls"
temp=data.frame(matrix(data=NA,nrow=10,ncol=15))
temp[1,1] =
2014 May 14
0
S3 - how to implement "colnames<-"
Have a class for which I would like to provide a "colnames<-.myclass"
function so that
colnames(myintsance) <- c("a","b","c")
can be called.
Witold
--
Witold Eryk Wolski
[[alternative HTML version deleted]]
2011 Mar 07
0
Error in colnames: target of assignment expands to non-language object
Hi there,
I cannot find a detailed explanation to the following error message:
> colnames(matrix(1:10, ncol = 2)) <- c("X", "Y")
Error in colnames(matrix(1:10, ncol = 2)) <- c("X", "Y") :
target of assignment expands to non-language object
However, when I do the following things, the error message disappear:
> z <- matrix(1:10, ncol =
2010 Jul 28
1
How get colnames and rownames in Rcpp method?
Hi all,
How get colnames and rownames in Rcpp method?
attecthed file : RGui.exe capture
my work environment :
R version : 2.11.1
OS : WinXP Pro sp3
Thanks and best regards.
Young-Ju, Park
from Korea
[1][rKWLzcpt.zNp8gmPEwGJCA00]
[@from=dllmain&rcpt=r%2Dhelp%40r%2Dproject%2Eorg&msgid=%3C20100728211143%2EH
2016 Apr 05
1
Heatmap Colnames
Hello,
please see below my code for a heatmap. Unfortunately my column names do not completely appear. Can you please send me the appropriate code to visualise them?
Many Thanks!
Nils
library(GMD)
dat<-data.frame(EntryA=as.numeric(c(4.24,3,1.66,1.28,1.2,-1.32,-1.88)), EntryB=as.numeric(c(4.16,4.82,-1.82,-3.02,0.99,1.1,-3.31)))
2018 May 19
1
Bug on qr.coef when qr is created by a zero matrix with colnames and all y equals zero
Dear maintainers,
I'm reporting a bug in qr.coef that mishandles the colnames of matrix. A minimal reproducible example is as follows:
x <- cbind(rep(0, 10), rep(0, 10))
y <- rep(0, 10)
q <- qr.default(x)
qr.coef(q, y)
[1] NA NA
If x has colnames, then qr.coef will end up with an error:
x <- cbind(x1 = rep(0, 10), x2 = rep(0, 10))
y <- rep(0, 10)
q <- qr.default(x)
2004 Aug 02
0
lapply drops colnames
Seems like you got your input and output mixed up a bit...
> From: Jack Tanner
>
> I want to iterate over a data frame by columns, and as I'm processing
> each column I want to know its column name.
>
> > a <- as.data.frame(list(1,2,3))
> > colnames(a) <- c("a", "b", "c")
> > colnames(a)
You must have the two lines
2004 Dec 21
1
about colnames
Try
colnames(df)[4:6] <- c("x","y","z")
-----Original Message-----
From: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of
xmeng at capitalbio.com
Sent: 21 December 2004 09:45
To: r-help at stat.math.ethz.ch
Subject: [R] about colnames
Hello sir:
If there's a data frame(with name "df"):
a b c d e f
2006 Nov 06
1
colnames and get means for the columns with the "same" names
hi,
I have a conversion table for colnames like this:
Probe_ID HUMAN_LLID
1 AF106325_PROBE1 7052
2 NM_019386_PROBE1 7052
3 NM_012907_PROBE1 339
4 AW917796_PROBE1 84196
5 L27651_PROBE1 10864
The Probe_ID contains a list of colnames for another data.frame, say x1.
I need to convert such colnames to another ID's system, HUMAN_LLID by
using the table.
2008 Sep 22
1
how to set rownames / colnames for matrices in a list
Hello,
I have another stupid question. I hope you can give me a hint how to solve this:
I have a list and one element is again a list containing matrices, all of the
same dimensions. Now, I'd like to set the dimnames for all matrices:
example code:
m1 <- matrix(1:25, nrow=5)
m2 <- matrix(26:50, nrow=5)
# ... there can be much more than two matrices
l <- list()
l[[1]] <-
2008 Oct 21
1
Error in sample(colnames(B), 10) : invalid 'x' argument
HI,
I have a file named "s1"(which has 14 rows and 4 columns) which is in csv
format. I import and call it "A" the file using:
A <- read.csv(file="s1.csv",head=TRUE,sep=",")
then I transpose it and call it "B"(which will have 4 rows and 14 columns)
using:
B=t(A)
when I want to make 5 samples from "B" (choosing 10 columns) using:
2009 Mar 08
1
Summary of data.frame according to colnames and grouping factor
A dataframe holds 3 vars, each checked true or false (1, 0). Another
var holds the grouping, r and s:
### start:example
set.seed(20)
d <- data.frame(sample(c(0, 1), 20, replace=T), sample(c(0, 1), 20,
replace=T), sample(c(0, 1), 20, replace=T))
names(d) <- c("A", "B", "C")
e <- rep(c("r", "s"), 10)
### end:example
How do I get the
2010 Jan 20
1
sum column by colnames
Hi,
I've this dataframes:
> data1
1 2 3 4 5 6
5 0.4963017 0 0 0.2481509 1.9852069 0.4963017
10 0.0000000 0 0 0.0000000 0.6317266 0.0000000
15 0.0000000 0 0 0.0000000 0.0000000 0.0000000
20 0.0000000 0 0 3.3955301 0.0000000 0.0000000
25 0.0000000 0 0 0.0000000 0.0000000 0.0000000
30 0.0000000 0 0 0.0000000 0.0000000
2010 Mar 15
1
assign colnames to data
Hi,
Do you know how to assign colnames from one list to another, for example.
a=c(1,2,3)
b=c("A","B","C")
how can I get the dataset
A B C
1 2 3
where A, B and C are colnames. Thanks.
Xumin
[[alternative HTML version deleted]]