%in% instead of ==
?"%in%"
Cheers,
Bert
Bert Gunter
"The trouble with having an open mind is that people keep coming along and
sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
On Mon, Jul 9, 2018 at 3:35 PM, Bhaskar Mitra
wrote:
> Hello Everyone
Hello Everyone,
I am trying to create a subset of a data frame (df1) based on the first
three
unique values in the first column (v1).
Here are my codes:
b <- unique(df1$v1)[1:3]
df2 <- subset(df1,df1$v1==b)
df1:
v1 v2v3
1 ab
1 a1 b1
2 a2 b2
2 a3 b3
3 a4 b4
Dunno.
But if I understand correctly, here's a base R way to do it:
(## using your m)
> m$total <- with(m,ave(score,id,FUN = cumsum))
> m
id score total
1 1 6 6
2 1 612
3 2 6 6
4 2 3 9
5 3 3 3
6 3 3 6
Cheers,
Bert
Bert Gunter
"The tro
Hi Laura,
Here's a basic method:
lsdf<-read.table(text="Bird Date Latitude Longitude
eb80976 16/07/2012 50.99 -5.85
eb80976 17/07/2012 52.09 -4.58
eb80976 18/07/2012 49.72 -5.56
eb80976 19/07/2012 51.59 -3.17
eb80976 20/07/2012 52.45 -2.03
eb80976 21/07/2012
Strange. Worked fine on:
R version 3.4.2 (2017-09-28)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Debian GNU/Linux 9 (stretch)
Commands:
m <- data.frame( id = rep(1:3, each=2), score = rep(c(6,3), each=3) )
as.data.frame(m %>% group_by(id) %>% mutate(total = cumsum(score)))
id scor
Hi Folks,
I am trying to get a group_by cumsum using:
R version 3.5.0 (2018-04-23) -- "Joy in Playing"
Copyright (C) 2018 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Here is an example of a simple construct that is not working.
m <- data.frame( id = r
perhaps geom_path rather than geom_line?
On July 9, 2018 12:40:15 PM PDT, Hasan Diwan wrote:
>https://imgur.com/a/0f72Fsz results from the following code:
>
>ggplot()+borders("world", colour="gray50",
>fill="gray50")+geom_line(aes(x=Longitude, y=Latitude), birds)
>
>It's ugly, but it will give yo
Dear all,
In the end I try to run a system dynamics simulation in R using the package
deSolve.
Therefore I need an auxiliary list (auxs) the model can refer to when it the
functions need an auxiliary value.
I used a manual list:
auxs <- c( aSplitSN=0.4 , aSplitLN=0.6, aSplitSR1=0 , aSplitLR1=
https://imgur.com/a/0f72Fsz results from the following code:
ggplot()+borders("world", colour="gray50",
fill="gray50")+geom_line(aes(x=Longitude, y=Latitude), birds)
It's ugly, but it will give you a starting point. -- H
On Mon, 9 Jul 2018 at 10:53, Laura Steel wrote:
>
> I am a beginner to R an
Laura:
1. We generally do not do code for you; we expect you to show your efforts
first.
2. You might want to post this on the r-sig-geo list instead. They
specialize in such issues, so that you are more likely to find helpful
advice there.
3. There are many good R tutorials on the web. e.g. see
You'll probably get a more detailed reply from someone with more expertise,
but have you looked at something like what this article proposes:
https://medium.com/fastah-project/a-quick-start-to-maps-in-r-b9f221f44ff3
On Mon, Jul 9, 2018 at 1:53 PM Laura Steel
wrote:
> I am a beginner to R and I
Hi Kevin.
Maybe?
setwd("C:/RPractice")
write_csv(yourfile, path = "yourfile.csv")
yourfile <- read.csv("yourfile.csv")
HTH
WHP
On Monday, July 9, 2018, 10:42:24 AM EDT, Kevin Thorpe
wrote:
Hi.
I have some data frames I created previously that seem to not be working
correctly anymore.
I am a beginner to R and I need to map some Atlantic puffin migration routes
onto a map of the Northern Hemisphere. I have a latitude and longitude point
per bird, per day. I would like to be able to plot the routes of all my
birds on one map and ideally so that I can see at which date they are at
Thanks Jeff and all others.
I will need to use the tempfile route I guess (I'm running in a Linux OS) for
the time-being.
After I re-loaded the data frames that were broken before and they seemed fine,
after using them for awhile they broke again.
I am trying to build my analysis with rmarkd
TL;DR: If you want to do this, go ahead and use a temporary file or text
connection.
Others have pointed out that write.csv returns NULL rather than a file
connection, but I haven't seen comments on your impulse to avoid the use of
files.
*nix operating systems are admirably efficient with mul
>I tried something like read.csv(write.csv(df,row.names=FALSE)) but got
the error
>
> Error in read.table(file = file, header = header, sep = sep, quote =
quote, :
> 'file' must be a character string or connection
To diagnose this without reading the help(write.csv) look at the return
value of
> On Jul 9, 2018, at 8:44 AM, Kevin Thorpe wrote:
>
> So, after I sent the initial email I quit that R session entirely. When I
> started it again to try an provide the example data, the original (that I had
> a problem with before) is now behaving itself. Grrr.
>
> Now no one is going to be
So, after I sent the initial email I quit that R session entirely. When I
started it again to try an provide the example data, the original (that I had a
problem with before) is now behaving itself. Grrr.
Now no one is going to believe I ever had a problem with the data. :-)
--
Kevin E. T
Can you not anonymize column names, add random noise to some of the
columns, etc. ?
-- Bert
Bert Gunter
"The trouble with having an open mind is that people keep coming along and
sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
On Mon, Jul 9, 2018 a
Or (perhaps preferably) "US/Pacific" for daylight savings time support.
--
Don MacQueen
Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062
Lab cell 925-724-7509
On 7/9/18, 1:46 AM, "R-help on behalf of Jeff Newmiller"
wrote:
Several of the "c
Although your suggestion to provide the data is excellent and one I typically
agree with, they data are currently unpublished and so should not be publicly
available. I have tried to make a reproducible example in the past (when
similar looking things happened), but was unable to. Maybe I'll try
Hi Kevin,
It's good that you provided the background to the problem.
Rather than asking this list to "debug" your proposed solution, I think you
would be better off showing some of the "corrupted" data frame and ask for
suggestions how to deal with it.
(Suggestions may or may not match your initial
Hi.
I have some data frames I created previously that seem to not be working
correctly anymore. I *think* the problem is that some of the variables in the
data frame are of a type called labelled. There are other attributes in the
data frame as well. I thought that the easiest way to fix this w
You should probably post this on the r-sig-mixed-models list instead, where
you are more likely to find the expertise to diagnose the problem and give
you a helpful response.
Cheers,
Bert
Bert Gunter
"The trouble with having an open mind is that people keep coming along and
sticking things int
Dear Jeff,
thank you for all your time, and very precious help.
with best regards.
-- bogdan
On Mon, Jul 9, 2018 at 1:41 AM, Jeff Newmiller
wrote:
> Thank you for making the effort... but most attachments get stripped on
> the mailing list. Using the reprex package as I suggested and putting
Dear R folk
I am trying to run a series of models on distance data for three different
species of animals. My data are not zero-inflated (distances were recorded
for locomotion only and so if the animal didn't move, it wasn't recorded)
and are Poisson distributed. However, all of the models that I
My default is set as GMT.
On Mon, Jul 9, 2018 at 4:01 PM David Wolfskill wrote:
> On Mon, Jul 09, 2018 at 03:52:02PM +0530, Christofer Bogaso wrote:
> > Hi,
> >
> > Below is my code :
> >
> > library(zoo)
> > Dat1 = structure(c(17890, 17770.01, 17600, 17593, 17630.01), index =
> > structure(c(15
I found the following at
https://stackoverflow.com/questions/25269425/merge-zoo-removes-time-zone
library(xts)
merge2=function(x,y) {
as.zoo(merge(as.xts(x), as.xts(y)))}
If you define the function merge2() as above then
merge2(Dat1,Dat2)
should be ok
HTH,
Eric
On Mon, Jul 9, 2018 at 1:22
On 09/07/2018 6:18 AM, Steven Yen wrote:
I have had trouble installing packages (e.g., car, aod) in some
computers (such as computers in the student lab) but no problem in my
own laptop.
Installation typically goes through, but after I got out and back in R
(and RStudios), the error message says
I have had trouble installing packages (e.g., car, aod) in some
computers (such as computers in the student lab) but no problem in my
own laptop.
Installation typically goes through, but after I got out and back in R
(and RStudios), the error message says "packages xxx not available".
That is,
Hi,
Below is my code :
library(zoo)
Dat1 = structure(c(17890, 17770.01, 17600, 17593, 17630.01), index =
structure(c(1512664740,
1512664800, 1512664860, 1512664920, 1512664980), class = c("POSIXct",
"POSIXt"), tzone = "America/Los_Angeles"), class = "zoo")
Dat2 = structure(c(15804.28, 15720.61, 1
Several of the "conventional" three letter timezone abbreviations actually
get re-used in different parts of the world, and not all operating system
support for timezones include the same shortcuts. The solution is to use
the correct timezone string rather than your familiar shortcut... you can
Thank you for making the effort... but most attachments get stripped on
the mailing list. Using the reprex package as I suggested and putting the
result into the email is by far the safest approach. Since I received your
email directly, I did get the attachments. Below is my reproducible
exampl
Hi,
I wanted to convert Epoch time to readable time with US Pacific Time Zone
using 'anytime' package, as below:
> library(anytime)
> anytime(1417411980, tz = 'PST')
[1] "2014-12-01 05:33:00 GMT"
Warning message:
In as.POSIXlt.POSIXct(x, tz) : unknown timezone 'PST'
However it appears that R co
34 matches
Mail list logo