Displaying 20 results from an estimated 600 matches similar to: "Multiple lapply get-around"
2001 May 16
2
Strange formatting
I've never noticed this before, though it's probably not new. In
1.2.3 for Windows, if I print a short vector the formatting is
different than if I print a long one, whether or not they fit on one
line. The short/long split appears to be between 9 and 10 elements:
> 1:9
[1] 1 2 3 4 5 6 7 8 9
> 1:10
[1] 1 2 3 4 5 6 7 8 9 10
> sqrt(1:9)
[1] 1.000000 1.414214
2011 Feb 03
2
"Matrix' with Functions
Dear R members,
I have a quite large of function that are named like that
f11,f12,...f15
f21,f22,...f25
..
f51,f52,...f52
These are static (hard-coded) functions that the only common they have is that they take the same number and type of input fij(a,b,c,d). As you might understand this is really close to the notion of matrix only that my 'matrix' contains functions. It would be great if
2004 Jun 14
2
CVnn2 + nnet question
Hi,
I am trying to determine the number of units in the hidden layer
and the decay rate using the CVnn2 script found in MASS directory
(reference: pg 348,MASS-4).
The model that I am using is in the form of Y ~ X1 + X2 + X3...
+ X11 and the underlying data is time-series in nature.
I found the MASS and nnet package extremely useful (many thanks
to the contributors).
However I am getting
2004 Apr 20
2
Rank - Descending order
Dear All,
Is there any simple way to way to produce "rank", for a given
list, but in a descending order?
E.G:
x = list(a=c(1,5,2,4));
rank(x$a); produces 1,4,2,3
However I am looking for a way to generate (4,1,3,2).
It would be particularly nice if the proposed solution has all
the niceties of rank function (like NA handling and ties.method
functionality)
TIA
Manoj
2012 Aug 10
2
Zoo object problem: Find the column name of a univariate zoo object
Hi everyone and Achim,
Achim, I appreciate your help about the function "NCOL". When I use
"NCOL" instead of "ncol", I can find out the number of columns (number of
time series) in the presence of only one time series (one variable, one
column).
Now I want to know how I can find out the column names of the zoo
objects? In case of more than one time series, the
2004 Jun 09
1
Multiple regression
Hi,
I am trying to do multiple regression on a set of data using backward stepwise regression....however backward stepwise regression is critised for overfitting data. To actually observe the bias and to come up with a better method to use..Could you all stats experts kindly give me pointers to any alternative procedure (or references) to use over backward stepwise regression from your
2004 Nov 19
2
Performing regression using R & C
Dear All,
Is it possible to perform OLS using C code? I am trying to
optimize a n-period "moving window" OLS on a huge dataset hence was
wondering if such a thing is possible.
Ideally the solution that I am looking for would involve a
C-code accepting two float arrays and returning back computed parameters
such as t-stat, coefficient etc.
I have glanced thru the FAQ's and tried
2011 Sep 25
4
Trouble creating and adjacency matrix
Hello all,
I'm having trouble creating an adjacency matrix.
Basically, I need to turn the following distance matrix into an adjacency
matrix based on whether values are >1.5 or not. If they are >1.5, then the
returned value should be 0. If they are =<1.5, then the returned value
should be 1.
DistanceMatrix:
A B C D E
[1,]
2011 Sep 26
3
Nearest neighbour in a matrix
Hello all,
I am brand new to R and doing an exercise for a class. I need to find the
nearest neighbour for points in the following matrix:
> DistanceMatrix
x1 x2 x3 x4 x5
[1,] 0.000000 2.828427 1.581139 2.236068 2.000000
[2,] 2.828427 0.000000 1.581139 4.123106 2.000000
[3,] 1.581139 1.581139 0.000000 2.549510 2.121320
[4,] 2.236068 4.123106 2.549510
2012 Aug 09
1
Zoo object problem: problem when I attempt to create a zoo object of only one column
Hi,
Part of my program is to calculate the number of time series in a zoo
object. It works well if it has more than one time series, but it fails if
it has only one. How can I access the number of column (i.e. the number of
time series) when I have only one column? Why is the number of an object of
only one object "NULL"? It should be one, shouldn't it? (The following
example
2011 Dec 02
1
1.6x speedup for requal() function (in R/src/main/unique.c)
Hi,
FWIW:
/* Taken from R/src/main/unique.c */
static int requal(SEXP x, int i, SEXP y, int j)
{
if (i < 0 || j < 0) return 0;
if (!ISNAN(REAL(x)[i]) && !ISNAN(REAL(y)[j]))
return (REAL(x)[i] == REAL(y)[j]);
else if (R_IsNA(REAL(x)[i]) && R_IsNA(REAL(y)[j])) return 1;
else if (R_IsNaN(REAL(x)[i]) && R_IsNaN(REAL(y)[j])) return 1;
2003 Dec 16
1
Calling C function in R
Hi All,
I am trying to write a c function to optimize loop processing.
Having read the R extension and trying out a few samples I was pretty
comfortable with the basics.
However, I am wondering if there is anyway to call tseries
functions like adf.test or po.test from within c function. Any pointers/
code sample would be greatly appreciated.
Thank you.
Manoj
2004 Aug 27
1
Keyboard input into functions
?readline
HTH
-----Original Message-----
From: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Neil Leonard
Sent: Friday, August 27, 2004 2:04 PM
To: r-help at stat.math.ethz.ch
Subject: [R] Keyboard input into functions
Hi,
Does anybody know if it is possible to have keyboard input into
functions? Kind of like 'scanf()' in C.
I want to
2009 Oct 14
1
using mapply to avoid loops
Hello, I would like to use mapply to avoid using a loop but for some reason, I can't seem to get it to work. I've included copies of my code below. The first set of code uses a loop (and it works fine), and the second set of code attempts to use mapply but I get a "subscript out of bounds" error. Any guidance would be greatly appreciated. Xj, Yj, and Wj are also lists, and s2,
2011 Oct 06
1
sum of functions
Dear all,
I would like to create a code for semiparametric Klein and Spady's
estimator. For that I created a function that provides the log-likelihood
function for each observation (so it is a function of betas and i, where i
denotes the observation). Now, in order to maximize the log-likelihood
function, I have to sum these log-likelihood functions for each i and so to
get another function
2001 Nov 21
2
distances from points to line
Dear all,
I have discovered that there are many things that I used to do in my GIS
which are easily done directly in R, for example calculating interpoint
distances using geoR and pick out points inside a polygon using splancs.
I now wonder, is there a function to create a line object like a
watercourse and then calculate the distances between many points in space
and this line?
I couldn't
2003 Oct 20
4
Processing logic for Huge Data set
Hello All,
I am new to R. I am trying to process this huge data set of
matrix containing four columns, say x1, x2, x3, x4 and n number of rows.
I want to aggregate the matrix by x1 and perform statistic based on
columns x2, x3, x4. I tried aggregate function but it gave me memory
allocation error (which I am not surprised), so I ended up performing a
for loop based on x1 and
2012 Jan 05
4
automatic SI prefixes as ticklabels on axis
i want to plot values with frequency on a logarithmic x axis.
similar to this example that i found in the web:
http://www.usspeaker.com/jensen%20p15n-graph.gif
I would like to convert long numbers to si prefix notation
like in the example
(200000 to 200k, 35000000 to 3.5 M)
Of course i could create labels by hand, but
i have many files so i need some automatic function.
Has anyone done that
2013 Jan 07
3
During startup - Warning messages:
Dear Sir/Madam,
After installing R, I saw this warning message in red when I open the R...
During startup - Warning messages:
1: Setting LC_CTYPE failed, using "C"
2: Setting LC_COLLATE failed, using "C"
3: Setting LC_TIME failed, using "C"
4: Setting LC_MESSAGES failed, using "C"
5: Setting LC_PAPER failed, using "C"
how shall I solve this ?
2006 Aug 02
1
unbalanced mixed effects models for fully factorial designs
Does anyone know of a way of dealing with unbalanced mixed effects
(fixed and random factors) for fully factorial designs.
An example of such data is given below;
The response variable is SQRTRECRUITS
SEASON is a random factor
DENSITY is a fixed factor
Thus DENSITY:SEASON is a fixed factor.
Therefore, whereas the effects of SEASON and DENSITY:SEASON should be
tested against the overall