similar to: Creating Sub-Matrix

Displaying 20 results from an estimated 4000 matches similar to: "Creating Sub-Matrix"

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
2009 Feb 20
2
change attributes of all data.frame elements
Hi, I was wondering whether there was an easy way to change the attributes of all elements in a data.frame (rather than looping through elements)? Specifically, I would like to set the "dim" attributes to NULL Thanks for any help, Jarrod -- The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336.
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
2009 Sep 02
2
Help with sub-setting data.frame
Friends I have a data frame, df that I want to extract some rows from Here is a sample of the data > head(df) TDate Expiry Underlie Strike CSettle PSettle Futures ExDate TTE 1 20080102 200801 200803 0.840 0.0000 0 0.9207 20080104 0.005479452 2 20080102 200801 200803 0.850 0.0000 0 0.9207 20080104 0.005479452 Rate Disc 1 0.0457 0.9997496 2 0.0457
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 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
2008 Dec 11
1
Rotate basic plot (scatter) in R
Dear all, I was trying to rotate a plot using R. I tried most of the examples offered here in this forum, but for some reason it is not working for a Scatterplot or in my case: plot (x,y). With a histogram I had no problems. Is it not possible to rotate a simple plot? Thanks a lot, Michael [[alternative HTML version deleted]]
2008 Dec 17
1
R function to calculate number of data points of each level
I have a dataframe with two columns : 11600 238'4 12000 218'0 12200 209'0 12600 192'0 13000 176'4 14000 145'0 15000 119'0 16000 103'0 18000 80'0 19000 68'3 20000 59'0 11600 208'1 12000 189'2 12200 180'3 There are repeatations in 1st column and I want to use this as Level. Next I want to report for each level how many data points are
2009 Jan 07
1
illustrating a report
Hi all I would like to know a bit more about illustrating an a4 page within R. Finally I would like to have a pdf with multiple pages containing some statistics. I'm already able to produce a pdf, containing a plot in the center of one a4 page. As a next step I would like to set a title on top of this a4 page (maybe with absolute positions, if not possible to set it relative?). The plots then