Displaying 20 results from an estimated 4000 matches similar to: "how do I "relate" tables in R?"
2006 Feb 24
1
importing data from BUGS format to R?
For those who use WinBUGS (or for those who are just familar with this
format), I have a text file that looks like this (which is how R would
export data if you used the "structure" function):
y= structure(.Data= c(-6.93310E+01, 4.32870E+01, -6.96600E+01, 4.35730E+01,
-6.90150E+01, 4.35870E+01, -5.81060E+01, 4.52890E+01, -6.65590E+01,
4.34600E+01, -6.61850E+01, 4.35000E+01,
2006 Jun 08
2
Plotting female and male signs
Dear R-users,
Just like other users (as seen from previous posts on the list), I would
like to use female and male signs in plots. I found B. Ripley's post
about using Unicode characters. However, it doesn't works for me.
> text(locator(1),"\u2640") produces the following error:
Error: invalid \uxxxx sequence
But I can specify other Unicode characters as long I
2006 Feb 11
2
aggregate vs tapply; is there a middle ground?
Dear all,
I'm wanting to do a series of comparisons among 4 categorical variables:
a <- aggregate(y, list(var1, var2, var3, var4), sum)
This gets me a very nice 2-dimensional data frame with one column per
variable, BUT, as help for aggregate says, <<empty subsets are
removed>>. I don't see in help(aggregate) how I can change this.
In contrast,
a <- tapply(y,
2006 Feb 02
1
Conflict between julian from base and from chron
I used to run the julian function from chron but this new version of R has
also a julian function in the base package that doesn't do exactly what I
need. Is there a way of telling R to run the function from chron and not
from base?
Thanks,
Fernando
__________________________
Fernando Colchero
Doctoral Fellow
Duke University
Department of Ecology
2006 May 23
2
Environment problems
Dear list readers,
Can someone of you explain this behavior. Here's a toy example:
Start by constructing a function tmp
>fix(tmp)
In the default editor enter this one-liner:
hist(rnorm(10))
close the editor and run environment on the function.
> environment(tmp)
<environment: R_GlobalEnv>
Open the editor and remove the last parenthesis, this will make the
editor choke.
2001 Oct 25
2
How to save boot objects?
Hi,
I have problem with saving and later sourcing boot objects. A short
familiar example...
R : Copyright 2001, The R Development Core Team
Version 1.3.1 (2001-08-31)
...
> library(boot)
> data(city)
> ratio <- function(d, w)
+ sum(d$x * w)/sum(d$u * w)
> boot.res<-boot(city, ratio, R=999, stype="w")
> dump("boot.res","boot.res.R")
>
Save
2002 Jul 29
2
Bug or feature in xyplot?
Hi,
Can someone of you tell me why these two simple examples works as
"expected",
plot(c(1,1,2,2)~c(1,2,1,2),col=c(1,2,3,4),pch=c(1,2,3,4))
coplot(c(1,1,2,2)~c(1,2,1,2)|c("A","A","B","B"),col=c(1,2,3,4),pch=c(1,2,3,4
))
but when I try it with xyplot in the lattice package it fails.
2003 Aug 20
1
Filled triangles in lattice graphics?
Dear R users,
I can get a filled triangle pointing upwards by specifying pch=17 in
xyplot or lpoints, but how do I get a filled triangle that points downwards?
In the standard plot function it's possible to use
plot(x,y,pch=25,bg="black"), but bg= doesn't seem to work with lattice
and lpoints.
Thanks,
Hans Gardfjell
Ecology and Environmental Science
Ume? University, Sweden
2007 Oct 17
2
Need help with function that includes 2 summation
I am relatively new to R, so this may be a much simpler question than it
seems to me. I am trying to create a function that includes two
summations, and can't figure out how. I am attaching the equation as a
pdf file. This function will then be optimized over a chosen range of
values, but right now I just need help with the function. Thank you.
Zack Darnell
Duke University
--
Zack
2009 Nov 13
2
why the same values cannot be judged to be the same in R
Hi Rusers,
I found sometimes that the same values cannot be judged to be the same in
R. Anybody knows the probelm? I think i ignored some minor detail. Thanks.
Here is the example.
############
data1<-matrix(data=c(1,1.2,1.3,"3/23/2004",1,1.5,2.3,"3/22/2004",2,0.2,3.3,"4/23/2004",3,1.5,1.3,"5/22/2004"),nrow=4,ncol=4,byrow=TRUE)
2003 Apr 18
1
Problem with eigen() and LAPACK
Hi all,
when testing the new improvements in the new 1.7.0-version I stumbled
over the following:
>eigen(matrix(c(0,.3,2,.9),2,2))
Error in eigen(matrix(c(0,.3,2,.9),2,2)) :
LAPACK routine DGEEV gave error code -13
>eigen(matrix(c(0,.3,2,.9),2,2),EISPACK=TRUE)
$values
[1] 1.3458236 -0.4458236
$vectors
[,1] [,2]
[1,] -1.1436890 -0.9760443
[2,] -0.7696018
2002 Nov 21
1
Distance between points and a polygon?
Dear R users,
I know that this could easily be solved within a GIS-package, but
sometimes it's more convenient to use R. So here's my question anyway...
Does anyone of you know about any R-functions/code that calculates the
distance between a number points and a polygon or polyline? I have
looked thru the different libraries that deals with spatial statistics
but haven't found
2023 Jun 11
1
Problem with filling dataframe's column
Dear Rui;
Many thanks for your email. I used one of your codes,
"data2$LU[which(data2$Layer == "Level 12")] <- "Park"", and it works
correctly for me.
Actually I need to expand the codes so as to consider all "Levels" in the
"Layer" column. There are more than hundred levels in the Layer column.
If I use your provided code, I have to write it
2023 Jun 11
1
Problem with filling dataframe's column
?s 21:05 de 11/06/2023, javad bayat escreveu:
> Dear R users;
> I am trying to fill a column based on a specific value in another column of
> a dataframe, but it seems there is a problem with the codes!
> The "Layer" and the "LU" are two different columns of the dataframe.
> How can I fix this?
> Sincerely
>
>
> for (i in 1:nrow(data2$Layer)){
>
2023 Jun 11
1
Problem with filling dataframe's column
?s 22:54 de 11/06/2023, javad bayat escreveu:
> Dear Rui;
> Many thanks for your email. I used one of your codes,
> "data2$LU[which(data2$Layer == "Level 12")] <- "Park"", and it works
> correctly for me.
> Actually I need to expand the codes so as to consider all "Levels" in the
> "Layer" column. There are more than hundred
2008 Nov 05
2
how can I save the estimates of a regression model in a file?
Dear all
I need some help with R.
How can I save the estimates of a regression model in a file?
here is what I did:
1) this is my regression model:
fit1 <- lm(logmilk ~ logdays + days, data=data2)
2) however, I want to get the parameters estimates for each individual (by
group):
so i did the following:
by(data2, list(data2$V2),function(.data2) lm(logmilk ~ logdays + days, data=
.data2))
3)
2004 Feb 04
5
Date Time Conversion problems...
At one time (version 1.7), the code below used to work for converting and
extracting based on the Date Time. In version 1.8.1, something changed I
know, but I cannot for the life of me figure out what...
Data:
UserName,RequestDate,PO,OrderDate,ExpDelivDate,Vendor,Total
"Woody, Jim",12/19/2002,AP15063,1/7/2003,2/10/2003,Ames ,8570
"Harrold,
2011 Nov 16
3
plotting a double y axis when x and y lengths differ
Hello All,
Many thanks to the help I have received so far.
Here is an example data set I hope to plot
Data1
Year Data SE
1 2005 2 0.01
2 2006 4 0.01
3 2007 5 0.01
4 2008 2 0.01
5 2009 3 0.01
6 2010 6 0.01
Data2
Year Data SE
1 2006 32 1
2 2007 100 2
3 2008 60 4
4 2009 67 3
5 2010 8 1
Notice Data2 has one less years worth of data than Data1 (which is my
2008 Aug 21
1
problem merging two data sets ( one with a header and one without)
I have two set of data, Data1 and Data2 . Data1 has a header and Data2 does
not. I would like to merge the two data sets after removing some columns
from data2 .
I am having a problem merging so I had to write and read final data and
specify the ?header=F? so the merge can be done by?V1?. Is there a way to
avoid this step. The problem is when I do cbind the FinalData has different
column names
2023 Jun 11
2
Problem with filling dataframe's column
Dear R users;
I am trying to fill a column based on a specific value in another column of
a dataframe, but it seems there is a problem with the codes!
The "Layer" and the "LU" are two different columns of the dataframe.
How can I fix this?
Sincerely
for (i in 1:nrow(data2$Layer)){
if (data2$Layer == "Level 12") {
data2$LU == "Park"