similar to: lapply with different size lists?

Displaying 10 results from an estimated 10 matches similar to: "lapply with different size lists?"

2005 Dec 29
2
loop
Dear All, I have to use loop over an array so I am using following procedure count<-1 repeat{ count<-count + 1 c(g[count],1:i[count]) ->qw if(count>5)break } as a result qw is [1] 0.9643836 1.0000000 2.0000000 3.0000000 4.0000000 5.0000000 [7] 6.0000000 7.0000000 8.0000000 9.0000000 10.0000000 11.0000000 [13] 12.0000000 13.0000000 14.0000000 15.0000000 16.0000000
2013 Mar 14
1
ggplot2 problem
Hello all! I have a problem with ggplot2 library. I want to do an heat map and the y variables are the year months. If I use the following code, he y values are in alphabetical order, but I want it in month order. The code is: library(reshape) library(ggplot2) library(scales) p <- ggplot(data.m, aes(variable, Month)) + geom_tile(aes(fill = value),
2006 Feb 06
2
novice questions about programming in "R"
folks, I have been struggling with the "R" documentation for too long now and I need a simple answer on two questions. The documentation does not have adequate examples. Please help. given two equal vector lists: A <- c(0,1,2,3) B <- c(5,6,7,8) [Question #1] how do I dump them to a text file with the following format:
2007 Jan 30
2
Rbind for appending zoo objects
Hi R, y1 <- zoo(matrix(1:10, ncol = 2), 1:5) colnames(y1)=c("a","b") y2 <- zoo(matrix(rnorm(10), ncol = 2), 6:10) colnames(y2)=c("b","a") > y1 a b 1 1 6 2 2 7 3 3 8 4 4 9 5 5 10 > y2 b a 6 0.9070204 0.3527630 7 1.2405943 0.8275001 8 -0.1690653 -0.1724976 9 -0.6905223 -1.1127670 10
1998 Sep 25
1
format(numericmatrix, ...) : proposal for a change
Since format, i.e., format.default(.), is a pretty basic function I thought I'd ask before just changing it... aa <- cbind(1:7, rnorm(7)) format(aa) or format(aa, digits=7) looks like [,1] [,2] [1,] " 1.0000000" " 0.2406669" [2,] " 2.0000000" "-0.4973221" [3,] " 3.0000000" " 0.4672260" [4,] "
2017 Nov 16
3
Manera eficiente de añadir el valor anterior por grupo
Buenas Tengo un Data table de la siguiente manera: datos<-data.table(grupo=rep(c("a","b"),5),x=c(1:10),y=rnorm(10,2,1)) Lo que quiero es añadir una fila por cada grupo y en esa nueva fila, al valor de la x ponerle el valor anterior de la y Lo que hago es añadir una nueva fila por grupo, con: datos[,.SD[1:(.N+1)],by=grupo] Y para añadir el valor anterior uso la función
2005 Jun 07
1
Help with possible bug (assigning NA value to data.frame) ?
There's something peculiar that I do not understand here. However, did you realize that the thing you are assigning into parts of `a' is NULL? Check you're my.test.boot.ci.1: It's NULL. Be that as it may, I get: > a <- data.frame(matrix(1:4, nrow=2), X3=NA, X4=NA) > a X1 X2 X3 X4 1 1 3 NA NA 2 2 4 NA NA > a[a$X1 == 1,]$X3 <- NULL > a X1 X2 X3 X4 1 1
2014 Jun 24
4
asignacion de un valor a un elemento de una lista
Buen dia! Queria saber si siendo l3 una lista, no se puede asignar un valor a un elemento de una lista?!!! l3[[1]][1,5]<-5 eso no vale? -- "Abraza la incertidumbre, es un intento de tener una filosofía de vida para agarrarme de algo e ir naufragando en la vida de alguna manera. Encarar a ciegas, y generar incertidumbres en el proyectar." J.I.S. [[alternative HTML version
2005 Jun 07
0
Help with possible bug (assigning NA value to data.frame)?
This 'strange behaviour' manifest itself within some quite complex code. When I created a *very* simple example the behaviour dissapeared. Here is the simplest version I have found which still causes the strange behaviour (it could be quite unrelated to the boot library, however). library(boot) ## boot statistic function my.mean.s <- function(data,subset){ mean(data[subset]) }
2013 May 04
2
Lasso Regression error
Hi all, I have a data set containing variables LOSS, GDP, HPI and UE. (I have attached it in case it is required). Having renamed the variables as l,g,h and u, I wish to run a Lasso Regression with l as the dependent variable and all the other 3 as the independent variables. data=read.table("data.txt", header=T) l=data$LOSS h=data$HPI u=data$UE g=data$GDP matrix=data.frame(l,g,h,u)