Displaying 20 results from an estimated 10000 matches similar to: "Count of rows while looping through data"
2009 Jul 30
3
Looping through R objects with $ operator and tags
Hi all,
Suppose I want to set the values in a column to the log of the values
of another column like so:
object$LogDist <- log10(object$Distance)
How do I loop through the objects if I have object1, object2, etc to
perform this function?
object1$LogDist <- log10(object1$Distance)
object2$LogDist <- log10(object2$Distance)
object3$LogDist <- log10(object3$Distance)
I was trying to
2010 Mar 09
2
looping through predictors
Dear R-ers,
I have a data frame data with predictors x1 through x5 and the
response variable y.
I am running a simple regression:
reg<-lm(y~x1, data=data)
I would like to loop through all predictors. Something like:
predictors<-c("x1","x2",... "x10)
for(i in predictors){
reg<-lm(y~i)
etc.
}
But it's not working. I am getting an error:
Error in
2010 Oct 28
2
Determining a basal correct count
Here's another interesting problem: if you recall I have a data frame (LCvars1) that consists of about 1500 cases (rows) of data from kids who took a test of listening comprehension. The columns are their scores (1 = correct, 0 = incorrect, . = missing) on 140 test items. The items are numbered sequentially and are ordered by increasing difficulty as you go from left to right across the
2010 Jul 14
1
rows process in DF
I have the following datasets:
id d1 d2 d3 d4 d5 d6 d7 d8
1 100 0.3 0.4 -0.2 -0.3 0.5 0.6 -0.9 -0.8
2 101 0.3 0.4 0.5 0.6 -0.2 -0.4 -0.5 -0.6
what I am trying to accomplish:
loop through the rows && do the following:
if the values from the columns of the current row >0 then
sum_positive=total
if the values from the columns of the current row <0 then
2011 Feb 17
2
sort by column and row names
Hello, All,
How can one sort on column and row names. For example:
How can this
X1 X3 X2
X1 1 0 0
X3 0 1 0
X2 0 0 1
become this?
X1 X2 X3
X1 1 0 0
X2 0 1 0
X3 0 0 1
Thank you for your time!
Jim
[[alternative HTML version deleted]]
2010 Mar 16
1
nested looping functions and dataframes
Hey All,
So, I am confused how exactly to use nesting loop functions in R to spit out
data frames. I've managed to create a working function for my data set that
generates a data frame for a given set of Year i and Location j; but how
would I do it for all Years and Locations?
Here is my working function:
test<-function(i,j){
a<-x[which(x$Year==i & x$Location==j),]
2011 Jul 24
2
Deleting rows and store the deleted rows in new data frame
Dear all,
I am using grep but I did not understand the problem as I am doing something wrong.Please help me.
I am using this code-
sf=data.frame(sapply(df[],function(x) grep('\\.&\\,', df[,9])))
the thing is i have a data frame(df) like this-
10 135349467 g G 4 0 0 5 ,,,.,
10 135349468 t T 2 0 0 5 ,,c.,
10 135349469 g G 7 0 0 5 ,,a.,
10 135349470 c C 8 0 0 5 ,,,.,
10 135349471
2010 Oct 07
3
aggregate text column by a few rows
Hi, R function aggregate can only take summary stats functions, can I
aggregate text columns? For example, for the dataframe below,
> a <- rbind(data.frame(id=1, name='Tom',
hobby='fishing'),data.frame(id=1, name='Tom',
hobby='reading'),data.frame(id=2, name='Mary',
hobby='reading'),data.frame(id=3, name='John',
2011 Feb 26
2
how to remove rows in which 2 or more observations are smaller than a given threshold?
Hello
The data set I am examining has 7425 observations (rows with unique
identifiers) and 46 samples(columns).
I have been trying to generate a dataset that filters out observations
that are "negligible"
The definition of "negligible" is absolute value less or equal to 1.58.
The rule that I would like to adopt to create a new data is: drop rows
in which 2 or more
2009 Oct 04
2
Row to Column help
Dear R Community,
I am attempting to transpose a dataset from rows to columns but am stuck. I
have tried using reshape() with little luck, possibly due to the categorical
nature of the data. For example:
id<-c(1,2,2,3,3,3)
author<-c("j","k","k","l","l","l")
2006 Sep 18
2
merge gives me too many rows
Hi,
I am using merge to add some variables to an existing dataframe. I
use the option "all.x=F" so that my final dataframe will only have as
many rows as the first file I name in the call to merge.
With a large dataframe using a lot of "by" variables, the number of
rows of the merged dataframe increases from 177325 to 179690:
>dim(test)
[1] 177325 9
>
2010 Aug 03
4
[Xen-API] New XCP Management Tool
XCP Users:
I received an email from Alberto Gonzalez Rodriguez who created OpenXenCenter/OpenXenManager and is now working on OpenXenWebManager. Info to access the tool is:
steps to test are:
download from http://bit.ly/bres2U
uncompress: tar xvfz xenwebmanager_rev24_full.tar.gz cd xenwebmanager python frontend.py
and with a browser open http://localhost:8080 (or http://ip:8080) you need
2013 Feb 03
1
Looping through rows of all elements of a list that has variable length
Dear R-ers,
I have a list of data frames such that the length of the list is unknown in
advance (it could be 1 or 2 or more). Each element of the list contains a
data frame.
I need to loop through all rows of the list element 1 AND (if applicable)
of the list element 2 etc. and do something at each iteration.
I am trying to figure out how to write a code that is generic, i.e., loops
through the
2010 Sep 10
4
Counting occurances of a letter by a factor
I'm trying to find a more elegant way of doing this. What I'm trying to accomplish is to count the frequency of letters (major / minor alleles) in a string grouped by the factor levels in another column of my data frame.
Ex.
> DF<-data.frame(c("CC", "CC", NA, "CG", "GG", "GC"), c("L", "U", "L",
2010 Jul 08
8
XCP Management Tools Inquiry
XCP Users:
As many of you are aware, there are several open source products available for everyone to use when working with XCP. I would like to get some feedback on the various tools to get a feeling on how people are using XCP and these tools.
Here are the tools that I am aware of (please respond if you are using another tool):
* OpenXenManager -
2010 Dec 07
3
Changing names of a string variable
Hello,
Here is the data set I am working with:
dat=read.csv('http://dl.dropbox.com/u/1852742/relexpressions.csv')
names(dat)
#Under the 'target' column, I want to change all of the values into
all capital letters (e.g. fgf2 becomes FGF2). I have taken a loop
approach but I think my Python background is confusing me. Here is
what I attempted:
for(line in
2010 Feb 11
9
XCP Downloading and Xen.org
Xen Community:
As you are aware, the Xen Cloud Platform has been available for download since last November and is becoming a very successful release for Xen.org. In fact, we are seeing substantial network traffic for this solution as we had 26 TB of data from XCP downloads in the past 4 weeks. Of course, this amount of traffic is forcing a re-examination of our co-location agreements as we are
2010 Feb 11
9
XCP Downloading and Xen.org
Xen Community:
As you are aware, the Xen Cloud Platform has been available for download since last November and is becoming a very successful release for Xen.org. In fact, we are seeing substantial network traffic for this solution as we had 26 TB of data from XCP downloads in the past 4 weeks. Of course, this amount of traffic is forcing a re-examination of our co-location agreements as we are
2010 Jun 22
4
XCP Community Meeting #2
Team:
It is time to start thinking about our 2nd XCP meeting for the Xen.org XCP team. The last meeting was held on May 25, 2010 at 14:00 UTC. Notes are at http://wiki.xensource.com/xenwiki/XCP_Monthly_Meetings. For the next meeting I hope to schedule a time that is better for our Asian participants so please contact me with a time that would be best if you live in Japan, Korea, Australia, etc.
2010 Jun 22
4
XCP Community Meeting #2
Team:
It is time to start thinking about our 2nd XCP meeting for the Xen.org XCP team. The last meeting was held on May 25, 2010 at 14:00 UTC. Notes are at http://wiki.xensource.com/xenwiki/XCP_Monthly_Meetings. For the next meeting I hope to schedule a time that is better for our Asian participants so please contact me with a time that would be best if you live in Japan, Korea, Australia, etc.