Displaying 20 results from an estimated 2000 matches similar to: "/ Operator not meaningful for factors"
2010 Jul 27
3
Right digits of a floating number
Hi all,
I am dealing with very large numbers but I am only interested in their last
digits.
> 244^244
[1] Inf
As far as I can tell, the largest number R can take has 308 digits (1+E308).
Is there a way I could see the last digits only of 244^244?
Many thanks for your help.
Vincent Deluard, CFA.
--
View this message in context:
2011 Apr 20
2
Saving run time in loop
Hi r users,
I am trying to compute the "moving variance" of a large matrix. I now use a
loop but I am looking for a faster solution. Here is a sample of the code.
Source= matrix(rnorm(400),ncol=100)
variances= matrix(rep(NA,4*100),ncol=100)
for (i in 1:80) {variances[,i]=apply(Source[,i:(i+80)],1,var)}
any idea? Many thanks in advance.
Vincent.
--
View this message in context:
2010 May 10
2
tapply function with NA
Hi R users,
I have a matrix "m" of the type:
m
X4.20.2010 X4.19.2010 X4.16.2010
[1,] 0.008319468 0.00000000 -0.008250825
[2,] 0.005574136 0.01816118 0.073081608
[3,] -0.047830688 0.01612903 -0.030239833
[4,] NA NA NA
[5,] 0.008746356 0.02848576 -0.025566107
[6,] -0.007990868 0.00000000 -0.026666667
I want to get the sum of each column. Normally
2012 Mar 05
8
Automating R script with Windows 7
Hi R-users,
I am trying to automate the daily running of a simple R script from Windows
7.
>From previous posts, I understand that this needs to be done with the task
scheduler.
I can schedule my laptop to automatically open R at a certain time, but not
to execute a script.
Secondary question: how do I save a list of R commands so that they get
executed once the file is open?
Right now, I
2010 Mar 26
1
Store the model built and Using the same on a later date.
Hi,
I have a NN model build using AMORE and NNET.If i want to reuse the model
built on later date.How can i store this model.In what format should i need
to store the model.I wont be saving the session.I want to just store the
model and recall this model whenever required.Is it possible to store? If
yes,can someone provide any packages available.
Regards,
Raghav
[[alternative HTML version
2009 Mar 16
1
Please help! How do I change the class of a numeric variable in a grouped data object to a factor?
Hi all
I’m in desperate need of help. I’m working with a grouped data object, called Orthodont in the nlme package in R, and am trying to fit various models (learning methods for my thesis), but one of the variables in the object is numeric, (age) and I need it to be a factor. I’ve tried: as.factor(Orthodont$age)
as.factor(as.character(Orthodont$age))
and various other things, but when I then
2010 Jun 14
2
how to change default help settings from factory default html
Hi all
Apologies if this is a trivial question- I have searched the lists and the online help files etc but have not managed to find anything. I recently downloaded the latest version of R, which has the help type set to htmlhelp as default (according to http://127.0.0.1:18380/library/utils/html/help.html)
I would very much like to be able to access the help files when I am offline by typing
2010 May 06
1
How to rank matrix data by deciles?
Hi R users,
I have a matrix of data similar to:
> y=matrix(rnorm(55),ncol=5)
I would like to know to which decile each number belongs compared to the
numbers in its column.
Say y[1,1] is the third decile among y[1:11,1] and y[2,1] is in the second
decile
I would like get a matrix that would return their ranks in decile, i.e.,
y[1,1] -> 3
y[2,1] -> 2
Your help is much appreciated!
2010 May 05
3
Read data from .csv file as a matrix
Hi R-users,
I have a csv file that contains weather observation (rows) by days (in
columns).
I open using:
> temp = read.csv("Weather.csv", sep=",")
and read:
X X1.Jan X2.Jan X3.Jan X4.Jan
1 Min 2 3 4 1
2 Max 6 10 8 6
3 Forecast Min 3 1 1 3
4 Forecast Max 8 7
2006 Feb 24
2
Minor documentation improvement
Gentlemen,
In the documentation for reshape, in the function signature, the
argument "direction" is not listed. However, it is explained in the
explanation of parameters below.
I am using R 2.2.1.
Out of curiosity: Is the R core team still an all-male affair? I don't
think I have seen a single lady's name.
--
-- Vivek Satsangi
Student, Rochester, NY USA
2006 Feb 17
3
(Newbie) Functions on vectors
Folks,
I want to make the following function more efficient, by vectorizing it:
getCriterionDecisionDate <- function (quarter , year)
{
if (length(quarter) != length(year)) stop ("Quarter and year vectors
of unequal length!");
ret <- character(0);
for (i in 1:length(quarter)) {
currQuarter <- quarter[i];
currYear <- year[i];
if ((currQuarter < 1) |
2013 Apr 30
3
Line similarity
Folks,
This is probably a "help me google this properly, please"-type of question.
In TIBCO Spotfire, there is a procedure called "line similarity". I use this to determine which observations show a growing, stable or declining pattern... sort of like a mini-regression on the time-line for each observation.
So of the input is
2005 Dec 08
2
Commented version of the home page graphics code
Folks,
I was drawn to R, like many others, partly for the opportunity
to draw nice, colorful graphs (occasionally ones with meaning, too :-)
). I am still quite a newbie to R.
As such, I have been trying to understand the code for the graphics on
the home page (the ones from the 2004 contest -- the dendrogram, the
cluster plot with different coloured circles, etc.) I was wondering
whether anyone
2006 Jan 18
3
Possible improvement in lm
Folks,
I do a series of regressions (one for each quarter in the dataset) and
then go and extract the residuals from each stored lm object that is
returned as follows:
vResiduals <- as.vector(unlist(resid(lQuarterlyRegressions[[i]])));
Here lQuarterlyRegressions is a vector of objects returned by lm().
Next, I may go find outliers using identify() on a plot or do some
other analysis which
2006 Mar 07
2
(newbie) Accessing the pieces of a 'by' object
Folks,
I know that I can do the following using a loop. That's been a lot
easier for me to write and understand. But I am trying to force myself
to use more vectorized / matrixed code so that eventually I will
become a better R programmer.
I have a dataframe that has some values by Year, Quarter and Ranking.
The variable of interest is the return (F3MRet), to be weighted
averaged within the
2009 Nov 18
2
Median on Aggregated data
Folks,
I have the following code, that works fine on smaller data sets. For
larger datasets, it runs out of memory and runs way too slow because we
are essentially creating large vectors with rep() and then calling
median() on it. (I learned this approach from a post on the web).
Below that, I have written the corresponding SAS code. The SAS code
works fast because I can just tell the proc
2005 Nov 24
1
Suggested add to the documentation for the identify() function
Folks,
1. Is there a more appropriate list (r-devel?) for posting such
suggestions? I am a newbie to R, and doubtless will have some
suggestions for the documentation -- some good, others not quite so. I
would actually like to help give back to the community (I was
motivated by Prof. Ripley's 2001 talk in which he had commented that
open source software users rarely give back anything.) --
2006 Feb 24
1
(Newbie) Aggregate for NA values
Folks,
Sorry if this question has been answered before or is obvious (or
worse, statistically "bad"). I don't understand what was said in one
of the search results that seems somewhat related.
I use aggregate to get a quick summary of the data. Part of what I am
looking for in the summary is, how much influence might the NA's have
had, if they were included, and is excluding
2005 Nov 21
1
Cacheing in read.table/ attached data?
Disclaimer/Apology: I am an R newbie
I am seeing some behaviour that seems to me to be the result of some
cacheing going on at some level, and perhaps this is expected behaviour. I
would just like to understand the basic rules.
What I have is a file with some data. I read it in and then do a summary on
the resulting dataframe. I find the some values are completely outside the
expected range,
2006 Mar 15
1
(newbie) Weighted qqplot?
Folks,
Normally, in a data frame, one observation counts as one observation
of the distribution. Thus one can easily produce a CDF and (in Splus
atleast) use cdf.compare to compare the CDF (BTW: what is the R
equivalent of the SPlus cdf.compare() function, if any?)
However, if each point should not count equally, how can I weight the
points before comparing the distributions? I was thinking of