Displaying 20 results from an estimated 7000 matches similar to: "Apply() on columns"
2008 Dec 09
2
Need help optimizing/vectorizing nested loops
Hi,
I'm analyzing a large number of large simulation datasets, and I've
isolated one of the bottlenecks. Any help in speeding it up would be
appreciated.
`dat` is a dataframe of samples from a regular grid. The first two
columns are the spatial coordinates of the samples, the remaining 20
columns are the abundances of species in each cell. I need to calculate
the species richness in
2013 Feb 15
3
datos climáticos cambio de formato
Hola!!
tengo un data.frame donde cada fila corresponde a un año y cada columna a
un mes (De enero a diciembre)
> head(valT)
V2 V3 V4 V5 V6 V7 V8 V9 V10 V11 V12 V13
1941 18.0 16.3 15.2 10.1 8.1 8.3 8.8 9.2 7.9 12.2 11.9 14.6
1942 17.2 15.9 13.6 11.6 8.7 6.2 6.4 7.2 9.7 12.0 14.1 16.7
1943 17.6 17.3 13.5 12.5 10.5 7.0 8.2 7.9 -999.9 -999.9
2011 Jul 12
1
Avoiding loops to detect number of coincidences
Hi all,
I have this information on a file ht.txt, imagine it is a data frame without
labels:
1 1 1 8 1 1 6 4 1 3 1 3 3
And on other table called "pru.txt" I have sequences similar this
4 1 1 8 1 1 6 4 1 3 1 3 3
1 6 1 8 1 1 6 4 1 3 1 3 3
1 1 1 8 1 1 6 4 1 3 1 3 3
6 6 6 8 1 1 6 4 1 3 1 3 3
I want to now how many positions are identical between each row
in pru compared with ht.
n and m
2011 Jul 02
5
How many times occurs
Hi all,
I have a data matrix likein "input.txt"
8 9 2 5 4 5 8 5 6 6
8 9 2 8 9 2 8 9 2 1
8 9 2 5 4 5 8 5 6 4
8 9 2 5 4 5 8 5 6 6
8 9 2 8 9 2 8 9 2 1
8 9 2 5 4 5 8 9 2 2
In this example will be an 6x10 matrix (or data frame)
I want to detect how many times in a row appears this combination 8 follewd
by 9 followed by 2, and create a new matrix with only this number of occurs
then
2011 Aug 22
2
Duplicate Rows in xts
I read enourmous comment about this questions stating that it was answered before.?
I?have been looking for the answer for a week without luck !!!?
I searched the archives the xts. vignitte , googled for an answer but couldn't find one so her it is:
?
the Vignette states that xts "doesn't inforce the duplicate row requirement" but yet when I try to bring in tick stock data from
2010 Oct 04
3
How To Extract Row from A Data Frame
I have a data frame that looks like this:
> print(df)
V2 V3 V4 V5 V6 V7 V8 V9 V10 V11 V12
1 FN 8.637 28.890 31.430 31.052 29.878 33.215 32.728 32.187 29.305 31.462
2 FP 19.936 30.284 33.001 35.100 30.238 34.452 35.849 34.185 31.242 35.635
3 TN 0.000 17.190 16.460 21.100 17.960 15.120 17.200 17.190 15.270 15.310
4 TP 22.831 31.246 33.600 35.439 32.073
2009 Aug 27
5
Help on efficiency/vectorization
Dear R users,
I am trying to extract the rownames of a data set for which each columns
meet a certain criteria. (condition - elements of each column to be equal
1)
I have the correct result, however I am seeking for more efficient (desire
vectorization) way in implementing such problem as it can get quite messy if
there are hundreds of columns.
Arbitrary data set and codes are shown below for
2012 Jan 08
1
creating vectors from data-frames
I am having a problem with creating a vector from a rows or columns, I
searched around and found as.vector(x), but it does not seem to do what it
says it does
I have included an example below, of doing what would seem to be the method
required to create a vector, but instead it creates a one row data frame.
What is required to actually create a vector.
Many thanks
Philip
> data
2013 Apr 10
3
how to calculate average of each column
Hey All,
I have a large dataset and I want to calculate the average of each column
then return a new dataset.
Here is my question: I dont know if there is a function that can allow me
to calculate the average every 60 records of data in the whole dataset, and
return a new data frame. Not sure if I have to divide the dataset first for
every 60, then do the mean or can i directly do that.
thanks
2014 Jul 02
2
error al leer una linea desde un archivo de texto
A mi también me funciona para los dos casos:
> dat <- read.csv("d11-16.csv", header=FALSE, sep=",", dec=".", skip=11,
nrows=1)
> dat
V1 V2 V3 V4 V5 V6 V7 V8 V9 V10 V11
1 masa total en µg 30.04633 ug PEAKS MUY PEQUENOS NA NA NA NA NA NA NA
> dat18 <- read.csv("d11-18.csv", header=FALSE,
2013 Feb 28
1
help for an R automated procedures
Dear, I would like to post the following question to the r-help on Nabble (thanks in advance for the attention, Gustavo Vieira):
Hi there.
I have a data set on hands with 5,220 cases and I'd like to automate some
procedures (but I have almost no programming knowledge). The data has some
continuous variables that are grouped by 2 others: the name of species and
the locality where they were
2009 Jun 12
3
Replacing 0s with NA
Hello
I have a dataset in which I would like to replace 0s with NAs. There is a
lot of information on how to replace NAs with 0, but I have struggled to
find anything with regards to doing the reverse. Any recommendations would
be great.
Cheers
Christine
2004 Aug 03
4
How to select a whole column? Thanks!
Dear all,
I hope to remove a whole column from a data frame or matrix (> 2000
columns). All value in the column are same. The first thing is to
select those columns.
For instance, I hope to remove the V3~6 column, for all the value in
those colume is zero.
V3 V4 V5 V6 V7 V8 V9 V10
1 0 0 0 0 0.000 0.000 0.000 0.000
2 0 0 0 0 0.000 0.000 0.000 0.000
3 0 0 0
2011 Sep 01
2
how to plot a series of data in a dataframe?
hi
i have a dataframe with the name "obsdata"
V1 V2 V3 V4 V5 V6 V7 V8 V9 V10 V11 V12 V13
1 1001 3 24 12 24.7 44.4 70.1 49.3 33.7 3.0 6.8 2.7 NA
2 1001 3 25 0 70.1 49.3 33.7 138.2 152.5 NA 4.2 6.9 17.5
3 1001 3 25 12 33.7 187.7 286.5 386.7 NA 16.2 46.0 48.8 43.1
4 1001 3 26 0 88.6 129.4 NA NA
2005 Oct 28
3
replacing a factor value in a data frame
Hi All,
I have the following problem, that's driving me mad.
I have a dataframe of factors, from a genetic scan of SNPs. I DO have
NAs in the dataframe, which would look like:
V4 V5 V6 V7 V8 V9 V10
1 TT GG TT AC AG AG TT
2 AT CC TT AA AA AA TT
3 AT CC TT AC AA <NA> TT
4 TT CC TT AA AA AA TT
5 AT CG TT CC AA AA TT
6 TT CC TT AA AA AA TT
7 AT CC
2012 Aug 15
2
to remove columns and rows
Dear,
I am using R I'm trying to identify and remove columns and rows in a data
frame that are has elements equals. For example in dataframe below. The
columns 1, 2,3,4,5 ,6 and 10 (file1) has elements equal then should be
removed. How can I ask R to remove those columns with same elements in new
dataframe (file2) to result a matrix as follows:
file1
1 0 2 2 1 1 5 1 1 1
1 0
2005 Oct 13
1
expand.grid problem
Hi all,
I want to make all possible combination from dataset below:
V1 <- c(0,1,2)
V2 <- c(0,1)
V3 <- c(0,1)
V4 <- c(0,1)
V5 <- c(0,1)
V6 <- c(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20)
V7 <- c(0,1,2,3,4,5,6)
V8 <- c(0,1)
V9 <- c(0,1)
V10 <- c(0,1)
V11 <- c(0,1)
V12 <- c(0,1)
V13 <- c(0,1)
V14
2015 Aug 22
3
sprintf error: "only 100 arguments allowed"
I'm trying to apply a function defined in the VW R docs, that attemps to
convert a data.table object to Vowpal Wabbit format. In the process i'm
getting the error in printf mentioned in the subject.
The original function is here:
https://github.com/JohnLangford/vowpal_wabbit/blob/master/R/dt2vw.R
Below there is a small example that reproduces the error. The function
works great with
2011 Mar 14
2
code for "permutative" operation
Hello, I need some form of a "permutative" operation on a numeric
vector x
x = (v1, v2, v3, ..., vN)
that produces
x.r = (v1, v1+2, v1+v2+v3, ... v1+v2+...+vN)
If the operation is sum() I can run
x <- 5:8
m <- matrix(rep(x, length(x)), ncol=length(x))
(x.r <- rowsum(m * upper.tri(m, diag=TRUE), rep(1, length(x))))
But there's two things I don't know and kindly
2005 Jan 06
2
patterns of missing data: determining monotonicity
Here is a problem that perhaps someone out here has an idea about. It
vaguely reminds me of something
I've seen before, but can't place. Can anyone help?
For multiple imputation, there are simpler methods available if the
patterns of missing data are 'monotone' ---
if Vj is missing then all variables Vk, k>j are also missing, vs. more
complex methods required when the