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
Sweden | mashra...@yahoo.com
- Original Message -
From: Franklin Bretschneider
To: Mohammad Tanvir Ahamed ; R-help groep
Sent: Saturday, 11 March 2017, 22:45
Subject: Re: [R] Override/Insert (Change) a value (default value) inside a
function
Dear Mohammad Tanvir Ahamed,
Re:
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"),
Thanks Martin Morgan. Thats works excellent on a large data .
Tanvir Ahamed
Göteborg, Sweden | mashra...@yahoo.com
- Original Message -
From: Martin Morgan
To: Mohammad Tanvir Ahamed ; R-help Mailing List
Sent: Tuesday, 28 June 2016, 11:07
Subject: Re: [R] Get the location of a
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
___
Thanks . I have informed package maintainer.
Tanvir Ahamed
Göteborg, Sweden | mashra...@yahoo.com
- Original Message -
From: Martin Morgan
To: Mohammad Tanvir Ahamed ; R-help Mailing List
Sent: Tuesday, 15 March 2016, 13:26
Subject: Re: [R] R problem : Error: protect
> 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
Hi Jorge,
Thanks . Some how i have messed up mu lapply function.Worked upon restart.
Tanvir Ahamed
Göteborg, Sweden | mashra...@yahoo.com
From: Jorge I Velez
To: Mohammad Tanvir Ahamed
Cc: R-help Mailing List
Sent: Tuesday, 8 March 2016, 3:04
Subject: Re: [R] Extract
Hi Jim,
Thanks . Some how i have messed up mu lapply function.
Worked upon restart.
Tanvir Ahamed
Göteborg, Sweden | mashra...@yahoo.com
- Original Message -
From: Jim Lemon
To: Mohammad Tanvir Ahamed
Cc: R-help Mailing List
Sent: Tuesday, 8 March 2016, 3:00
Subject: Re: [R
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
HI !!
try it
format(Sys.time(), "%Y_%m_%d_%X")
Best regards
...
Tanvir Ahamed
Göteborg, Sweden
From: "Yuan, Rebecca"
To: R help
Sent: Wednesday, 15 January 2014, 15:56
Subject: [R] Format Sys.time()
Hello all,
I know that th
Hi !
Try it
st<-'yab~a+b+c'
strsplit(st,"~")[[1]][1]
Best regards
...
Tanvir Ahamed
Göteborg, Sweden
From: "Yuan, Rebecca"
To: R help
Sent: Wednesday, 15 January 2014, 15:38
Subject: [R] How to get a substring from a string
Hi there !!
I have a matrix like
> mm
[,1] [,2] [,3]
[1,] 1 11 21
[2,] 2 12 22
[3,] 3 13 23
I have a list of position index like
> pos
$row1
[1] 1 3
$row2
[1] 3 2
$row3
[1] 1 3 2
I have a list of values like
> gty
$v1
9 3
$v2
4 8
$v3
7 4 1
llo,
Try the following.
lapply(lis, function(i) df[i, ])
Hope this helps,
Rui Barradas
Em 03-01-2014 09:04, Mohammad Tanvir Ahamed escreveu:
> Hi there !!
>
> I have a list like as follows :
>> lis
> $lis1
> [1] 1 3 5
>
> $lis2
> [1] 2 4 6 8 9
>
> I have anoth
Hi there !!
I have a list like as follows :
>lis
$lis1
[1] 1 3 5
$lis2
[1] 2 4 6 8 9
I have another data frame like as follows
>df
1 10 110
2 15 120
3 20 130
4 25 140
5 30 150
6 35 160
7 40 150
8 45 180
9 50 190
Now i want to select the rows of data frame by the value of list and the output
Thanks !!
Best regards
...
Tanvir Ahamed
Göteborg, Sweden
On Monday, 11 November 2013, 13:49, Uwe Ligges
wrote:
On 11.11.2013 13:31, Mohammad Tanvir Ahamed wrote:
> Hi there !!
> I have a function like
> fun <- function(x,y)
> {
> loe<
Hi there !!
I have a function like
fun <- function(x,y)
{
loe<-loess(y ~ x,span=0.9,family="gaussian")
pre<-predict(loe,data.frame(x=x))
return(pre)
}
Now i have defined :
x<-1:500
y<-matrix(rnorm(1000,3),ncol=2)
I can manipulate fun(x,y[,1]) .
But i want to apply the function on each column
Hi,
I can run the code some days ago . But cant run now.
Problem 1: Output is ok
ensembl = useDataset("hsapiens_gene_ensembl",mart=ensembl)
utr5 = getSequence(chromosome=3, start=185514033, end=185535839,
type="entrezgene",seqType="5utr", mart=ensembl)
Output :
Hi !
Facing problem with " getSequence" commend .
when only biomaRt package loaded the following example working well
>mart <- useMart("ensembl",dataset="hsapiens_gene_ensembl")
>seq = getSequence(id="BRCA1", type="hgnc_symbol", seqType="peptide", mart =
>mart)
show(seq)
but when i have lo
Hello all ,
I have a data frame like this
X1X2X3
11815
22916
331017
441118
551219
661320
771421
now i want to randomly reorder the variable X2 but the row element should be
same
as for example
X1X2X3
12916
251219
331017
471421
561320
61815
741118
how can i do that ??
Hint :
this could b
hi , this can be done easily if (cond) expr
ex:
> for (i in 1: 4)+ {+ if(i==2) print("a")+ if(i==2) print("b")+ }
output : [1] "a"[1] "b"
but i want this
if (cond) expr1 expr 2
i tried this :
> for (i in 1: 4)+ {+ if(i==2) (print("b") && print("a"))+ }
output : [1] "b"Error in print("b") && prin
49 matches
Mail list logo