[R] Join and Meet on Lattice

2011-05-10 Thread Vahid
due to commands that I use. But I can't see it. Is there any one who can help me? vahid * The code: #library(partitions) library(clue) # First clear all rm(list=ls(all=TRUE)) # n: number of balls # k: number of urns # this is for the case of no difficulty # delta show

[R] Reading from a webpage

2020-04-27 Thread Vahid Borji
Hi there, I am using R. I want to save a text, which is inside the following webpage, in a variable, and then want to answer some questions. http://en.neyshabur.ac.ir/en/119-about-city-of-neyshabur/1232-city-of-neyshabur My questions are: 1) How many words do exist in the text (of the webpage)?

[R] Information from a webpage using R

2020-04-27 Thread Vahid Borji
Hi there, I faced difficulty while programming in R. How can I save a text, which is inside a webpage, in a variable, and then find (specify) words (of the text) that have more than 9 letters? [[alternative HTML version deleted]] __ R-help@r-pro

[R] How can I solve an error after installing RStudio

2020-04-29 Thread Vahid Borji
Hi there, I downloaded Rstudio and installed it on my laptop. When I want to open Rstudio I see the below message: The program can't start because api-ms-win-runtime-|1-1-0.dll is missing from your computer. Try reinstalling the program to fix this problem. Could you please help me how I can solv

[R] The best way for making speciall matrix

2020-05-23 Thread Vahid Borji
Hi my friends, I want to make the below matrix in r: 1 0 0 4 0 2 0 5 0 0 3 6 I used the below code: matrix(c(1,0,0,0,2,0,0,0,3,4,5,6),nrow=3) My code works. But I do not like my solution way. I am thinking to find the simplest way for making this matrix. Do you think my code is the simplest

[R] How to make a vector with string elements without space

2020-05-23 Thread Vahid Borji
Hello my r friends, I want to make a vector with elements (c1,c2,...,c10). I wrote the below code: c(paste("c",1:10)) My code works but it gives me elements like "c 1", "c 2" to "c 10". I mean there is a space between each c and its corresponding number. I want the elements of the vector to be like

[R] min rows multiplication by the max rows

2020-05-23 Thread Vahid Borji
Hi my R friends, I have two matrices as follows: M<-matrix(c(1,4,1,3,1,4,2,3,1,2,1,2),3) 1322 4131 1412 N<-matrix(c(1,1,2,2,3,4,-2,2,1,4,3,-1),3) 12 -24 1323 241 -1 I want to find a vector which is a matrix 1*3 and each of it

[R] How to fix an error in nonlinear regression

2020-05-27 Thread Vahid Borji
Hello my R friends, I am using the below commands in R: attach(Puromycin) Puromycin plot(Puromycin$conc,Puromycin$rate) mm=function(conc,vmax,k) vmax*conc/(k+conc) mm mm1=nls(rate~mm(conc,vmax,k),data=Puromycin,start=c(vmax=50,k=0.05),subset=state==”treated”) mm1 Unfortunately, I receive the bel

Re: [R] How to fix an error in nonlinear regression

2020-05-27 Thread Vahid Borji
Thanks a lot. On Thu, May 28, 2020 at 1:15 AM John Kane wrote: > You have subset=state==”treated”). You need to change "treated” to > "treated". Tho " " are formatted in your example. > > On Wed, 27 May 2020 at 15:48, Vahid Borji wrote: > >> Hello

[R] How to create a warning inside the factorial function for decimal numbers

2020-06-01 Thread Vahid Borji
I am writing a code for the factorial function. My code is as follows: > f<- function(n){+ factorial <- 1+ if( n < 0 )+ print("Factorial of negative > numbers is not possible")+ else if( n == 0 )+ print("Factorial of 0 is 1")+ > else {+ for(i in 1:n)+ factorial <- factorial * i+ print(paste("Fac

[R] mnormt package for bivariate normal distribution

2020-06-17 Thread Vahid Borji
Hi, my R friends, I am going to plot the surface of a bivariate normal distribution and its contours. I have written the below codes: library(MASS) set.seed(69) n <- 5000 x <- rnorm(n, 0, 15) y <- 0.5 * x + rnorm(n, 0, 10) z <- kde2d(x, y, n = 50) persp(z, theta = 55, phi = 35, shade = 0.

[R] Playing a music file in R

2020-07-21 Thread Vahid Borji
Hello my R friends, How can we call a music file from our laptop (for example from desktop) and play it in R? Could you please give me an explicit example by writing commands in R. Is it necessary for our music file to be in a specific format? If yes, which format it has to be? Thank you in advan

[R] Notes of music in R

2020-07-23 Thread Vahid Borji
Hellol, I am trying to compose and play the start music of the serial "Game of Thrones" in R. I would like to do it by making a vector of notes of this music, then play this vector. I have read the following link, it is about making "Jingle Bells" music: https://towardsdatascience.com/compose-and

[R] Writing Persian (Arabic) in a data frame

2020-07-27 Thread Vahid Borji
I am trying to make a data frame including two vectors. The first vector is a vector of Persian names, and the second vector is a vector of numbers. My code is as follows: A<-data.frame(x=c("مریم","ماریا"),y=c(1,1)) A But when I run these codes I do not receive my desired output. Indeed the colum