Displaying 20 results from an estimated 4000 matches similar to: "Getting the difference between two data frames"
2008 Dec 05
2
adding rows as arithmatic calculation on original rows
Dear R users,
Suppose I have the following data.frame:
myID myType myNum1 myNum2 myNum3
a Single 10 11 12
b Single 15 25 35
c Double 22 33 44
d Double 4 6 8
and I want to have new records:
myID myType myNum1 myNum2 myNum3
e Single 12.5 18
2009 Jun 03
1
Would like to add this to example for plotmath. Can you help?
Greetings:
I would like comments on this example and after fixing it up, I need
help from someone who has access to insert this in R's help page for
plotmath.
I uploaded a drawing
http://pj.freefaculty.org/R/Normal-2009.pdf
that is created by the following code
http://pj.freefaculty.org/R/Normal1_2009_plotmathExample.R
This will be a good addition to the plotmath help page/example.
2009 Mar 20
4
how to make aggregation in R ?
Hi,
I am trying to aggregate the sum of my test data.frame as follow:
testDF <- data.frame(v1 = c("a", "a", "a", "a", "a", "b", "b", "b", "b",
"b", "c", "c", "c", "c", "c", "d", "d", "d", "d",
2008 Apr 02
1
Trouble combining plotmath, bquote, expressions
I'm using R-2.6.2 on Fedora Linux 9.
I've been experimenting with plotmath.
I wish it were easier to combine expressions in plotmath with values
from the R program itself. There are two parameters in the following
example, the mean "mymean" and standard deviation "mystd". I am able
to use bquote to write elements into the graph title like
mu = mymean
and R will
2008 Nov 04
3
regex question
hello,
i am trying to extract text using regex as follows:
"* < <* this is my text > > "
into:
"this is my text"
below what I did:
varReg <- "* < <* this is my text > > "
## either this pattern
patReg <- "(^[ <*]+)"
## or below patten
patReg <- "([ > ]+$)"
sub(patReg, '', varReg)
depending
2009 Mar 17
2
converting null to some values
Hi,
I have newbie question. Suppose I have the following data:
temp <- data.frame(type1 = c("male", "female", "male", "female", "female"),
type2 = c("low", "med", "high", "low", "med"), a = c(1,2,4, NA, 3), b =
.... [TRUNCATED]
temp
type1 type2 a b c
1 male low 1 5 0
2 female
2005 Jun 16
1
AIC in glm.fit with intercept
Dear R users,
glm.fit() gave me the same AIC's regardless of TRUE or FALSE intercept option.
> myX <- as.matrix(1:10)
> myY <- 3+5*myX
> foo <- glm.fit(x=myX, y=myY, family = gaussian(link = "identity"), intercept=TRUE)
> foo$aic
[1] 38.94657
> foo <- glm.fit(x=myX, y=myY, family = gaussian(link = "identity"), intercept=FALSE)
> foo$aic
[1]
2010 Jan 27
1
control of scat1d tick color in plot.Predict?
Hi All,
I have a quick question about using plot.Predict now that the rms package
uses lattice. I'd like to add tick marks along the regression line, which
is given by data=llist(variablename) in the plot call. The ticks show up
fine, but I'd like to alter the color. I know the ticks are produced by
scat1d, but after spending a fair bit of time going through documentation,
it still
2008 Dec 23
1
aggregate / tranpose data
Dear R-Users,
Suppose I have data in the following format:
CODE_NAME ZIP_CODE
John 12345
John 23456
John 34567
Jane 13242
Jane 22123
I want to transpose / convert it into:
CODE_NAME ZIP_CODE
John 12345,23456,34567
Jane 13242,22123
Any idea/pointer is appreciated.
2011 Aug 18
1
Where are the ticks on grid.xaxis?
Hi R list,
I like the default ticks that are set up using grid.xaxis() or grid.yaxis()
with no arguments. Finding good values for the 'at' argument is usually not
a trivial task; the default behavior of these functions seems to work well.
The problem with this strategy is that I cannot figure out how to "recover"
the positions of these ticks when you do NOT specify the
2010 Jul 06
1
plotmath vector problem; full program enclosed
Here's another example of my plotmath whipping boy, the Normal distribution.
A colleague asks for a Normal plotted above a series of axes that
represent various other distributions (T, etc).
I want to use vectors of equations in plotmath to do this, but have
run into trouble. Now I've isolated the problem down to a relatively
small piece of working example code (below). If you would
2008 Apr 08
2
plotmath "overstrikes" in output on a Linux system
I've been testing plotmath. But I'm getting some funny output one one
computer. The problem is that characters are 'jumbled' and overstrike
when symbols are introduced.
Sample code:
mu <- 440.0
sigma <- 12.5
myx <- seq( mu - 4*sigma, mu+ 4*sigma, length.out=500)
myDensity <- dnorm(myx,mean=mu,sd=sigma)
# Here's one way to retrieve the values of mu and sigma and
2008 Oct 28
1
lattice: overlap histogram
Dear R users,
Is it possible to have an overlap histogram plot? For example:
stuff <- data.frame(Mode = c("Land", "Air"), AgeGroup = c("Young", "Adult",
"Old"), Value = sample(1:300))
histogram( ~Value | AgeGroup * Mode, data = stuff, auto.key = TRUE)
Instead of having 2 * 3 panel, I want to have just 3 panel, overlapping the
"Mode"
2009 Mar 25
1
Creating date seq in data frame
Hi,
I have the following type of data:
myData <- data.frame(x = 1:5, y = letters[1:5], xDate =
seq(as.Date("2001/2/1"), as.Date("2005/2/1"), by="year") )
> myData
x y xDate
1 a 2001-02-01
2 b 2002-02-01
3 c 2003-02-01
4 d 2004-02-01
5 e 2005-02-01
What I need is a new column, say xDate2, that for each xDate (or for each
unique combination of
2009 Apr 09
2
how to automatically select certain columns using for loop in dataframe
Hi,
I am trying to display / print certain columns in my data frame that share
certain condition (for example, part of the column name). I am using for
loop, as follow:
# below is the sample data structure
all.data <- data.frame( NUM_A = 1:5, NAME_A = c("Andy", "Andrew", "Angus",
"Alex", "Argo"),
NUM_B = 1:5, NAME_B =
2007 Jun 28
4
compare 2 vectors
Dear all,
I would like to take out the values from one vector that are equal to the values in another vector.
Example:
a <- c(1,2,3,4,5,6,7,8,9)
b <- c(3,10,20,5,6)
b_noRepeats = c(10,20)
So I would like to have the vector b without the same values as vector a.
Kind regards,
João Fadista
[[alternative HTML version deleted]]
2002 Mar 08
2
Sys.putenv environment variables disappear (PR#1371)
Environment variables set with Sys.putenv() disappear (i.e. become "")
after a while, especially after heavy-duty I/O. Example:
R> x <- matrix(1., 3000, 3000)
R> save(x, file="myx.RData")
R> Sys.putenv(HOME="/tmp")
R> while (Sys.getenv("HOME") != "") {cat("ok\n"); load("myx.RData")}
The loop prints
2006 Mar 23
2
[OT] Canada on Rails by ferry?
Hey y''all,
Are any folks planning on taking the ferry from Seattle to Vancouver
(via Victoria)? I''ve never done it before so I have no idea how much
of an adventure it is. Flights are a $100+ less to Seattle than
Vancouver so the price works out the same or a bit less. My plan is
to fly to Seattle (from Savannah, GA) on Tuesday to catch the early
ferry on Wednesday
2006 Nov 24
1
Error in Calling C++ function from R!!!
Hello,
I tried to call an external function of R from the following code in C++:
void prodgdot(double *x, double *y, int *n, double *output)
{
int i;
*output=0;
for (i=0;i<*n;i++)
{
*output+=x[i]*y[i];
}
}
I compiled it using from my working directory in linux terminal and I think
it's ok:
giba at giba-desktop:~/mysrc/meus_testes_iniciais$ R CMD SHLIB
2008 Oct 29
1
How to set read.table variables to vectors?
The summary stats for the xin and yin variables below are correct. However,
if I use plot(xin,yin), an exception is thrown saying that "object xin is
not found."
Also, it is apparent that I can't successfully replace the x and y vectors
with values from xin and yin.
The four plots on one panel are showing but the range of x and y is only
[0,1], and therefore, it seems like an