Displaying 20 results from an estimated 20000 matches similar to: "algorithm help"
2005 Mar 11
2
Calculating lengths of runs of 0 or 1 sequences in meteorological data
Dear List Members,
I need some help about programming in S language. My
problem is as follows:
I have meteorological data (about rainfall measurement
each day from 1989-2002), say like
http://www.angelfire.com/ab5/get5/data.rainfall.txt
or http://www.angelfire.com/ab5/get5/R.rainfall.txt
in a sequence of 0(denoting dry day)'s and 1(denoting
wet day)'s. I want to construct a frequency
2023 Jun 01
1
bug in na.contiguous? Doesn't give the first tied stretch if it is at the start
Hi.
The description of na.contiguous says:
"Find the longest consecutive stretch of non-missing values in a
time series object. (In the event of a tie, the first such
stretch.)"
But this seems not to be the case if one of the tied longest stretches is at the start of the sequence/series. In the following example, there are three stretches of length 3, so I expect the result
2009 Jan 07
4
Another newbie question
Problem:
I have a data frame with 1s and 0s denoting presence/absence of species
(columns) for particular plot measurements (rows). What I want to do is make
a new column whose entries for each row is a list of the column names in
which a species is present (ie. for row one its entry might read:
"sp1","sp2", etc.). I've tried various functions etc. but can't seem to
2018 May 01
0
how can I convert a long to wide matrix?
Hi Marna,
This is a condition that the function cannot handle. It would be
possible to reformat the result based on the time intervals, but the
stretch_df function doesn't try to interpret the values, just
stretches them out to a wide format.
Jim
On Wed, May 2, 2018 at 9:16 AM, Marna Wagley <marna.wagley at gmail.com> wrote:
> Hi Jim,
> The data set is correct. I took two
2010 Jan 11
2
help needed to find zero areas in a vector
Dear Helpers:
I spend more than half a day to solve this problem in R:
Let x be a vector of a string of 0s and 1s, such as
x<-c(0,0,1,1,0,0,0,0,1,1,0,0,0,0). It can be a very long vector.
How to sub vectors of 0s? In the above example, I would like get the vectors (0,0), (0,0,0,0), (0,0,0,0).
I can use which(x==0) to get the index of the 0 elements, but I don't know how to get the
2008 Jul 18
1
finding "chuncks" of data that have no NA s
I have a data frame that is 122 columns and 70000ish rows it is a zoo
object, but could be easily converted or read in as something else. It is
multiparameter multistation water quality data - there are a lot of NA s. I
would like to find "chuncks" of data that are free of NA s to do some
analysis. All of the data is numeric. Is there a way besides graphing to
find these NA less
2018 May 01
2
how can I convert a long to wide matrix?
Hi Jim,
The data set is correct. I took two readings from the "SITE A" within a
short time interval, therefore I want to take the first value if there are
repeated within a same group of "timeGroup".
Therefore I wanted following
FinalData1
B1 B2
id_X "A" "B"
id_Y "A" "B"
thanks,
On Tue, May 1, 2018 at 4:05 PM, Jim
2010 Jun 25
1
Finding sets
Hi all,
I'd like to find how many sets of 1s there are in the following example;
x <- rep(c(1,2,1,3,5), each=5)
I know that there are two sets of 1s, visually. Any function in R that
allows me to automate the process?
Thanks.
Muhammad
2010 Apr 26
1
Dropping "trailing zeroes" in longitudinal data
Background: Our research group collected data from students via the web
about their drinking habits (alcohol) over the last 90 days. As you
might guess, some students seem to have lost interest and completed some
information but not all. Unfortunately, the survey was programmed to
"pre-populate" the fields with zeroes (to make it easier for students to
complete).
Obviously, when
2011 Jun 17
3
rle on large data . . . without a for loop!
I think need to do something like this:
dat<-data.frame(state=sample(id=rep(1:5,each=200),1:3, 1000,
replace=T,prob=c(0.7,0.05,0.25)),V1=runif(1,10,1000),V2=rnorm(1000))
rle.dat<-rle(dat$state)
temp<-1
out<-data.frame(id=1:length(rle.dat$length))
for(i in 1:length(rle.dat$length)){
temp2<-temp+rle.dat$length[[i]]
out$V1[i]<-mean(dat$V1[temp:temp2])
2010 May 25
1
Where to start debugging
Hi,
I''ve adopted a project that uses some rails features I''m not quite
used to yet. (ie merb, haml)
There is a snippet below. I''m not even sure what other part of the
code to include to help with this. I''m open to suggestions :)
$ merb
...
...
...
~ Compiling routes...
app/views/stretches/show.html.haml:87:in `send'': compile error
(SyntaxError)
2012 Sep 17
3
libshout crashing during pause
Hello. For various reasons I am writing my own source client.
Most things seem to be working well. Connections work. shout_send() and
shout_sync() seem to behave as expected.
However, I find that if more than about 10-20 seconds passes between
shout_send() calls then libshout crashes (takes my client down) during a
subsequent shout_send().
Are there any rules about how often shout_send()
2012 Jun 08
2
help with rle function on paired data
Dear R Community - I hope you might be able to provide some guidance
regarding the use of the rle function. I have a set of time-series data
where a measured value is recorded every 30 seconds after the start of an
experiment. Many of the measured values repeat and I am interested only in
the values when there is a change. If I turn the measured values into a
vector, the rle function works
2008 Aug 02
2
lapply, sapply
Hello everybody,
I have problem with a lapply command, which rather proves that I don't
fully understand it.
I want to extract from a list that consists of dataframes, the length
of the first sequences from a given variable (its part of a simulation
exercises).
Below is code which does the job, but I think it should be possible to
make it more compact.
### Example Data
dat <-list()
2013 Feb 18
1
Calculating seasonal anomalies
I have an irregular time series, which cannot easily be converted to a ts
object (long stretches with NA).
I have calculated the climatological mean and st.dev, but need help on how
to calculate the anomalies from the climatology and my original data set.
Below is an example, where I have indicated the basic idea of what I want to
do under Question 1 and 2. I assume I will have to create a custom
2019 Jan 20
2
Still hitting odd problems trying to install R 3.5.2 on Debian amd64 machine
My Emails a week or so back were about installing Rstudio and the R shiny server on Debian. I was using an old Toshiba laptop as a sandbox for that and it would only install i386 (same for Ubuntu). Using the information at https://cran.r-project.org/bin/linux/debian/ I did get to the point where I had R 3.5.2, Rstudio and the server on there (with some help from Dirk that is in the list archives).
2018 Mar 06
2
gluster debian build repo redirection loop on apt-get update on docker
When I follow the directions at
http://docs.gluster.org/en/latest/Install-Guide/Install/ to install
the latest gluster on a debian 9 docker container, I get the following
error:
Step 6/15 : RUN echo deb [arch=amd64]
https://download.gluster.org/pub/gluster/glusterfs/3.13/9/Debian/stretch/amd64/apt/
stretch main > /etc/apt/sources.list.d/gluster.list
---> Running in 1ef386afb192
Removing
2018 Mar 07
0
gluster debian build repo redirection loop on apt-get update on docker
On 03/06/2018 05:50 PM, Paul Anderson wrote:
> When I follow the directions at
> http://docs.gluster.org/en/latest/Install-Guide/Install/ to install
> the latest gluster on a debian 9 docker container, I get the following
> error:
Files in the .../3.13/3.13.2 directory had the wrong owner/group,
(rsync_aide). I'm not sure why, maybe an incomplete rsync? I've fixed
the owners
2006 Jan 23
1
--gui=Tk window does not stretch (PR#8520)
Full_Name: Greg Kochanski
Version: 2.2.0
OS: Debian Linux
Submission from: (NULL) (212.159.16.190)
When you grab the corner of the Tk-R (R's console) window,
the window stretches, but the useable area does not.
It remains firmly fixed at the (rather small) value of
24 lines.
In fact, you end up with a grey border of wasted pixels
around the active white area that contains the text.
(And,
2013 Jul 22
4
How to split two levels several times?
Hi,
I have a small problem with the function split() and would appreciate your help.
I have a table called ?XXX? with 2 columns and 49 rows. The 49 rows belong to 8 different levels (electrode1, ...,electrode8). I want to split the table always at the row where ?electrode1? starts again so that I can export 7 individual dataframes (numbered ?dataframe1? to ?dataframe7?) which contain always