On Wed, Mar 2, 2011 at 6:31 AM, Bettina Kulle Andreassen
b.k.andreas...@medisin.uio.no wrote:
hi,
i am getting an error when calling the impute.knn
function (see the screenshot below).
what is the problem here and how can it be solved?
screenshot:
##
*** caught segfault
On Tue, Mar 1, 2011 at 1:36 PM, Tamas Barjak tamas.barja...@gmail.com wrote:
Help me please!
I would like to be saved a data table:
write.csv(random.t1, place, dec=,, append = T, quote = FALSE, sep = ,
qmethod = double, eol = \n, row.names=F)
It's OK!
But the rows of file
On Thu, Feb 24, 2011 at 10:03 AM, Duke duke.li...@gmx.com wrote:
Hi folks,
I am wondering if the following is possible: I want to control the arguments
sent to a function by string variables. For example, instead of
heatmap.2( A, col=greenred(75) )
I would want to have something like:
On Sat, Feb 19, 2011 at 6:17 PM, Søren Faurby
soren.fau...@biology.au.dk wrote:
I wish to generate a vector of uniformly distributed data with a defined
correlation to another vector
The only function I have been able to find doing something similar is corgen
from the library ecodist.
The
Hi all,
tried to google but found nothing, so here goes the question: is there
a way to control line spacing when displaying text in graphical mode
(for example, using text())?
As an example, run the following code:
plot(c(0,1), c(0,1), type = n, axes = FALSE, xlab = , ylab = )
text(0.5, 0.5,
On Fri, Feb 18, 2011 at 3:55 PM, Sarah Goslee sarah.gos...@gmail.com wrote:
Peter,
Try par()$lheight
The catch is, you need to set it *before* the call to text()
par(lheight=.8) # closer together
text(x, y, whatever\nsecondline)
The best place to find options like lheight is in ?par
On Tue, Feb 15, 2011 at 9:21 AM, Robert M. Flight rfligh...@gmail.com wrote:
Say I have a tab-delimited table I want to read into R. What should I
expect to happen if some of the entries contain the character ' ? I
thought it would read the file fine, but that is not what happens.
Instead,
On Tue, 15 Feb 2011, Stuart Jaffe wrote:
Hi,
I'm trying to write a file to a shared drive on a network. I use the
write.csv function with the correct path but R doesn't recognize the
directory. Is there something different I have to do since it's a shared
drive?
Thanks.
Check that you
On Tue, Feb 15, 2011 at 11:56 AM, Kevin Wright kw.s...@gmail.com wrote:
The original poster did not say what operating system was being used. From
my own experience on Windows, I always used / for reading from the local
hard drive, but when I started working with Windows network
On Tue, Feb 15, 2011 at 8:43 PM, Steven Cordwell s.cordw...@uq.edu.au wrote:
Hi,
I have a vectors x and z, for example,
x - 0:20
z - round(runif(20,1,7))
y - 0.5
and I want to display z as an image. However if I then call image() with a
vector
On Thu, Feb 10, 2011 at 8:45 AM, Simon Gillings simon.gilli...@bto.org wrote:
I am using bagging to perform Bagged Regression Trees on count data (bird
abundance in Britain and Ireland, in relation to climate and land cover
variables). Predictions from the final model are visually believable
Here's an example:
x = c(1,2,3,4,5);
y = rnorm(5);
labels = LETTERS[1:5];
plot(x,y, type = n) # This sets up the plot but doesn't actually
plot the points
text(x,y, labels) # This adds labels to positions (x,y)
HTH,
Peter
On Tue, Feb 8, 2011 at 12:42 PM, Schatzi adele_thomp...@cargill.com
This only helps to some extent.
If you set I=N and J=N then with N somewhere between 113000 and 114000
ioffset will turn negative.
Thanks to all for suggestions. N=113000 is by far out of range since
(as far as I can tell) the distance structure would be longer than R
can presently handle,
Hi all,
I'm hoping someone more knowledgeable in Fortran than I can chime in
with opinion.
I'm the maintainer of the flashClust package that implements fast
hierarchical clustering. The fortran code fails when the number of
clustered objects is larger than about 46300. My guess is that this is
On Wed, Feb 2, 2011 at 7:22 PM, Nick Matzke mat...@berkeley.edu wrote:
Oh wait, this basically does it:
if (a %in% attributes(z)$names)
+ print(TRUE)
[1] TRUE
(but there may be a better way)
If z is a list, you can test
is.null(z$a)
Peter
__
On Mon, Jan 31, 2011 at 9:30 AM, Mike Miller mbmille...@gmail.com wrote:
Is there an R function for computing a variance-covariance matrix that
guarantees that it will have no negative eigenvalues? In my case, there is
a *lot* of missing data, especially for a subset of variables. I think my
Here's a solution., maybe not the most elegant but works.
df.r = df1[, c(3:5)]; # restricted data
nNonZero = apply(df.r!=0, 1, sum);
one = nNonZero==1;
oneZero = nNonZero==2;
whichOne = apply(df.r[one, ]!=0, 1, which);
whichZero = apply(df.r[oneZero, ]==0, 1, which);
colNames = colnames(df.r);
On Mon, Jan 24, 2011 at 2:47 PM, Yanika Borg akina...@gmail.com wrote:
I am using the function permutations from the package *gregmisc*. However, I
am also making use of the package *e1071*, which also contains a function
called permutations. I want to use the function permutations from the *
I think you want the following, assuming you defined your function g():
gValues = apply(S, 1, g);
Sordered = S[order(gValues), ]
Peter
On Fri, Jan 21, 2011 at 11:38 AM, Francesco Petrogalli
francesco.petroga...@gmail.com wrote:
Hi,
is there a R function that order a matrix according to some
I'm guessing that your code actually generates two plots, one with the
command p - plot(hc) and one with plot(p), which doesn't work for a
png. Try getting rid of the plot(p).
Peter
On Tue, Jan 11, 2011 at 4:01 PM, Richard Vlasimsky
richard.vlasim...@imidex.com wrote:
Has anyone successfully
Several possibilities:
if (length(teams)!=length(unique(teams)) stop(Some teams are duplicated)
or
if (max(table(teams))1) stop(Some teams are duplicated)
I'm sure there are others, too.
On Thu, Jan 6, 2011 at 12:21 PM, ADias diasan...@gmail.com wrote:
Hi,
I am with a problem on how to
From a purely statistical and maybe somewhat naive point of view,
published p-values should be corrected for the multiple testing that
is effectively happening because of the large number of published
studies. My experience is also that people will often try several
statistical methods to get the
On Tue, Jan 4, 2011 at 4:02 PM, Murray Jorgensen
m...@stats.waikato.ac.nz wrote:
I'm going to try my hand at converting some Fortran programs to R. Does
anyone know of any good articles giving hints at such tasks? I will post a
selective summary of my gleanings.
If the code uses
On Wed, Jan 5, 2011 at 7:35 PM, Eduardo de Oliveira Horta
eduardo.oliveiraho...@gmail.com wrote:
Something like this:
u=seq(from=-pi, to=pi, length=1000)
f=sin(u)
Cairo(example.pdf, type=pdf,width=12,height=12,units=cm,dpi=300)
par(cex.axis=.6,col.axis=grey,ann=FALSE, lwd=.25,bty=n, las=1,
Hello,
a user of one of my packages has sent me the following problem that
apparently appears when loading the tcltk package. I'm guessing something
(Tcl/Tk? R open scripting framework?) is not installed correctly... can
someone please confirm or correct my guess? The OS is Mac 10.6.5.
Thanks,
On Mon, Jan 3, 2011 at 3:48 PM, Hadley Wickham had...@rice.edu wrote:
Hi Frank,
I think you mean packagename::functionname? The three colon form is
for accessing non-exported objects.
Normally two colons suffice, but within a package you need three to
access exported but un-imported objects
Well, I'm pretty sure that, inside package A, calling B::functionName
will not work if B has not been imported. That's why I use ::: (after
spending some time trying to figure out why :: didn't work). At least
that was the state of affairs as of R 2.9 or so, perhaps things have
changed since then.
There are several ways to get a matrix, for example
mat = as.matrix(as.data.frame(splitIDs))
or
mat = sapply(splitIDs, I)
True experts may suggests even more ways.
Peter
On Wed, Dec 22, 2010 at 1:02 PM, maddox matthewgdo...@hotmail.com wrote:
Dear Guru's
My first steps with R have ground
see function levels()
?levels
Peter
On Wed, Dec 22, 2010 at 3:00 PM, maddox matthewgdo...@hotmail.com wrote:
Hi,
I have a factor with 3 levels. I'd like to recover the names of each level
so I can use them to search through another data structure. Is this
possible?
Thanks
On Mon, Dec 20, 2010 at 11:04 AM, cory n corynis...@gmail.com wrote:
length(sample(25000, 25000*(1-.55)))
[1] 11249
25000*(1-.55)
[1] 11250
length(sample(25000, 11250))
[1] 11250
length(sample(25000, 25000*.45))
[1] 11250
So the question is, why do I get 11249 out of the first command
On Mon, Dec 20, 2010 at 12:48 PM, Chiquoine, Ben bchiquo...@tiff.org wrote:
Hi,
As will soon be very clear I'm an R novice. I'm trying to better understand
the ks.test function in the stats package. When I look at the source code
there are several calls to C functions (for example
On Thu, Dec 16, 2010 at 7:00 PM, Dario Strbenac
d.strbe...@garvan.org.au wrote:
Hello,
Is it possible to call a graphing function that uses layout() multiple times
and layout those outputs ? Here's a minimal example :
myplot - function()
{
layout(matrix(1:2, nrow=1), widths = c(1,
On Mon, Dec 13, 2010 at 4:33 PM, Joshua Wiley jwiley.ps...@gmail.com wrote:
Hi All,
I am trying to compile R 2.13.0 r53834 on 64-bit Windows 7 (home
premium) using Rtools212.exe from Duncan Murdoch's site. I (think) I
followed the installation guide for Windows. When installing Rtools,
Hi all,
I'm curious whether the standard correlation calculation implemented
in stats::cor uses the underlying BLAS (at least in the default case
use = all.obs).
On a 32-bit linux system using R-2.11.1 compiled with GotoBLAS,
stats::cor is as fast as matrix multiplication, so it would appear
On Fri, Nov 26, 2010 at 6:55 AM, Derik Burgert derik2...@yahoo.de wrote:
Dear list,
running a hierachical cluster analysis I want to define a number of objects
that build a cluster already. In other words: I want to force some of the
cases to be in the same cluster from the start of the
On Tue, Nov 16, 2010 at 9:40 AM, Jeff Bassett jbass...@cs.gmu.edu wrote:
Giovanni,
Both matrices describing the points (A and B in my example) are the
same size, so the resulting matrix will always be square. Also, the
equation I'm using is essentially the following identity:
Var(A + B) =
Peter,
I see your point. As it turns out though, what I'm trying to
calculate is heritability using a slightly modified version of an
equation from multivariate quantitative genetics. Theoretically I
suppose a heritability matrix could be non-positive definite, but in
practice it almost
On Mon, Nov 15, 2010 at 2:07 PM, rchowdhury rchowdh...@alumni.upenn.edu wrote:
Hello,
I am using the hclust function to cluster some data. I have two separate
files with the same data. The only difference is the order of the data in
the file. For some reason, when I run the two files
On Mon, Nov 15, 2010 at 2:19 PM, Reshmi Chowdhury
rchowdh...@alumni.upenn.edu wrote:
Here is the code I am using:
m - read.csv(data_unsorted.csv,header=TRUE)
m - na.omit(m)
cs - hclust(dist(t(m),method=euclidean),method=complete)
ds - as.dendrogram(cs)
As Christian said, you may want to
On Sat, Nov 13, 2010 at 10:33 PM, Stephen Liu sati...@yahoo.com wrote:
Win 7 64 bit
R version 2.11.1 (2010-05-31)
How to permanently remove;
[Previously saved workspace restored]
rm (list = ls( ))
On next start it still displays;
.
[Previously saved workspace restored]
There is
Not sure if there's a pre-defined function for it, but use your basic
math skills: the normal distribution is
dnorm(x) = 1/(sqrt(2*pi)) * exp(-x^2/2),
so the inverse function (on the interval [0, infinity] is
f = function(x) {sqrt( -2*log(sqrt(2*pi) * x)) }
Since the dnorm function is not
On Thu, Nov 11, 2010 at 11:33 AM, Noah Silverman
n...@smartmediacorp.com wrote:
Still doesn't work.
When using rbind to build the data.frame, it get a structure mostly full of
NA.
The data is correct, so something about pushing into the data.frame is
breaking.
Example code:
results -
On Thu, Nov 11, 2010 at 1:19 PM, William Dunlap wdun...@tibco.com wrote:
Peter,
Your example doesn't work for me unless I
set options(stringsAsFactors=TRUE) first.
(If I do set that, then all columns of 'results'
have class character, which I doubt the user
wants.)
You probably mean
On Thu, Nov 11, 2010 at 1:19 PM, William Dunlap wdun...@tibco.com wrote:
Peter,
Your example doesn't work for me unless I
set options(stringsAsFactors=TRUE) first.
Yes, you need to set options(stringsAsFactors=FALSE) (note the FALSE).
I do it always so I forgot about that, sorry.
I see 4 ways to write the code:
1. make the frame very long at the start and use my code - this is
practical if you know that your data frame will not be longer than a
certain number of rows, be it a million;
2a. use something like
result1 = data.frame(a=a, b=b, c=c, d=d)
within the loop to
You change x from a single value to a vector of size 2, for example here:
if (j==2) {x=x+c(-1,1)*0.5}
That makes
c( qchisq(1-alpha/2,df=2*x)/2,
qchisq(alpha/2,df=2*x+2)/2)
a vector of 4 numbers that you are trying to assign to a row of a
matrix with two columns.
On Wed, Nov 10, 2010 at 1:38 PM, kurt_h...@nps.gov wrote:
Greetings
I'm attempting to insert missing data on the smallest size class of
cave cricket instars into a data frame. The data involve censusing
photoplots (plots) of roosting cave crickets in which we discern in four
instars or
On Mon, Nov 8, 2010 at 11:31 PM, Ab Hu master.rs...@yahoo.com wrote:
Thanks! Works great.
I have more questions on this, so I'll continue here:
Now that I have the weighted mean, is it possible to reduce the size of
mountain based on this weighted mean such the original matrix remains 21x21
On Tue, Nov 9, 2010 at 3:40 PM, Barry Rowlingson
b.rowling...@lancaster.ac.uk wrote:
On Mon, Nov 8, 2010 at 5:15 PM, Peter Langfelder
peter.langfel...@gmail.com wrote:
If you also need the z coordinate, it simply the mean of the matrix Z.
zCenter = mean(Z)
How can that be right? Suppose
zCenter = mean(Z)
How can that be right? Suppose your mountain is very flat, so that
your mountain is effectively a cube. The Z values are all the same,
and so their mean is the same. However the centre of mass is, by
symmetry, clearly at height/2.
Similarly suppose your mountain
the exponent of asymmetric matrix makes me very curious.
can anyone please explain to me what will happen if we apply exponent to
the asymmetric matrix?
The gates of Hell will open, the world will come to an end, and we
will all perish in a firestorm :)
Sorry, couldn't resist. Exponentiating
On Tue, Nov 9, 2010 at 9:09 PM, sachinthaka.abeyward...@allianz.com.au wrote:
Hi All,
Suppose I want to concatenate a zero to all the values to a column called
period in data frame A. I want to do the following but the following
command actually deletes the entire column altogether.
Weighted mean of x and y coordinates (sorry for the pun :)), that is
something like
n = 21
y = matrix( c(1:n), n, n)
x = matrix( c(1:n), n, n, byrow = TRUE)
# These are the Center of mass coordinates:
xCenter = sum(x * Z)/sum(Z);
yCenter = sum(y * Z)/sum(Z);
If you also need the z coordinate,
Just a shot in the dark... Do you properly close the input/output
files at the end of your function? If not and the file remains open,
it may throw an error upon new attempt to read it. It is possible that
dyn.unload, among other things, closes all open connections and hence
upon re-load
Before plotting a heatmap we usually standardize all genes to mean
zero and variance 1. That way the green/red represent under/over
expression with respect to the mean expression, which is roughly what
the original 2-color arrays (that literally produced such heatmaps)
were measuring. Of course,
You have (almost) exhausted the 10GB you limited R to (that's what the
memory.size() tells you). Increase memory.limit (if you have more RAM,
use memory.limit(15000) for 15GB etc), or remove large data objects
from you session. Use rm(object), the issue garbage collection gc().
Sometimes garbage
for data to be swapped to and from the disk.
Peter
On Tue, Nov 2, 2010 at 7:36 PM, Peter Langfelder
peter.langfel...@gmail.com wrote:
You have (almost) exhausted the 10GB you limited R to (that's what the
memory.size() tells you). Increase memory.limit (if you have more RAM,
use memory.limit
Sorry, this isn't really an R solution, but here it goes anyway. You
can isolate the block from Source to the first following blank line by
the following unix/linux/cygwin command, assuming inFile is your input
file and outFile is the output file:
cat inFile | grep -A 100 Source | grep -m 1 -B
On Tue, Oct 26, 2010 at 3:13 PM, Daisy Englert Duursma
daisy.duur...@gmail.com wrote:
There are several ways to do this but the package ggplot2
library(ggplot2)
qplot(displ,hwy,data=mpg,colour=factor(cyl))
That can of course be done also using the standard plot command
(substitute variable
On Thu, Oct 21, 2010 at 3:50 PM, HAKAN DEMIRTAS demir...@uic.edu wrote:
Hi,
If a matrix is not positive definite, make.positive.definite() function in
corpcor library finds the nearest positive definite matrix by the method
proposed by Higham (1988).
However, when I deal with correlation
On Mon, Oct 18, 2010 at 4:38 AM, John Haart anothe...@me.com wrote:
Dear List,
I have a table i have read into R:
Name Yes/No
John 0
Frank 1
Ann 0
James 1
Alex 1
etc - 800 different times.
What i want to do is shuffle yes/no and randomly re-assign them to
On Thu, Oct 14, 2010 at 5:21 PM, Paul Rigor (ucla) pr...@ucla.edu wrote:
Hi all,
I would like to use the fpc and cluster packages for clustering. However, I
would like to create a custom dissimilarity object using a library in
python. Has anyone attempted or know of a work-around for
I assume you mean regression of x on y...
here's the code:
missing = is.na(x)
predicted = predict(lm(x~y))
x[missing] = predicted[missing];
Should work but please check.
Peter
On Thu, Oct 14, 2010 at 10:14 PM, Jumlong Vongprasert
jumlong.u...@gmail.com wrote:
Dear all
I have data (x,y)
From what I read, you want something like this:
myfunction-function(dataset,arg1,arg2)
{
func = match.fun(arg2)
argument = dataset[, match(paste(arg1,_test, sep=), names(dataset))]
result=func(argument)
return(result)
}
On Wed, Oct 13, 2010 at 9:28 AM, Manta mantin...@libero.it wrote:
On Wed, Oct 13, 2010 at 10:13 AM, Schwab,Wilhelm K
bsch...@anest.ufl.edu wrote:
Hello all,
I had a very strange looking problem that turned out to be due to unexpected
(by me at least) format changes to one of my data files. We have a small lab
study in which each run is represented by a
I think you want something like this:
optimal.nSplit = rep(NA, 50) # This will hold the result
for (run in 1:50)
{
fit1 = rpart(...)
cpTable = fit1$cptable
bestRow = which.min(cpTable[, xerror]);
optimal.nSplit[run] = cpTable[bestRow, nsplit]
}
In any case, look at
?rpart
?printcp
On Wed, Oct 6, 2010 at 9:32 AM, Ralf B ralf.bie...@gmail.com wrote:
Can one create a variable through a function by name
createVariable - function(name) {
outputVariable = name
name - NULL
}
after calling
createVariable(myVar)
I would like to have a variable myVar
On Wed, Oct 6, 2010 at 9:32 AM, Ralf B ralf.bie...@gmail.com wrote:
Can one create a variable through a function by name
createVariable - function(name) {
outputVariable = name
name - NULL
}
after calling
createVariable(myVar)
I would like to have a variable myVar
#another simple function to update the value in a vector
update-function(index){
test[index]- 20
}
update(2)
test
#The update() function silently fails to accomplish the update
Replace the '-' by '-' and you'll be good to go if you call the
function from a global environment. More
you should close files that you do not use anymore. the maximum number
of open files is likely 4000 or so. Use close(file) before you open
the next one.
Peter
On Wed, Oct 6, 2010 at 4:55 PM, Yong Wang wangyo...@gmail.com wrote:
Dear List
I am running a loop downloading web pages and save the
If no-one replies with a better way, here's a way: under
POSIX-compliant systems, you can write a small C function and wrap it
in an R function.
The C program would be something like
#include unistd.h
void nProcessors(int n)
{
#ifdef _SC_NPROCESSORS_ONLN
long nProcessorsOnline =
On Fri, Oct 1, 2010 at 10:51 AM, mlar...@rsmas.miami.edu wrote:
I calculated a large vector. Unfortunately, I have some measurement error
in my data and some of the values in the vector are erroneous. I ended up
wih some Infs and NaNs in the vector. I would like to filter out the Inf
and
Hi Mete,
I think you should look at the help for memory.limit. Try to set a
higher one, for example
memory.limit(16000)
(I think 16GB is what xenon will take).
Peter
On Fri, Oct 1, 2010 at 6:02 PM, Mete Civelek mcive...@mednet.ucla.edu wrote:
Hi Everyone,
I am getting the following error
.
Has any one ever used this package--coXpress??
Regards
..
Jyotasana
- Original Message -
From: Peter Langfelder peter.langfel...@gmail.com
To: Jyotasana Gulati jgul...@ice.mpg.de
Cc: r-help@r-project.org
Sent: Thursday, September 30, 2010 4:05:44 AM
Subject: Re: [R] cor
for (j in 1:n)
{
if (j%%2==0)
{
iRange = c(n:1)
} else
iRange = c(1:n)
for (i in iRange)
{
your code
}
}
Peter
On Wed, Sep 29, 2010 at 10:40 AM, cassie jones cassiejone...@gmail.com wrote:
Dear All,
I am trying to define a loop for a m*n matrix, where
On Wed, Sep 29, 2010 at 6:43 PM, Gundala Viswanath gunda...@gmail.com wrote:
I have a vector that looks like this:
foo
[1] o o o x o o o o o x x o x
How can we find the percentage of o and x in
that vector in R?
table(foo)/length(foo)
Peter
__
On Wed, Sep 29, 2010 at 1:27 PM, Jyotasana Gulati jgul...@ice.mpg.de wrote:
Hi,
I am have a data set of around 43000 probes(rows), and have to calculate
correlation matrix. When I run cor function in R, its throwing an error
message of RAM shortage which was obvious for such huge number of
On Wed, Sep 29, 2010 at 7:18 PM, Christian Schoder
schoc...@newschool.edu wrote:
hi R-users!
does anyone know how I can access/print only the first two digits of a
number? if i have the number 23732, i would like to get 23. if i have
355 i would like to get 35. if i have 4 i would like to get
On Tue, Sep 28, 2010 at 12:18 PM, Greg Snow greg.s...@imail.org wrote:
Ctrl-C works on some platforms, it would help us to help you if we knew which
OS you are using, which version of R you are using, and in some cases whether
you are using the GUI or Terminal version of R.
Hi,
I have an
On Tue, Sep 28, 2010 at 6:22 PM, Michael Larkin mlar...@rsmas.miami.edu wrote:
I am trying to get R to randomly select values from my dataset (i.e.
bootstrapping) with replacement. However, my attempts at this have been
unsuccessful. Here is a basic example of what I am doing:
I have a data
On Mon, Sep 27, 2010 at 8:22 AM, Kennedy henrik.aldb...@gmail.com wrote:
Hi,
I want to perform a hierarchical clustering using the median as linkage
metric. As I understand it the function hcluster in package amap have this
option but it does not produce the results that I expect.
In the
On Mon, Sep 27, 2010 at 8:22 AM, Kennedy henrik.aldb...@gmail.com wrote:
Hi,
I want to perform a hierarchical clustering using the median as linkage
metric. As I understand it the function hcluster in package amap have this
option but it does not produce the results that I expect.
Also, if
On Mon, Sep 27, 2010 at 8:48 AM, Justin Fincher finc...@cs.fsu.edu wrote:
Howdy,
I have created a set of plots, but I wish to increase the dpi to 300
(instead of the default 72). From the documentation, I thought that
the res parameter to png should accomplish this, but it appears to
On Mon, Sep 27, 2010 at 9:34 AM, Jonas Josefsson
jo...@runtimerecords.net wrote:
I have a two-column table as follows where age is in the 1st column and the
number of individuals is in the 2nd.
age;no
1;21
2;31
3;9
4;12
5;6
You can use the following trick:
x = rep(age, no)
This repeats
this following code:
x-c(1,2,NA)
length(x)
returns 3, correctly counting numbers as well as NA's. How can I
exclude NA's from this count?
sum(!is.na(x))
Peter
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
On Tue, Sep 21, 2010 at 9:50 AM, qcshare qcsh...@gmail.com wrote:
Hello, everyone,
When I run R, I met:
error:cannot allocate vector of size 400Mb, My data is large.
What should I do?
Thanks, everyone.
How big is the RAM in your computer?
There are a few things you can try:
1. Before
Hello,
I encountered a weird problem. Consider the following code that takes
a list lst and shifts all elements one index up (for example, to
make space for a new first element):
lst = list(1,2)
ll = length(lst);
for (i in ll:1)
lst[[i+1]] = lst[[i]];
lst
If you run it, you get the expected
Hi Joshua,
thanks, I came up with that solution myself after a bit of thinking.
Normally I wouldn't worry about NULL components of lists, but dimnames
is a list and often some components are null and is therefore a bit
tricky to manipulate...
Peter
On Mon, Sep 20, 2010 at 7:39 PM, Joshua Wiley
2010/9/14 Uwe Ligges lig...@statistik.tu-dortmund.de:
I do not see any problem, we'd need to look at the package in order to help,
I think.
I re-checked again and somehow the package now passes all checks, so I
must have mistyped something somewhere. Sorry for that.
Peter
Hi all,
I have a package that contains a function foo that calls a function
.fooInternal via match.fun('.fooInternal'). This step is necessary
because I want to give the user an option to override .fooInternal
with a custom function. The .fooInternal function name is not
exported. The function
On Thu, Jun 24, 2010 at 10:16 AM, Mike Williamson this.is@gmail.com wrote:
Hey everyone,
I've been using 'R' long enough that I should have some idea of what the
heck either expression() or eval() are really ever useful for. I come
across another instance where I WISH they would
On Thu, Jun 24, 2010 at 1:26 PM, Duncan Murdoch
murdoch.dun...@gmail.com wrote:
On 24/06/2010 4:08 PM, Lasse Kliemann wrote:
What is the best way in R to compute a sum while avoiding cancellation
effects?
Use sum(). If it's not good enough, then do it in C, accumulating in
extended
On Thu, Jun 24, 2010 at 1:50 PM, Duncan Murdoch
murdoch.dun...@gmail.com wrote:
On 24/06/2010 4:39 PM, Peter Langfelder wrote:
AFAIK the optimal way of summing a large number of positive numbers is
to always add the two smallest numbers
Isn't that what I said?
I understood that you
On Thu, Jun 24, 2010 at 3:16 PM, john polo jp...@mail.usf.edu wrote:
Dear R users,
I have a list of numbers such as
n
[1] 3000 4000 5000 3000 5000 6000 4000 5000 7000 5000 6000 7000
and i'd like to set up a loop that will keep track of the number of
occurences of each of the values that
On Wed, Jun 23, 2010 at 10:01 AM, Lorenzo Isella
lorenzo.ise...@gmail.com wrote:
Dear All,
I am using the plotrix library to plot some matrices.
I have a problem: some of my data are outliers, hence using a linear
color scale does not work very well (you would see too many cells having
a
package::function
On Mon, Jun 21, 2010 at 6:29 AM, Filoche pmassico...@hotmail.com wrote:
Hi everyone.
I want to use 2 different functions (in 2 packages) that have same name. for
instance, if I call the function, it will use the one in the last called
package. Is there a way to specify
On Mon, Jun 21, 2010 at 4:18 PM, song song rprojecth...@gmail.com wrote:
May I ask how to initialize a list?
usually I will use result=list(0) to do this. is this right?
It works, but it is cleaner to use
results=list()
The difference is that list(0) will have one component that contains
eval(parse(text=print(9**2)))
On Thu, Jun 17, 2010 at 12:32 PM, Johannes Huesing
johan...@huesing.name wrote:
Dear expRts,
I have a character string, say a - print(9**2). How do I execute
the contents of the string, parsed as R code? Do I have to open a
connection and use cat(a), and parse it
apply(test, 1, paste, collapse = ,)
On Tue, Jun 15, 2010 at 11:27 AM, Jonathan Greenberg
greenb...@ucdavis.edu wrote:
Folks:
Say I have a matrix:
test=matrix(c(1,2,3),nrow=10,ncol=3)
I would like to have an output character vector where each line is
row's values delimited by commas,
To get the counts, assuming your data frame is called factors and it only
contains the 17 factors, you can do
n = nrow(factors)
aux = rep(1, n);
tab = tapply(aux, as.list(factors), sum);
example:
factors = matrix(sample(c(1:3), 3000, replace = TRUE), 1000, 3)
lfactors = as.list(data.fran =
301 - 400 of 413 matches
Mail list logo