R maile wysyła

admin | wtorek, 15 maj 2012 - 10:46 pm | | Blog-R

Nowa wersja R Studio 0.96

admin | poniedziałek, 14 maj 2012 - 11:42 pm | | Blog-R

hammingDist

Odległość Hamming'a:

hammingDist<-function(x,y){
	if(length(x)!=1 | length(y)!=1)
		stop("x,y - not a single string!")
	if(nchar(x)!=nchar(y))
		stop("x,y - not equal length!")
	tmpX<-strsplit(as.character(x),'')[[1]]
	tmpY<-strsplit(as.character(y),'')[[1]]
	res<-NULL
	for(i in 1:length(tmpX)){
		res[i]<-tmpX[i]!=tmpY[i]
	}
	return(sum(res))
}

Created by Pretty R at inside-R.org

hammingDist<-function(x,y){
	if(length(x)!=1 | length(y)!=1)
		stop("x,y - not a single string!")
	if(nchar(x)!=nchar(y))
		stop("x,y - not equal length!")
	tmpX<-strsplit(as.character(x),'')[[1]]
	tmpY<-strsplit(as.character(y),'')[[1]]
	res<-NULL
	for(i in 1:length(tmpX)){
		res[i]<-tmpX[i]!=tmpY[i]
	}
	result<-list()
	result[['hammingDist']]<-sum(res)
	tmpX[res]<-"."
	result[['commonPattern']]<-paste(tmpX,sep="",collapse="")
	return(result)
}

Created by Pretty R at inside-R.org

hammingDist<-function(x,y){
	if(length(x)!=1 | length(y)!=1)
		stop("x,y - not a single string!")
	if(nchar(x)!=nchar(y))
		stop(paste("x,y - not equal length!\n","x= ", nchar(x),"\ny= ",nchar(y),sep=""))
	tmpX<-strsplit(as.character(x),'')[[1]]
	tmpY<-strsplit(as.character(y),'')[[1]]
	res<-NULL
	for(i in 1:length(tmpX)){
		res[i]<-tmpX[i]!=tmpY[i]
	}
	result<-list()
	result[['hammingDist']]<-sum(res)
	tmpX[res]<-"."
	result[['commonPattern']]<-paste(tmpX,sep="",collapse="")
	return(result)
}

Created by Pretty R at inside-R.org

admin | wtorek, 08 maj 2012 - 11:58 am | | Blog-R

Ostrzeżenie w R

admin | środa, 02 maj 2012 - 1:32 pm | | Blog-R

Animacje w R

admin | środa, 25 kwiecień 2012 - 09:48 am | | Blog-R

Słów kilka o kompilowaniu w R

admin | środa, 11 kwiecień 2012 - 2:28 pm | | Blog-R

Jak R szuka i znajduje

Dla tych, którzy chcą lepiej poznać środowisko R w którym pracują polecam artykuł:

"How R Searches And Finds Stuff"

oraz

"How R Finds Objects (Or What That :: Operator Is For)"

admin | czwartek, 05 kwiecień 2012 - 08:48 am | | Blog-R

Wydano R 2.15.0

Opublikowano najnowszą wersję R'a 2.15.0.

Więcej na ten temat na R-bloggers.

Kod źródłowy można pobrać z:

http://cran.r-project.org/src/base/R-2/R-2.15.0.tar.gz

admin | piątek, 30 marzec 2012 - 5:02 pm | | Blog-R