Displaying 20 results from an estimated 20000 matches similar to: "Pure curiosity"
2011 Feb 06
2
Legend outside the plot? xpd?
Hi All,
BG: Will try be brief. I'd like 3 graphs on a page (below each other
mfrow=c(3,1)), saved to pdf. The three plot data on the same subject so I'm
having one legend, to the right of the center graph. I'm using
mar=c(5,15,4,15) to bring the sides in so that the graphs are square and not
stretched wide. To have the graph to the side I'm thinking xpd=T. Each graph
has a number
2009 Dec 17
2
Problem with spliting a dataframe values
Hi all,
Hi this is kiran
I am facing a problem to split a dataframe
that is..
i have a string like: "a,b,c|1,2,3|4,5,6|7,8,8"
first I have to split with respect to "|"
I did it with command
unlist(strsplit("a,b,c|1,2,3|4,5,6|7,8,8", "\\,"))
after getting that set i made it as a dataframe and it comes like
a,b,c
1,2,3
4,5,6
7,8,8
now i have to
2005 Feb 09
1
Dates labels on axes in xyplot
I am a bit confused about how to get the format of the labels in xyplot
to show as dates rather than the numeric value.
e.g.,
x <- as.Date(c("20/01/2001","20/02/2003","21/06/2004"),"%d/%m/%Y")
y <- c(1,2,3)
plot(y~x) #produces formatted labels
xyplot(y~x) #doesn't give formatted x labels
2011 May 30
4
Test for list membership
Hi,
I need some help with this one: how do I check whether a vector is
already present in a list of vectors.
I have seen %in% recommended in a similar case but that obviously does
not work here.
c(1,2,3) %in% list(c(1,2,3), c(4,5,6))
returns
[1] FALSE FALSE FALSE
which makes sense since 1, 2 or 3 are not elements of that list. I don't
really know how to move from there though.
Best
1998 Nov 19
2
Re: ESS & R data import problems
I have a similar question, I know about --vsize, but I use R under Emacs
using ESS. I know there is an easy way to call R from ESS with command
line options but I don't remember how. I can't find help on this in ESS
documentation or in R documentation.
Could someone please remind me how this is done.
------------------------------------
| Robert Denham |
|
2010 Jul 26
3
List to data frame
Hi,
Any ideas on how to efficiently convert
> list(c(1,2,3),c(4,5,6))
to
> data.frame(OriginalListIndex=c(1,1,1,2,2,2),Item=c(1,2,3,4,5,6))
Thanks for any hints,
Joh
2008 Mar 19
3
ApplicationHelper
When working with views, I use instance methods of ApplicationHelper:
# app/helpers/application_helper.rb:
module ApplicationHelper
def distribute(total, min, cutof, list)
[1,2,3]
end
end
# app/views/planner/_mta_colors.rhtml:
<td>
<%
...
dist = distribute(total_v_px, 4, 0, colors.collect{|color| color[1]})
...
%>
So to test the distribute method in ApplicationHelper, I have
2006 Dec 20
4
R windows crash (PR#9426)
Full_Name: Robert Denham
Version: R-2.4.1
OS: Windows Xp
Submission from: (NULL) (61.88.57.1)
R gui exits without warning when I run a function which has an argument with a
default that is not found.
This was a result of an error in a function I wrote, but I thought that it
should exit more gracefully than it does. Here is an example:
testfun <- function(aa=aa) {
aa <-
2013 Feb 03
2
Compare each element of a list to a vector
Hello R-helpers,
I have a vector
x<-c(1,2,3)
and a list that contains vectors
datalist<-list(c(1,2,3),c(2,3,4),c(3,4,5),c(4,5,6))
and I would like to identify those list elements that are identical to x.
I tried
> datalist %in% x
[1] FALSE FALSE FALSE FALSE
but I am obviously using %in% incorrectly. I also tried messing around with
lapply but I can't figure out how to specify
2017 Sep 22
2
update numeric values of list with new values...
Suppose I have the following:
test <- list(a=1,b=2,c=3)
I also have a vector (or list, or something else...) with new numbers
new <- c(4,5,6)
What I'm trying to figure out is how to take the list, and update the
numbers from {1,2,3} to {4,5,6}
So, in the end,I want the 'update' test list to look like
(a=4,a=5,a=6)
I tried a bunch of obvious things I know about
2009 May 25
4
How to create all pairs
Hi,
I have:
i = c(1,2,3)
j = c(4,5,6)
How do I create a matrix of all pairs?
i.e.
1,4
1,5
1,6
2,4
:
Thanks!
--
View this message in context: http://www.nabble.com/How-to-create-all-pairs-tp23714659p23714659.html
Sent from the R help mailing list archive at Nabble.com.
2007 Aug 21
2
compiling R under cygwin
For various reasons, it suits our workplace to have a cygwin version of
R. I am pretty sure that cygwin is still not a supported environment
for R, but we have managed to compile R-2.5.1 under cygwin without too
many dramas. Our procedure is described below. We still have a few
problems compiling libraries without manually changing files from .so to
.dll, but it seems ok.
I was wondering
2013 Mar 12
2
Bugs due to naive copying of list elements
Several bugs are present in R-2.15.3 and R-alpha due to
naive copying of list elements.
The bug below is due to naive copying in subset.c (with
similar bugs for matrices and arrays):
a<-list(c(1,2),c(3,4),c(5,6))
b<-a[2:3]
a[[2]][2]<-9
print(b[[1]][2])
Naive copying in mapply.c leads to the following bug:
X<-1+1
f<-function(a,b) X
A<-mapply(f,c(1,2,3),c(4,5,6),SIMPLIFY=FALSE)
2017 Sep 22
0
update numeric values of list with new values...
Solved it:
test <- list(a=1,b=2,c=3)
new <- c(4,5,6)
hold <- as.list(new)
updated_test <- replace(test,c(1:3),hold)
$a
[1] 4
$b
[1] 5
$c
[1] 6
mean.parms <- as.list(mean.parms)
mm.parms <- replace(far.parms,c(1:length(far.parms)),mean.parms)
On 9/22/2017 10:34 AM, Evan Cooch wrote:
> Suppose I have the following:
>
> test <- list(a=1,b=2,c=3)
>
> I
2017 Sep 22
1
update numeric values of list with new values...
Well, that's a bit like driving from Boston to New York by way of Chicago.
See ?structure
test <- list(a=1,b=2,c=3)
new <- c(4,5,6)
test.new <- structure(as.list(new), names=names(test))
test.new
$a
[1] 4
$b
[1] 5
$c
[1] 6
Cheers,
Bert
Bert Gunter
"The trouble with having an open mind is that people keep coming along and
sticking things into it."
-- Opus (aka
2010 Mar 17
3
Vector multiplication
Hi,
this may sound stupid (and it probably is), but I can't seem to find out how to multiply each element of a vector with each element of another vector where the result would be a matrix of dim[length(vectorOne),length(vectorTwo)] without using loops.
example: if
a -> c(1,2,3)
b -> c(4,5,6)
i'm looking for the operation that would yield:
[,1] [,2] [,3]
[1,] 4 8
2012 Jun 15
8
Apply() on columns
Hi,
I have some trouble with the following: I have a table of 7 rows and
6columns. The columns 1,2,3 have information about the number of employees.
The columns 4,5,6 have information about the number of working hours. Each
row, is corresponding with a week.
My goal is to make a boxplot, histogram etc. of the columns 4, 5 and 6
(thus, the data of the number of working hours). How can I select by
2009 Aug 24
6
Combining matrices
If I have two matrices like
x <- matrix(rep(c(1,2,3),3),3)
y <- matrix(rep(c(4,5,6),3),3)
How can I combine them to get ?
1 1 1 4 4 4
1 1 1 5 5 5
1 1 1 6 6 6
2 2 2 4 4 4
2 2 2 5 5 5
2 2 2 6 6 6
3 3 3 4 4 4
3 3 3 5 5 5
3 3 3 6 6 6
The number of rows and the actual numbers above are unimportant, they are given so as to illustrate how I want to combine the matrices. I.e., I am looking for
2013 Aug 29
10
Concatenate two arrays
Hello again ruby community!
I just learned how to add two arrays(I know, i know).
My program looked like this
array1=[1,2,3]
array2=[4,5,6]
array_sum=array1+array2
I thought pretty simple stuff, they are combined. However, now i am
looking to define that code as a method and I do not understand how to
create the correct number of arguments, so when the method is called
back it gives me my
2012 Mar 07
2
dot products
Hello,
I need to take a dot product of each row of a dataframe and a vector.
The number of columns will be dynamic. The way I've been doing it so
far is contorted. Is there a better way?
dotproduct <- function(dataf, v2) {
apply(t(t(as.matrix(a)) * v2),1,sum) #contorted!
}
df = data.frame(a=c(1,2,3),b=c(4,5,6))
vec = c(4,5)
dotproduct(df, vec)
thanks,