Displaying 20 results from an estimated 4000 matches similar to: "change attributes of all data.frame elements"
2008 Nov 25
2
invoking user-defined function
Dear list,
Can somebody tell me how to invoke user-defined functions from script
files during run-time?
Basically I have (almost) one function per script file.
I am thinking of something like
#include   in C++
import      in Java/Python
use          in Perl
No, I don't need my functions every time R is started.
Neither I am thinking about writing building my functions into
packages.
I just
2008 Jul 30
2
Bizarre - R crashes on merge
Hi all, 
  I have a large data.frame, 1530 observation with 6 columns. I want to
merge a 7th column, a transformation of the response variable (hospital
admissions), namely 
trans<-sqrt(copd$admissions+0.25)
trans<-data.frame(trans)
And now when I do 
copd2<-merge(copd,trans)
(copd being my original data.frame), R either crashes or is taking an
extremely long time to do the computation. I
2008 Nov 05
3
Efficient way to fill a matrix
Dear R experts,
Suppose I have a data frame of three variables:
> foo <- data.frame(row=1:5, col=1:3, val=rnorm(15))
> foo
   row col         val
1    1   1 -1.00631642
2    2   2  0.77715344
3    3   3  0.17358793
4    4   1 -1.67226988
5    5   2  1.08218836
6    1   3  1.32961329
7    2   1 -0.51186267
8    3   2 -1.20990127
9    4   3 -0.57786899
10   5   1  0.67102887
11   1   2 
2007 Oct 17
2
power law fit with unknown zero
Dear R-helpers
I would like to do a fit of the form: y = a (x+c)**b, where a, b and c 
are unknown.
Does anybody know how to do it?
Thanks
Thomas
2008 May 28
1
Can plot() be used for multiple plots?
Greetings helpRs --
 
I would like to use plot() to plot two cumulative distribution curves so
that a user of the plot can compare the distributions of the two
variables.  The following code draws two distributions separately, but I
cannot find the instruction necessary to add a second cumulative
distribution to the first one.
 
Any suggestion would be very welcome.
 
x1 <-
2008 Apr 07
1
Width of text displayed in R
All,
I think this is pretty basic but I couldn't find the answer in any
source.
I have just built my own R for Linux (amd 64).  It runs well, but R
thinks that it only has 80 characters or so of screen width.  I log on
with Putty to the box and can stretch it as large as I want.  
Is there a simple way to tell R to use more screen width when
displaying?
From whatami:
OS RELEASE         :
2008 Apr 09
1
read table not reading lines containing single quotes
Hi,
* I am using read.table command as follow
kegg<-read.table("c:/IDs.tab",header =TRUE,quote= "'", sep="\t") *
 Fragment of file is as follow:
ID          Pathway
04916    Melanogenesis
04920    Adipocytokine signaling pathway
04930    Type II diabetes mellitus
04940    Type I diabetes mellitus
04950    Maturity onset diabetes of the young
05010   
2008 Apr 25
3
How to overlap two density plots?
Hi,
How can I overlap two density plots?
A <- c(8,10,10,11,11,11,12,12,12,12,11,11,11,10,10,7)
B <- c(11,13,13,14,14,14,15,15,15,15,14,14,14,13,13,10)
plot(density(A))
plot(density(B))
Regards,
Emre
P.S. There's a overlap.density function in package DAAG
        Is there another way to do this?
