Displaying 20 results from an estimated 5000 matches similar to: "Rounding error in seq(...)"
2009 Jul 22
5
Find multiple elements in a vector
Hi,
Given a vector, say
x=sample(0:9,10)
x
[1] 0 6 3 5 1 9 7 4 8 2
I can find the location of an element by
which(x==2)
[1] 10
but what if I want to find the location of more than one number? I could do
c(which(x==2),which(x==3))
but isn't there something more streamlined? My first guess was
y=c(2,3)
which(x==y)
integer(0)
which doesn't work. I haven't found any clue in the R
2009 Jul 14
5
Nested for loops
Hi,
I have spent some time locating a quite subtle (at least in my
opinion) bug in my code. I want two nested for loops traversing the
above-diagonal part of a square matrix. In pseudo code it would
something like
for i = 1 to 10
{
for j = i+1 to 10
{
// do something
}
}
However, trying to do the same in R, my first try was
for (i in 1:10)
{
for (j in (i+1):10)
{
//
2009 Jul 18
1
Building a big.matrix using foreach
Hi there!
I have become a big fan of the 'foreach' package allowing me to do a
lot of stuff in parallel. For example, evaluating the function f on
all elements in a vector x is easily accomplished:
foreach(i=1:length(x),.combine=c) %dopar% f(x[i])
Here the .combine=c option tells foreach to combine output using the
c()-function. That is, to return it as a vector.
Today I discovered the
2009 Jul 20
5
heatmap plot
Dear R community!
I am trying to create a heatmap based on the following data. As you can see the diagonal (0,0 to 10,10) is always 0). If I run the heatmap command like i posted it I get a graph with horizontal lines.
What is my mistake?
> heatmap(activity.matrix, Rowv = NA, Colv = NA, scale="column", xlab="x Compounds", ylab="y Compounds",
2009 Jul 13
2
graph: axis label font
Hi,
excuse me for my english, i am using R on windows and i have to do several
graphs with axis labels and the axis text thicks has a specified font type,
(Arial) and a specified font size. How can i do these? Thank you in advance
--
View this message in context: http://www.nabble.com/graph%3A-axis-label-font-tp24463974p24463974.html
Sent from the R help mailing list archive at Nabble.com.
2009 Jul 20
2
kmeans.big.matrix
Hi,
I'm playing around with the 'bigmemory' package, and I have finally
managed to create some really big matrices. However, only now I
realize that there may not be functions made for what I want to do
with the matrices...
I would like to perform a cluster analysis based on a big.matrix.
Googling around I have found indications that a certain
kmeans.big.matrix() function should
2009 Jul 17
2
Re placing null values (#NULL!)
I am stumped. I have a data set with multiple columns and about 65,000 case.
Some of the cases have a "#NULL!" value so for dataframe "Props_":
access_emp pct_vacant TAVAIL park PARKACRES totlandare
4538 52.15 #NULL! 0 1 22.99 74,129.70400
4539 52.15 .09 0 1 22.99 982,850.80400
10292 54.20
2009 Aug 16
5
Plot(x,y)
Hi ,
I am using the plot function for some data , and the plot is coming back
pure black , with scales on the side .
Regards
Malcolm
[[alternative HTML version deleted]]
2009 Aug 13
2
randomForest question--problem with ntree
Hi,
I would like to use a random Forest model to get an idea about which variables from a dataset may have some prognostic significance in a smallish study. The default for the number of trees seems to be 500. I tried changing the default to ntree=2000 or ntree=200 and the results appear identical. Have changed mtry from mtry=5 to mtry=6 successfully. Have seen same problem on both a Windows
2009 Jul 16
4
loading a file in R in mac OS X
Hello,
Please forgive me that this question is so basic, but i have not been able
to find a solution in any of the basic R introductions, in the R wiki, or in
the stats textbook i'm using to learn R. I run R on a macintosh, and i have
not been able to load any data files yet. For instance, if I have a data
table in a file called schools.txt on my desktop, i've been trying to load
the
2009 Aug 17
6
graph label greek symbol failure
Readers,
Previous questions about this requirement have been for m$ users, my
failure occurs using linux.
I have tried to add the delta (?) symbol to the y axis label and the
result is &D, using the command:
...ylab="?t"...
Any advice please?
rhelp at conference.jabber.org
mandriva 2008
r 251 (27-06-07)
2009 Jul 16
5
Transformation of data!
Hi Colleagues,
Could you please help?
I get as the output of my calculations following
[1] 0.000000e+00 1.890000e-04 3.933000e-05 1.701501e-04 2.040456e-04
[6] 3.119242e-04 2.545665e-04 1.893930e-03 1.303112e-03 9.880183e-04
[11] 1.504378e-03 1.549246e-03 5.877690e-04 4.771359e-04 8.528219e-04
How is it possible to transform the data to get a vector as following
10
2009 Sep 11
4
R on Multi Core
Hi,
Our discussions about 64 bit R has led me to another thought.
I have a nice dual core 3.0 chip inside my Linux Box (Running Fedora 11.)
Is there a version of R that would take advantage of BOTH cores??
(Watching my system performance meter now is interesting, Running R will
hold a single core at 100% perfectly, but the other core sites idle.)
Thanks!
--
Noah
2009 Jul 13
4
Combine two matricies
Hi,
I have two matricies a and x:
a<-matrix(c(3,4,5,2,3,4,1,1,2), nrow=3, ncol=3)
[,1] [,2] [,3]
[1,] 3 2 1
[2,] 4 3 1
[3,] 5 4 2
x<-matrix(c(3, NA, NA, NA, 2, 5, NA, 2, 2), nrow=3, ncol=3)
[,1] [,2] [,3]
[1,] 3 NA NA
[2,] NA 2 2
[3,] NA 5 2
I wish to combine these two into one matrix using the values from x where x has values, and
2003 Nov 08
2
Effects of rounding on regression
Does anyone know of research on the effects of rounding on regression?
e.g., when you ask people "How often have you _______?" you are more
likely to get answers like 100, 200, etc. than 98, 203, etc.
I'm interested in investigating this, but don't want to reinvent the
wheel.
thanks
Peter
Peter L. Flom, PhD
Assistant Director, Statistics and Data Analysis Core
Center for
2009 Jul 20
2
mahalanobis distance
http://www.nabble.com/file/p24569511/mahalanobis.txt mahalanobis.txt
http://www.nabble.com/file/p24569511/concentrations.txt concentrations.txt
Dear Forum members,
I have a problem calculating mahalanobis distances. My data file
mahalanobis.txt and categories file concentrations.txt are attached. I do
the following steps:
x <- as.matrix(read.table("mahalanobis.txt", header=TRUE))
2009 Aug 13
2
Matrix addition function
Hello,
What function can I use for matrices addition? I couldn’t find any information about it in the manual or in the internet.
(A+B suits, when the number of matrixes is small, function sum() doesn’t suit for matrices addition, because it sums all variables in the matrices and produces as an answer single number, not a matrix).
Best regards,
Lina
[[alternative HTML version
2009 Sep 11
3
how to determine if a variable is already set?
Hi,
It might be a primitive question but how it is possible to determine if a variable is initialized in an environment? Suppose that we start a R session and wants to run a script which use the variable i. Which function could evaluate if i is already initialized or not and if not, then ask interactively the user to set it? This is to avoid the error message: object i is not found.
Regards,
2009 Sep 19
2
Use of R in Schools
I am looking for information on experimentation with the use
of R in the teaching of statistics and science in schools. Any
leads would be very welcome. I am certain that there is such
experimentation.
I've made this inquiry on r-sig-teaching, with no response.
John.
John Maindonald email: john.maindonald at anu.edu.au
phone : +61 2 (6125)3473 fax : +61 2(6125)5549
Centre
2009 Jul 24
1
downsampling
Hi,
I am looking for ways to donwsample one-dimensional vectors.
For example,
x=sample(1:5, 115, replace=TRUE)
How do I downsample this vector to 100 entries? Are there any R functions or packages that provide such functionality.
I did find the zoo package and the aggregate() function, but these appear to be rather specific for time-series.
Thanks in advance,
Jan