Displaying 20 results from an estimated 7000 matches similar to: "insert a dot to the numbers"
2010 Aug 24
3
generate random numbers from a multivariate distribution with specified correlation matrix
Hi all,
rmvnorm()can be used to generate the random numbers from a multivariate
normal distribution with specified means and covariance matrix, but i want
to specify the correlation matrix instead of covariance matrix for the
multivariate
normal distribution.
Does anybody know how to generate the random numbers from a multivariate
normal distribution with specified correlation matrix? What about
2010 Apr 21
2
problem of R CMD check
Hi all,
Today, i just installed the newest R version 2.10.1 and other necessary
tools for building R package under windows,e.g. Rtools, perl. All are the
newest version.
After the correct configuration under windows, i use it to re-check my old
package. I found the following prolem when checking EXAMPLE, which did not
exist before this re-installation.
########
* checking examples ... ERROR
2011 Dec 24
2
readLines errors
Hi All,
I met a problem using readLines function to return the data from Google
maps.
readLines(url("
http://ditu.google.cn/maps/geo?q=+qianshuichong,+guichi+anhui,+CN&output=csv&key=ABQIAAAAq8Fnd_oUka-7RdS6BrD7GBTqeABoQuNTXS36G_rkiwQnKRW6GBTkns8JpKz6y6dScgB8827dlddUlg"),
n=1, warn=FALSE)
[1] "200,4,30.6528380,117.4872250"
The above code is ok because the
2009 Nov 09
2
Outputing multilple subsets
Hi Rusers,
I hope to divide the original dataset into several subsets and output
these multilple datasets. But errors appeared in my loops. See example.
######
a<-c(1:10)
b<-c(rep(1,3),rep(2,3),rep(3,4))
c<-data.frame(a,b) #c is the example data
num<-c(unique(b))
# I hope to get the subsets c_1.csv,c_2.csv and c_3.csv
#Errors
for (i in num) {
c_num<-c[c$b==num,]
2010 Sep 16
2
use same breaks and colors, but the displayed scale are different-image.plot()
Hi all,
I want to put several figures in a one figure for easy comparison, so i
need to use the same methods to plot these figures. The following is an
example. I also list my method, but it does not work.
#Example data
x<- 1:10; y<- 1:10; z<- outer( x,y,"+");z2<- outer( x,y,"-")
#Quick view them
image.plot(x,y,z) #relatively larger value
image.plot(x,y,z2)
2009 Dec 25
1
checking package errors-'require' calls not declared and no visible global function definition
Hi,
I got two errors after i checking my package. The errors are as follows,
Error1:
* checking for unstated dependencies in R code ... WARNING
'library' or 'require' calls not declared from:
boot np
Error2:
* checking R code for possible problems ... NOTE
myfunction: no visible global function definition for 'npudensbw'in the np
package
In "myfunction", i
2010 Jan 19
1
forgot the function to divide a dataset into equal parts
Hi,
I just cannot remember the R function to divide a dataset into equal
parts. And i searched the "divide dataset into equal parts" in R site, but
cannot find it.
Anybody can tell me that function. I am just blocked by it.
Thanks a lot.
--
-----------------
Jane Chang
Queen's
[[alternative HTML version deleted]]
2010 Jan 20
1
Change an array into a dataset of four variables, dim1, dim2, dim3 and its elements
Hi,
See my example below.
a<-array(1:12,c(2,3,2))
> a
, , 1
[,1] [,2] [,3]
[1,] 1 3 5
[2,] 2 4 6
, , 2
[,1] [,2] [,3]
[1,] 7 9 11
[2,] 8 10 12
I want to get a result something like
dim1 dim2 dim3 elements
1 1 1
1 2 1
1 3 2
2 1 2
I tried the data.frame and expand.grid functions,
2010 Feb 26
1
split function
Hi,
I am using split function and wonder how to add the factor to the splitted
results.
#Example
n <- 3; nn <- 10
g <- factor(round(n * stats::runif(n * nn))) #factor
x <- rnorm(n * nn) + sqrt(as.numeric(g)) #value
xg <- split(x, g)
xg
$`0`
[1] 0.82513702 -0.03911584 2.32955347 0.36745335 1.75572642 2.65461438
0.41675829
$`1`
[1] 0.8583493 2.4264804 -0.3622378
2010 Aug 31
1
cannot allocate vector of size 381.5 Mb
Hi,
I read some posts from the mailing list on the same problem, but it seems
that i still cannot solve this problem.
I only want to generate some simulated data.
#Generate 2500 observations-it works without errors
> coords<-as.matrix(expand.grid(seq(0,100,length.out=50),
seq(0,100,length.out=50)))
#SimData is a user-written function
> SimBinData<-SimData(n=2500,coords=coords,
2010 Jan 07
2
"%d/%m/%Y" can not be displayed in a .rd file
Hi all,
I found the date format (e.g."%d/%m/%Y") in the .rd file cannot be
displayed after building the package. See below,
###.rd file####
\examples{
a<-"10/20/1999"
DateConversion(a,DateIn="%m/%d/%Y",DateOut="%d/%m/%Y")
}
####The result is ####
Examples:
a<-"10-20-1999"
DateConversion(a,DateIn="
??"%m/%d/%Y"
2009 Nov 13
2
why the same values cannot be judged to be the same in R
Hi Rusers,
I found sometimes that the same values cannot be judged to be the same in
R. Anybody knows the probelm? I think i ignored some minor detail. Thanks.
Here is the example.
############
data1<-matrix(data=c(1,1.2,1.3,"3/23/2004",1,1.5,2.3,"3/22/2004",2,0.2,3.3,"4/23/2004",3,1.5,1.3,"5/22/2004"),nrow=4,ncol=4,byrow=TRUE)
2010 Jan 20
2
could we use ":" to represent multiple matrice in a list or sequential chracter names
Hi,
I know we can use 1:10 to represent the 1,2,3,...,10 numbers, but the
following conditions are except.
Anybody knows how to represent the following two cases with similar usage
of ":" or others? Usually, i will get several hundred names for them, such
as a1,a2,... or f[[1]],f[[2]],...
#Example data
a1<-array(1:12,c(2,3,2)); a2<-array(2,c(2,3,2)); a3<-array(0,c(2,3,2))
2009 Dec 09
1
Why cannot get the expected values in my function
Hi,
In the following function, i hope to save my simulated data into the
"result" dataset, but why the final "result" dataset seems not to be
generated.
#Function
simdata<-function (nsim) {
result<-matrix(NA,nrow=nsim,ncol=2)
colnames(result)<-c("x","y")
for (i in 1:nsim) {
set.seed(i)
result[i,]<- cbind(runif(1),runif(1))
}
2010 Jan 06
1
Anybody can suggest a better method to build a package while ignoring some functions
Hi,
Say i have three functions in a new package, a,b and c. I only want the one
function "a" to be exported for use. "b" and "c" are not very stable.
If i specify to export all the three functions in the NAMESPACE file
(export(a,b,c)), no errors appeared after checking the package. And i am
sure there should be no errors.
But if i only export the one function
2010 Jan 19
1
change codes into loops
Hi,
See example.
for (i in 1:2) {
for (j in 1:3) {
b_1[i,j]<-rank(c(a1[i,j],a2[i,j],a3[i,j]))[1]
b_2[i,j]<-rank(c(a1[i,j],a2[i,j],a3[i,j]))[2]
b_3[i,j]<-rank(c(a1[i,j],a2[i,j],a3[i,j]))[3]
}
}
The inner codes is really repeated, so i want to change the inner codes
into loops. Take nn is from 1 to 3,
something like,
for (nn in 1:3) {
2010 Jan 18
1
problem of data manipulation
Hello,
See my problem below.
a<-data.frame(c("s","c","c","n","n","n"),c(rep(1,3),rep(2,3)),c(rep(2,3),rep(1,3)),c("01/01/1999","10/02/2000","13/02/2000","11/02/2000","15/02/2000","23/02/2000"))
2010 Apr 07
1
Use a variable of a list in a loop
Hi all,
My problem may be related with the list manipulations. See below.
#example data
a<-list()
a[[1]]<-data.frame(matrix(c(1:4),ncol=2));
a[[2]]<-data.frame(matrix(c(5:8),ncol=2))
I can use a[[1]]$X1,a[[1]]$X2,a[[2]]$X1,a[[2]]$X2 to use the corresponding
variables. But what i need to do is to use function parameters to specify
the variable names. The variable names will be
2010 Apr 22
1
Question of R CMD check
Hi all,
Today, i just installed the newest R version 2.10.1 and other necessary
tools for building R package under windows,e.g. Rtools, perl. All are the
newest version.
After the correct configuration under windows (configuration should be
correct), i use it to re-check my old package. I found the following prolem
when checking EXAMPLEs in each function, which did not exist before this
2010 Mar 15
1
Error--memory could not be "read"
Hi,
I wrote my own function to finish my work. One strange thing happened. If
i set the number of simulations to be "10", it goes correctly. But if i set
the number of simulations into "100", then errors appeared.
Error information: The instruction at "0x6abf12cf" referenced memory at
"0x0286fff8". The memory could not be "read".
Anybody met