-- 
---
Emre ÜNAL
http://www.geocities.com/dusemre
	[[alternative HTML version
2008 Apr 07
2
read.table with multiple header lines
Hello,
I have difficulties in reading in a text file with multiple (=2) header lines. My table looks like this:
id	code	gr	grcode	AA	AB	AC	AD
			time	30	40	50	60
1	1234	1	c	0	1	0	0
2	1346	1	c	0	0	0	1
3	1456	1	c	0	0	1	1
4	1893	1	c	0	0	1	1
Can someone help me out?
Thanks
Deborah
--
2008 May 31
2
How to identify overlapped items from two list and plot them?
Hi list,
I have a question on how to identify the overlapped items from two vectors:
>x<-c(0,1,2)
>y<-c(1,2,2,3)
and plot the number of the overlapped as well as non-overlapped in a
diagram?
Thanks much,
     Allen
	[[alternative HTML version deleted]]
2008 Apr 28
3
data.frame indexing
Dear R Community,     A simple problem (for some of you): I wish to index a
data.frame by all elements NOT in my index
E.g.:
> a<-as.data.frame(matrix(rnorm(100),nrow=10,ncol=10))
> b<-which(a$V1>0.8)
> b
[1]  1  4  6 10
> a_indexb<-a[b,]
> a_notIndexB<-a[!b,]
> nrow(a_notIndexB)
[1] 0
Indexing a on b is not a problem (a_indexb), but how can do get only the
2008 May 09
1
data management question
Hi all,
I have a data management question. I am using an panel dataset read into 
R as a dataframe, call it "ex". The variables in "ex" are: id  year  x
id: a character string which identifies the unit
year: identifies the time period
x: the variable of interest (which might contain NAs).
Here is an example:
 > id <- rep(c("A","B","C"),2)
2007 Oct 11
3
reason for error in small function?
Running the function below, tested using the cardiff dataset from
splancs generates the following error.   What changes do I need to
make to get the function to work?  Thanks.  --Dale
> gen.rpoints(events, poly, 99)
> rpoints
Error: object "rpoints" not found
# test spatial data
library(splancs)
data(cardiff)
attach(cardiff)
str(cardiff)
events <- as.points(x,y)
###
2008 Jun 19
4
Any simple way to subset a vector of strings that do contain a particular substring ?
For example, 
 
strings <- c("aaaa", "bbbb","ccba"). 
 
How to get "aaaa", "bbbb" that do not contain "ba" ?
_________________________________________________________________
	[[alternative HTML version deleted]]
2008 Jul 08
2
How to change labels in a histogram
Hi everyone
I am trying to add a percent sign to my labels in a hist() plot. "labels =
TRUE" gives me the values, but I don't know how to add the percent sign. I
would prefer to annote the plot after drawing it, e.g. using text(), but
don't know how to address the positions in a standard histogram. A lattice
approach would work too.
Best regards,
LY
-- 
View this message in
2008 Aug 21
2
skipping values when reading binary files
Hi,
I would like to skip a preset number of values when reading in a binary file
(readBin). Is there any way to do this?
kind regards,
and thanks in advance for the help.
 
Pieter Beck
 
	[[alternative HTML version deleted]]
2008 Sep 19
1
frequency table across multiple variables
Dear R users,
I have a dataframe like this:
x1<-c(1,2,3,4,NA ,NA ,NA, 3, 1, 1, 1, 1, 2, 2, 3, 4, 4)
x2<-c(2,3,4,3,4,3,4,2,2,3,4,NA,NA,NA,NA,4,3)
x3<-c(1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,1,2)
m<-data.frame(x1,x2,x3)
I would like to create a frequency table like this:
      x1  x2  x3
NA
1
2
3
4
where the values in each cell would be the count of the value for that
variable.
How can I do
2008 Nov 16
1
Expanding data ...
Hello,
I have a dataset that has counts, but I need to expand the dataset so 
that each of the counts has its own line in the dataset (row) and is 
given and id.  It looks something like:
Site	Type	Cnt
1	"A"	3
1	"B"	0
2	"C"	2
I want the dataset to look like:
Site	Type	ID	
1	"A"	1
1	"A"	2	
1	"A"	3
1	"B"	0
2	"C"	1
2
2008 Nov 16
1
Changing values (factors) does not change levels of that value?!
Hello,
 * I read in a server weblog with read.table.
   -> OK.
 * I look for the downloaded-size-values (filesize of the download)
   -> OK
 * I found "-" and wanted to substitute them with "0" and
   used:  weblog$V8[ weblog$V8 == "-" ] <- 0
   -> OK
 * checked the contents on "-" vs. "0" and found all "-" substituted by
2008 Dec 02
1
simultaneous plots
Is there a good and concise way of making simultaneous plots that are
identical, but directed to different devices?
I'm writing an R-script that produces a pdf file. I would really like to
check visually whether the pdf file shows what I expect. So I would like the
same commands to produce a plot on screen. At the moment I'm using
cut-and-paste, which is not ideal because any corrections