x <- c("abc\ndef", "", "ghi")
unlist(strsplit(gsub("^$", "\n", x), "\n"))
or
x %>%
gsub("^$", "\n", .) %>%
strsplit("\n") %>%
unlist()
Regards.
Tanvir Ahamed
Stockholm, Sweden | mashra...@yahoo.com
On Wednesday, February 5, 2025 at 02:44:37 PM GMT+1, Duncan Murdoch
C1 <- A
C1[,2][which(B[,1]%in%A[,1])] <- B[,2][which(B[,1]%in%A[,1])]
Regards.
Tanvir Ahamed
On Wednesday, 1 September 2021, 11:00:16 pm GMT+2, Eliza Botto
wrote:
deaR useRs,
I have the matrix "A" and matrix "B" and I want the matrix "C". Is there a way
of doing it?
Hi,
You can try this.
Example: 1
a <- c(1, 4)
b <- c(5, 8)
unlist(as.vector(mapply(seq,a,b)))
> [1] 1 2 3 4 5 4 5 6 7 8
a <- c(1, 4, 2)
b <- c(5, 8, 10)
unlist(as.vector(mapply(seq,a,b)))
> [1] 1 2 3 4 5 4 5 6 7 8 2 3 4 5 6 7 8 9 10
Regards.
Tanvir Ahamed
Sto
Hi, In your data file, the first row does not have an equal number of column
like the rest of the row.Check your data file. Specially 1st row.
Regards.Tanvir AhamedStockholm, Sweden |
mashra...@yahoo.com
On Monday, 5 October 2020, 08:11:48 am GMT+2, Mir Md. Abdus Sal
hi,
Check this
beanplot(count ~ spray, data = InsectSprays, what = c(FALSE, TRUE, TRUE, TRUE))
>From R function help :
what : a vector of four booleans describing what to plot. In the following
order, these booleans stand for the total average line, the beans, the bean
average, and the bea
uot;)
On Sat, 10 Feb 2018, 16:22 Mohammad Tanvir Ahamed via R-help,
wrote:
> Hi,
> I want to label a polygon (circle or polygon) inside.
> As for example code
>
> library(spatstat)
> x <- runif(20)
> y <- runif(20)
> X <- ppp(x, y, window=disc(0.7))
> plot(
Hi,
I want to label a polygon (circle or polygon) inside.
As for example code
library(spatstat)
x <- runif(20)
y <- runif(20)
X <- ppp(x, y, window=disc(0.7))
plot(X)
Now I want to label that circle inside . Can some one please help me ?
Thanks.
Regards.
Tanvir Ahamed
Stockholm,
Dear Akshay,
Where is the problem !!Two data set seems identical except one of them show 10
column and other showing 11 column on r console .
Regards.Tanvir AhamedStockholm, Sweden |
mashra...@yahoo.com
On Friday, December 15, 2017, 3:49:03 PM GMT+1, akshay kulkarni
Hi,
With the following code i can divides window into quadrats and counts the
numbers of points in each quadrat.
library(spatstat)
X <- runifpoint(50)
quadratcount(X)
quadratcount(X, 4, 5)
quadratcount(X, xbreaks=c(0, 0.3, 1), ybreaks=c(0, 0.4, 0.8, 1))
qX <- quadratcount(X, 4, 5)
plot(X)
plot(
Hi,
I have two big data set.
data _1 :
> dim(data_1)
[1] 15820 5
> head(data_1)
Chromosome StartEndFeature GroupA_3
1: chr1 521369 75 chr1-0001 0.170
2: chr1 750001 80 chr1-0002 -0.086
3: chr1 8000
Hi,
I have made violin plot with both ggplot2 and vioplot package with same data.
The results and code are as follows.
### Loading data
data.melt <-
dget("https://gubox.box.com/shared/static/rirth0eym114afwyjxwe128sjzipzdym.txt";)
### Violin plot by library
3 4 5 6 7 8 9 10 11
$b
[1] 6 7 8 9 10
Hope this helps,
Rui Barradas
Em 13-04-2017 15:59, Mohammad Tanvir Ahamed via R-help escreveu:
>
> Hi,
>
> I have a list like
>
> kk<- list (a = 1:5, b = 6:10, c = 4:11)
>
>
> Now i want to merger (Union) the list
Hi,
I have a list like
kk<- list (a = 1:5, b = 6:10, c = 4:11)
Now i want to merger (Union) the list element "a" and "c" by name .
My expected outcome is
kk1<- list(a_c = 1:11, b = 6:10)
I can do it with several lines of code. But can any one have idea to do
efficiently/ quickly on a
Hi,
I have a list like
kk<- list (a = 1:5, b = 6:10, c = 4:11)
Now i want to merger (Union) the list element "a" and "c" by name .
My expected outcome is
kk1<- list(a_c = 1:11, b = 6:10)
I can do it with several lines of code. But can any one have idea to do
efficiently/ quickly on a big da
Hi,
In a folder , there are multiple compressed (zip+tar) files. Each of compressed
file can have multiple layer of compression (compressed file inside the
compressed file and so on).
Can anyone suggest, is there any way to decompress all the files in a single
directory ?
Tanvir Ahamed
Thanks for reply.
as I said , the function in the package is like
myplot <- function(x,y) { plot(x,y) }
not like
myplot <- function(x,y) { plot(x,y,...) }
And I cant change the function inside the package!!
So , in this case how to solve the problem ?
Tanvir Ahamed
Göteborg, Sweden | ma
Hi!,
Lets I have a function form a package.
The function is, as an example,
myplot <- function(x,y) { plot(x,y) }
Now I can use the function according to function's defined argument.
x<- sort(runif(200))
y<- 1:200
myplot(x,y)
Now I want to input extra argument or override default value o
Hi,
I have a list like below.
OB1 <- structure(list(aa0 = NULL,
aa1 = structure("23403", .Names = "BB10"),
aa2 = structure("54904", .Names = "BB20"),
aa3 = structure("22897", .Names = "BB30"),
aa4 = structure("3751", .Names = "BB40"),
aa5 = NULL,
aa6 = structure("3679", .Names = "BB50"),
numeric element in a list
On 06/28/2016 03:03 AM, Mohammad Tanvir Ahamed via R-help wrote:
> Can any one please help me. I will apply this for a very large list, about
> 400k vector in a list and vector size is unequal and large
>
> Example :
> Input:
> a <- c(1,3,6,9,25,100
Can any one please help me. I will apply this for a very large list, about 400k
vector in a list and vector size is unequal and large
Example :
Input:
a <- c(1,3,6,9,25,100)
b<-c(10,7,20,2,25)
c<-c(1,7,5,15,25,300,1000)
d<-list(a,b,c)
Expected outcome :
# When looking for 1 in d
c(1,3)
#
t;
>>>> Hi Tanvir,
>>>> Not at all elegant, but:
>>>>
>>>> make.seq<-function(x) return(seq(x[1],x[2]))
>>>> apply(matrix(c(a,b),ncol=2),1,make.seq)
>>>
>>>
>>> Not sure that this is more "elegant" but it&
Hi,
I want to do the follow thing
Input :
a <- c(1,3,6,9)
b<-c(10,7,20,2)
Expected outcome :
d<-list(1:10,3:7,6:20,2:9)
Thanks !!
Tanvir Ahamed
Göteborg, Sweden | mashra...@yahoo.com
__
R-help@r-project.org mailing list -- To UNSUBS
Hi,
you can try
df1<-split(df,df$groups)
lapply(df1, function(x)
{
x<-cbind(x,entry=0)
sam <- sample(x$plotno,1)
x$entry[which(x$plotno==sam)]<-"CONTROL"
x$entry[which(!x$plotno==sam)]<-"TEST"
x
}
)
Tanvir Ahamed
Göteborg, Sweden | mashra...@yahoo.com
___
(): protection stack overflow
On 03/14/2016 06:39 PM, Mohammad Tanvir Ahamed via R-help wrote:
> Hi, i got an error while i am running a big data. Error has explained
> by the following sample sample
This is an error in the package, and should be reported to the
maintainer. Discover the maintaine
> v3<-list(rep(list(v1),2),rep(list(v2),3))
> v3
[[1]]
[[1]][[1]]
[1] 8 4 9 12
[[1]][[2]]
[1] 8 4 9 12
[[2]]
[[2]][[1]]
[1] 7 8 11
[[2]][[2]]
[1] 7 8 11
[[2]][[3]]
[1] 7 8 11
if you want to track each list category.
Tanvir Ahamed
Göteborg, Sweden | mashra...@yah
Hi,
i got an error while i am running a big data. Error has explained by the
following sample sample
## Load data
mdata <-
as.matrix(read.table('https://gubox.box.com/shared/static/qh4spcxe2ba5ymzjs0ynh8n8s08af7m0.txt',
header = TRUE, check.names = FALSE, sep = '\t'))
## Install and load
every 2 element for a list which are not equal in
length
Dear Mohammad,What's wrong with the result?Best,Jorge.-
On Monday, March 7, 2016, Mohammad Tanvir Ahamed via R-help
wrote:
Hi,
a <- c(1:5)b <- c(1:3)
c <- 1
d <- 5
e <- list(a,b,c,d)
# To extract every 1st ele
] Extract every 2 element for a list which are not equal in
length
Hi Tanvir,
I think what you want is:
lapply(e,"[",1)
lapply(e,"[",2)
Jim
On Tue, Mar 8, 2016 at 11:47 AM, Mohammad Tanvir Ahamed via R-help
wrote:
> Hi,
>
> a <- c(1:5)b <- c(1:3)
&g
Hi,
a <- c(1:5)b <- c(1:3)
c <- 1
d <- 5
e <- list(a,b,c,d)
# To extract every 1st element
lapply(e,"[[",1)
## Out-put
[[1]]
[1] 1
[[2]]
[1] 1
[[3]]
[1] 1
[[4]]
[1] 5
#To extract every 2nd element (Need help in this case)
lapply(e,"[[",2)
## Expected outcome
[[1]]
[1] 2
[[2]]
1:10]
colnames(dat2) <- paste0("SA", 1:5)
dat2[dat1[, "BB"], ] # desired result
Hint: You might want to spend some time to carefully learn the
different major data types in R and the various modes of indexing. In
general, it is not a good default practice to convert matrices
Hi,Here i have written an example to explain my problem
## Data Generationdat<-data.frame(matrix(1:50,ncol=5))
rownames(dat)<-letters[1:10]
colnames(dat)<- c("SA1","SA2","SA3","SA4","SA5")
dat1<-data.frame(matrix(letters[1:20],ncol=4))
colnames(dat1)<-c("AA","BB","CC","DD")
## Row names
v1<-dat1[
Hello,
I want to get object name of a list inside lapply
> c<-list(a=seq(1:5),b=seq(10:20))
> lapply(c,names)
$a
NULL
$b
NULL
Why NULL ?
but i am expecting the names of object . Any help will be appreciated .
I want to grab the names of object inside lapply for further process.
Th
Hello,
I want to get object name of a list inside lapply
> c<-list(a=seq(1:5),b=seq(10:20))> lapply(c,names)$aNULL
$bNULL
Why NULL ?
but i am expecting the names of object . Any help will be appreciated .
I want to grab the names of object inside lapply for further process.
Thanks .
Tanvir A
Hi,
i want to read a file on every 0.5 (or less) second. How can i set this time
loop to read a file ?
Any idea will be appreciated . Thanks . Tanvir Ahamed
Göteborg, Sweden | mashra...@yahoo.com
[[alternative HTML version deleted]]
__
Hi ,
I am using randomForest model in R .
For large number of tree my program takes long time to complete .
In "randomForest" function i can use "do.trace=TRUE" to see the real time
progress . Sample out put in real time on R console is as follows
ntree OOB 1 2 3 4
Hello ,
I am new in R package built.
I want to install one package (randomForest) that will install automatically
while my package(myPack) will install. I am using R studio to built.
My Description file is :
Package: myPackType: PackageTitle: What the Package Does (Title Case)Version:
0.1Date:
Hi ,�
I have a example list like follow�
lst<-list(setNames(c(1,10,50,60,70,80),c("id","id1","math","phy","che","bio")),setNames(c(2,20,45),c("id","id1","phy")),setNames(c(3,30,75),c("id","id1","bio")))
My expected outcome :�
-
Hi, I have a list like below :
> gg
[[1]] assembly1 GCA_000257985
[[2]] assembly1 GCA_17125
[[3]] assembly1 GCA_16805
[[4]] assembly1 GCA_000144955
[[5]] assembly isolation.source1 GCA_000507725
missing
[[6]] assembly
38 matches
Mail list logo