Hi Nevil,
It's a nasty piece of work, but:
M<-matrix(c(1,2,3,4,1,2,3,4,1,2,3,4,2,1,3,2),4,4,
dimnames = list(NULL, c("x", "y", "z","k")))
M
reprow<-function(x)
return(matrix(rep(x,x[length(x)]),nrow=x[length(x)],byrow=TRUE))
toseq<-function(x) return(1:x)
j<-unlist(sapply(M[,"k"],toseq))
OK sorted - hope these postings might help someone else
Any even faster options would be appreciated still
#seq() does not work but sequence() does
print("rep and sequence")
print(system.time({
j<-NULL
MOut<-NULL
MOut<-M[rep(1:nrow(M), times = M[,4]), ]
j<-sequence(M[,4])
Well,
I found a way to do it partly using rep(), and one loop that makes it 10x
or more faster however would still be good to do without the loop at all
matrix made slightly beigger (1 rows):
M<-matrix(c(1:3
), 1,3)
M<-cbind(M,sample(1:5,size = 1,replace = T))
#Print(M)
#Create
False premise: rep works fine
Mout2 <- cbind(M[ rep(seq.int(nrow(M)),M[,"k"]),
c("x","y","z")],unlist(lapply(M[,"k"],seq.int)))
On March 31, 2020 6:18:37 PM PDT, nevil amos wrote:
>Hi
>
>I can achieve this using two for loops but it is slow I need to do
>this on
>many matrices with tens of
Hi
I can achieve this using two for loops but it is slow I need to do this on
many matrices with tens of millions of rows of x,y,z and k
What is a faster method to achieve this, I cannot use rep as j changes in
each row of the new matrix
###
Maybe simply add:
points(station$Lon, station$Lat, col="red", pch=16, label="Your Country")
text(station$Lon, station$Lat,"Your Country",
col="black", pos=3, cex=1)
station$Lon and Lat in your coordinate position.
Regards,
Ani
On Tue, Mar 31, 2020 at 10:58 PM george brida wrote:
>
>
I am running gee with a an offset followed by predict to get predicted values.
The GEE analysis runs without error. When I run the predict function, I get the
following error message:
Error in seq_len(p) : argument must be coercible to non-negative integer
In addition: Warning messages:
1: In
Nice improvement.
Jim
On Wed, Apr 1, 2020 at 3:18 AM Rasmus Liland
wrote:
>
> On 2020-03-30 21:43 -0500, Ana Marija wrote:
> > I did run your workflow and this is what I got:
> >
> > > newout<-merge(output11.frq,marker_info[,c("V5","match_col")],by="match_col")
> > Error in
a ver si con scale_shape_manual lo consigues
Changing shapes used for scale_shape() in ggplot2
|
|
|
| | |
|
|
|
| |
Changing shapes used for scale_shape() in ggplot2
Suppose I have the followingy <- rnorm(10)b <-
as.factor(sample(1:4,10,replace=T))qplot(1:10, y, shape=b)Ho...
|
Hola José gracias por contestar.
Así puedo resolverlo si tengo los iconos de cada nube.
Cada geom_ponit() tiene un shape diferente (shape=1 da un símbolo, shape=2
otro, etc) , lo que cada nube da iconos diferenciados, no logro poner con
geom_label() esas referencias del shape¿se entiende
Hola, muy muy claro no me queda, pero a ver si atinoSi el único problema es la
etiqueta, y quieres que te salga: *** Branch R2=0.99con
hacerlabel=expression(paste("***", " ", "Branch ", R^2, "", "=0.99")),
Te debería salir. Pero supongo que es otra cosa lo que quieres no?
En martes, 31 de
Buenos días, mi consulta es cómo poner etiquetas con las referencias en una
gráfica con varias lineas. Cada Línea es un modelo lineal de una nube y
quisiera que la etiqueta mostrar el símbolo de la nube.
Estoy usando gglot adjunto la sentencia de la etiqueta para la nube Branch
que tiene shape=3
On 3/31/20 6:49 AM, george brida wrote:
Dear Jim,
Is it possible to add also a title to this map?
Many thanks
When I look at the ?map help page, I see all these questions answered
in the Examples section.
--
David
On Tue, Mar 31, 2020 at 2:29 PM george brida wrote:
Dear Jim,
On 2020-03-31 03:38 +0200, george brida wrote:
> i would like to plot the maps of the Gulf Cooperation Council (GCC)
> countries (KSA, Qatar, Bahrain, Kuwait, UAE and Oman) with these
> constraints: i/ KSA , Qatar and Bahrain have the same face color , ii/
> Kuweit and UAE with the same face color
On 2020-03-30 21:43 -0500, Ana Marija wrote:
> I did run your workflow and this is what I got:
>
> > newout<-merge(output11.frq,marker_info[,c("V5","match_col")],by="match_col")
> Error in `[.data.frame`(marker_info, , c("V5", "match_col")) :
> undefined columns selected
>
> this is how
Hi Ivan,
Like Ivan Krylov, I'm not aware of circumstances for simple dataframes
where ncol(DF) does not equal length(DF).
As I understand it, using ncol() versus length() is important when
you're examining an object returned from a function like sapply(),
since sapply() will simplify one-column
Thanks Matthias for the details!
Ivan
--
Dr. Ivan Calandra
TraCEr, laboratory for Traceology and Controlled Experiments
MONREPOS Archaeological Research Centre and
Museum for Human Behavioural Evolution
Schloss Monrepos
56567 Neuwied, Germany
+49 (0) 2631 9772-243
should have added: dim(x)[2L] -> length(x)
Am 31.03.20 um 16:21 schrieb Prof. Dr. Matthias Kohl:
Dear Ivan,
if I enter ncol in the console, I get
function (x)
dim(x)[2L]
indicating that function dim is called. Function dim has a method for
data.frame; see methods("dim").
The dim-method
Dear Ivan,
if I enter ncol in the console, I get
function (x)
dim(x)[2L]
indicating that function dim is called. Function dim has a method for
data.frame; see methods("dim").
The dim-method for data.frame is
dim.data.frame
function (x)
c(.row_names_info(x, 2L), length(x))
Hence, it
Thanks Ivan for the answer.
So it confirms my first thought that these two functions are equivalent
when applied to a "simple" data.frame.
The reason I was asking is because I have gotten used to use length() in
my scripts. It works perfectly and I understand it easily. But to be
honest, ncol()
On Tue, 31 Mar 2020 14:47:54 +0200
Ivan Calandra wrote:
> On a simple data.frame (i.e. each element is a vector), ncol() and
> length() will give the same result.
> Are they just equivalent on such objects, or are they differences in
> some cases?
I am not aware of any exceptions to
Dear Jim,
Is it possible to add also a title to this map?
Many thanks
On Tue, Mar 31, 2020 at 2:29 PM george brida wrote:
> Dear Jim,
>
> Thank you very much. I obtained now the required map. I would like to know
> how to add the names of the countries.
>
> Best
> George
>
> On Tue, Mar 31,
That's exactly why I was asking if it really is equivalent and if there
are issues using one function or the other
--
Dr. Ivan Calandra
TraCEr, laboratory for Traceology and Controlled Experiments
MONREPOS Archaeological Research Centre and
Museum for Human Behavioural Evolution
Schloss Monrepos
Yes it does because length(list) gives you the number of elements of the
list. And in the case of a data frame object that is the number of columns,
or ncol().
On Tue, Mar 31, 2020 at 4:37 PM Ivan Calandra wrote:
> Thanks Eric,
>
> I know that, but that doesn't really answer my question, does
Thanks Eric,
I know that, but that doesn't really answer my question, does it?
Ivan
--
Dr. Ivan Calandra
TraCEr, laboratory for Traceology and Controlled Experiments
MONREPOS Archaeological Research Centre and
Museum for Human Behavioural Evolution
Schloss Monrepos
56567 Neuwied, Germany
+49
A data frame is a special case of a list. It is a list of its columns.
> is.list( your_data_frame )
# TRUE
On Tue, Mar 31, 2020 at 4:04 PM Ivan Calandra wrote:
> Dear useRs,
>
> I have a very simple question:
> On a simple data.frame (i.e. each element is a vector), ncol() and
> length()
Dear useRs,
I have a very simple question:
On a simple data.frame (i.e. each element is a vector), ncol() and
length() will give the same result.
Are they just equivalent on such objects, or are they differences in
some cases?
Is one of them to be preferred for whatever reason?
Thanks you,
Ivan
Dear Gunter,
It is noted. Thanks
Best
On Tue, Mar 31, 2020 at 6:04 AM Bert Gunter wrote:
> Probably better posted to the r-sig-geo list, where you are more
> likely to find the relevant expertise.
>
> Perhaps see also https://cran.r-project.org/web/views/Spatial.html,
> depending on what you
Dear Jim,
Thank you very much. I obtained now the required map. I would like to know
how to add the names of the countries.
Best
George
On Tue, Mar 31, 2020 at 10:10 AM Jim Lemon wrote:
> Hi George,
> Try this:
>
> library(maps)
> map("world",xlim=c(34.353,60.369),ylim=c(16.7,32.193),
>
That would have been my code too!
On Tue, Mar 31, 2020 at 2:10 AM Jim Lemon wrote:
> Hi George,
> Try this:
>
> library(maps)
> map("world",xlim=c(34.353,60.369),ylim=c(16.7,32.193),
> regions="Saudi Arabia",col="yellow",fill=TRUE)
>
Hi Erin,
Thanks for the reply. I would like to have just those countries on the map.
Best
George
On Tue, Mar 31, 2020 at 5:02 AM Erin Hodgess
wrote:
> Hello George!
>
> Do you mean to have a map of the world with these countries filled in, or
> to have just those countries on the map,
Hi George,
Try this:
library(maps)
map("world",xlim=c(34.353,60.369),ylim=c(16.7,32.193),
regions="Saudi Arabia",col="yellow",fill=TRUE)
map("world",regions="Bahrain",col="yellow",fill=TRUE,add=TRUE)
map("world",regions="Kuwait",col="lightblue",fill=TRUE,add=TRUE)
Ah, my mistake. Should be:
marker_info<-read.csv("marker-info",header=FALSE,stringsAsFactors=FALSE,skip=24)
Jim
On Tue, Mar 31, 2020 at 1:43 PM Ana Marija wrote:
>
> HI Jim,
>
> thank you so much for getting back to me, I think the issue is with
> reading that csv file
>
> >
33 matches
Mail list logo