Displaying 20 results from an estimated 4000 matches similar to: "Selecting section of matrix"
2011 Aug 22
1
Selecting cases from matrices stored in lists
Hi,
I have two lists (c and h - see below) containing matrices with similar
cases but different values. I want to split these matrices into multiple
matrices based on the values in h. So, I did the following:
years<-c(1997:1999)
for (t in 1:length(years))
{
year=as.character(years[t])
h[[year]]<-sapply(colnames(h[[year]]), function(var)
2011 Aug 25
3
Selections in lists
Hi,
I have produced a list g and I would like to reduce the amount of
information contained in each object in g.
For each matrix I would like to keep the values where the column name equals
g[year][[1]][[x]] and the row names equals g[year][[1]][[-x]]. So in
g$`1999`$`8029`, year = 1999 and x = 8029. I have been experimenting with
the subset function, but have been unsuccesful. Thanks for your
2011 Jun 02
2
Counting occurrences in a moving window
Hi list, based on the following data.frame I would like to create a variable
that indicates the number of occurrences of A in the 3 years prior to the
current year:
DF = data.frame(read.table(textConnection(" A B
8025 1995
8026 1995
8029 1995
8026 1996
8025 1997
8026 1997
8025 1997
8027 1997
8026 1999
8027 1999
8028 1995
8029 1998
8025 1997
8027 1997
8026 1999
8027 1999
2011 Apr 29
4
For loop and sqldf
Hi list,
Can anyone tell my why the following does not work? Thanks a lot! Your help
is very much appreciated.
DF = data.frame(read.table(textConnection(" B C D E F G
8025 1995 0 4 1 2
8025 1997 1 1 3 4
8026 1995 0 7 0 0
8026 1996 1 2 3 0
8026 1997 1 2 3 1
8026 1998 6 0 0 4
8026 1999 3 7 0 3
8027 1997 1 2 3 9
8027 1998 1 2 3 1
8027 1999
2011 Apr 14
1
Create matrices for time series
Hi list, I would like to use the following data.frame to generate matrices
over a 3 year moving window:
DF = data.frame(read.table(textConnection(" A B C
80 8025 1995
80 8026 1995
80 8029 1995
81 8026 1996
82 8025 1997
82 8026 1997
83 8025 1997
83 8027 1997
84 8026 1999
84 8027 1999
85 8028 1995
85 8029 1998"),head=TRUE,stringsAsFactors=FALSE))
Function to be
2011 May 26
1
Divide matrix into multiple smaller matrices
Hi list,
Using the script below, I have generated two lists (c and h) containing
yearly matrices. Now I would like to divide the matrices in c into multiple
matrices based on h. The number of matrices should be equal to:
length(unique(DF1$B))*length(h). So each unique value in DF1$B get's a
yearly matrix. Each matrix should contain all values from c where element
cij is 1. An example for
2011 Jun 14
1
Multiply list objects
Hi,
I am trying to use the objects from the list below to create more objects.
For each year in h I am trying to create as many objects as there are B's
keeping only the values of B. Example for 1999:
$`1999`$`8025`
B
B 8025 8026 8027 8028 8029
8025 1 1 1 0 0
8026 1 0 0 0 0
8027 1 0 0 0 0
8028 0 0 0 0 0
8029
2012 Jul 19
3
Maintaining Column names while writing csv file.
Dear R helpers,
I have one trivial problem while writing an output file in csv format.
I have two dataframes say df1 and df2 which I am reading from two different csv files.
df1 has column names as date, r1, r2, r3 while the dataframe df2 has column names as date, 1w, 2w.
(the dates in both the date frames are identical also no of elements in each column are equal say = 10).
I merge these
2020 Oct 06
2
Version controlled (git) Maildir generated by Dovecot
Hi Everybody,
I'd like to start archiving e-mails by moving them to a server with running Dovecot.
I installed "dovecot-core" and "dovecot-imapd" (version 2.3.4.1) on Debian 10.
One of a few configurations I made is to use Maildir:
# grep '^mail_location = ' /etc/dovecot/conf.d/10-mail.conf
mail_location = maildir:~/Maildir
I successfully moved some e-mails (at
2012 Mar 14
4
Merging fully overlapping groups
Hi,
I have data on individuals (B) who participated in events (A). If ALL
participants in an event are a subset of the participants in another event I
would like to remove the smaller event and if the participants in one event
are exactly similar to the participants in another event I would like to
remove one of the events (I don't care which one). The following example
does that however it
2003 Feb 06
4
Lost writes upon disk power failure
Hi,
I'm encountering a strange situation.
I'm writing to an ext3 filesystem mounted like this:
/dev/scsi/host2/bus0/target0/lun0/part3 on /tmp/volumes/md0 type ext3 (rw,noatime,data=ordered)
with the physical device being a FC-connected RAID (IBM DF4000)
no software raid personality is used
I'm using 2.4.18-19.7
My test program writes files in a loop, with the essential system
2012 Nov 01
7
Reduce(paste, x) question
I have a question about the Reduce function:
x <- list()
x[[1]] <- LETTERS[1:5]
x[[2]] <- LETTERS[11:15]
Reduce(paste, x)
[1] "A K" "B L" "C M" "D N" "E O"
How do I get this?:
[1] "A" "K"
[2] "B" "L"
[3] "C" "M"
[4] "D" "N"
[5] "E" "O"
2003 Mar 24
1
how to show a section of a matrix neatly (or row by row) that satisfies some condition
Hi all,
I want to show the rows of a matrix (100x3) of which some of its elements satisfy a certain condition. In particular, how can I display the 2 rows of my matrix one after the
other and not all all elements of column 1 first, then column 2 and so on. See the following.
> finest[finest[,1] > 10^3]
[1] 4.960632e+13 3.612619e+04 7.668204e+12 1.001911e+04 8.886153e-01
[6]
2010 Aug 11
3
samba 4 dns-update issue
Hi all,
I've setup samba4 according to the samba4 wiki on centOS 5.4 in KVM.
This went without any problems. I only had to install a higher version of
bind to 9.6.x because Centos bind in repo will install version 9.3.x.
I've used the Fedora12 source rpms for this to build bind 9.6.x on Centos
5.4.
Then I configured bind according to the samba wiki
2007 Dec 01
1
rsync --delete problems
For some time I have been using rsync to backup data between different
machines and my NAS drive.
But within the last 2 days I have found out that rsync is not removing old
files from destination - directories renamed or removed from source.
In this example I want to sync files on my Debian Linux server to a NAS
drive. NAS drive is mounted using smbmount.
Using "-avhzn" dry-run it
2020 Oct 07
0
Version controlled (git) Maildir generated by Dovecot
Hello Adam, and the dovecot list
Just a question, I hate to pollute the thread, so feel free to push these
questions into a new thread if deemed necessary. So as you can guess I'm a
bit of a newb here, so rather obvious questions are about to arrive....
As you are using GIT for your archive (which is a cool idea by the way) I'm
sure you are well aware that not all files types play nicely
2010 Feb 05
1
Strange "rownames"
I find one row in my large dataset. But when I use the "rownames" for the
data on the 100,000 row, the result show nothing.
I try it by the following example, it still likes that.
> tst[rownames(tst)==100000,]
[1] x y
<0 rows> (or 0-length row.names)
##############
> tst=data.frame(x=1:200000,y=200000:1)
> tst[rownames(tst)==1,]
x y
1 1 200000
>
2004 Aug 25
1
brlr function
Hi,
I'm trying the brlr function in a penalized logistic regression function.
However, I am not sure why I am encountering errors. I hope to seek
your advice here. (output below)
Thank you! Your help is truly appreciated.
Min-Han
#No error here, the glm seems to work fine
>
2005 Feb 10
3
question about sorting POSIXt vector
Dear useRs,
How come the first attempt to sort a POSIXt vector fails (Error:
non-atomic type in greater), while the second succeeds? (Code inserted
below.) The documentation says that POSIXt is used to allow operations
such as subtraction, so I'd expect sorting to work. Is this perhaps an
OS issue? (I run R 2.0.1 on Win xp.)
Thank you,
b.
#------------code
test <- c("2005-02-08
2010 Dec 04
2
Error in calcCurveGrob(x, x$debug) : End points must not be identical
Hi All... I haven?t found mention of this error anywhere. I'm trying to
draw spline curves using grid graphics. Most of the time, I have no
problems, but I have some data sets that give the error in the subject line.
I'm not sure which end points are identical, but the end points passed to
the function are definitely not identical.
Any assistance appreciated! Bryan
tst <-