similar to: How to 'understand' R functions besides reading R codes

Displaying 20 results from an estimated 4000 matches similar to: "How to 'understand' R functions besides reading R codes"

2010 Jun 24
2
count data with a specific range
I would like to prepare the data for barplot. But I only have the data frame now. x1=rnorm(10,mean=2) x2=rnorm(20,mean=-1) x3=rnorm(15,mean=3) data=data.frame(x1,x2,x3) If there a way to put data within a specific range? The expected result is as follows: range x1 x2 x3 -10-0 2 5 1 (# points in this
2010 Jun 22
2
Verify the linear regression model used in R ( fundamental theory)
Hi, folks, As I understand, Least-squares Estimate (second-moment assumption) and the Method of Maximum Likelihood (full distribtuion assumption) are used for linear regression. I do >?lm, but the help file does not tell me the model employed in R. But in the book 'Introductory Statistics with R', it indicates R estimate the parameters using the method of Least-squares. However it
2010 Jun 18
1
How to calculate the robust standard error of the dependent variable
Hi, folks linmod=y~x+z summary(linmod) The summary of linmod shows the standard error of the coefficients. How can we get the sd of y and the robust standard errors in R? Thanks! [[alternative HTML version deleted]]
2010 Jun 26
1
All a column to a data frame with a specific condition
Hi, folks, Please first look at the codes: plan_a=c('apple','orange','apple','apple','pear','bread') plan_b=c('bread','bread','orange','bread','bread','yogurt') value=1:6 data=data.frame(plan_a,plan_b,value) library(plyr) library(reshape) mm=melt(data, id=c('plan_a','plan_b'))
2010 Jun 21
2
How to predict the mean and variance of the dependent variable after regression
Hi, folks, As seen in the following codes: x1=rlnorm(10) x2=rlnorm(10,mean=2) y=rlnorm(10,mean=10)### Fake dataset linmod=lm(log(y)~log(x1)+log(x2)) After the regression, I would like to know the mean of y. Since log(y) is normal and y is lognormal, I need to know the mean and variance of log(y) first. I tried mean (y) and mean(linmod), but either one is what I want. Any tips? Thanks in
2012 Aug 29
3
Help on calculating spearman rank correlation for a data frame with conditions
Dear all, Suppose my data frame is as follows: id price distance 1 2 4 1 3 5 ... 2 4 8 2 5 9 ... n 3 7 n 8 9 I would like to calculate the rank-order correlation between price and distance for each id. cor(price,distance,method = "spearman") calculate a correlation for all. Then I tried to use apply(data,list='id',cor(price , distance , method =
2010 Jul 21
2
Variance of the prediction in the linear regression model (Theory and programming)
Hi, folks, Here are the codes: ############## y=1:10 x=c(1:9,1) lin=lm(log(y)~x) ### log(y) is following Normal distribution x=5:14 prediction=predict(lin,newdata=x) ##prediction=predict(lin) ############### 1. The codes do not work, and give the error message: Error in eval(predvars, data, env) : numeric 'envir' arg not of length one. But if I use the code after the pound sign, it
2010 Sep 02
1
How to generate integers from uniform distribution with fixed mean
Hi, folks, runif (n,min,max) is the typical code for generate R.V from uniform dist. But what if we need to fix the mean as 20, and we want the values to be integers only? Thanks [[alternative HTML version deleted]]
2010 Jun 25
2
Delete rows in the data frame by limiting values in two columns
Hi, folks, Finally Friday~~ Here comes the question: x=c('germany','poor italy','usa','england','poor italy','japan') y=c('Spain','germany','usa','brazil','england','chile') s=1:6 z=3:8 test=data.frame(x,y,s,z) #Now I only concern the countries ('germany','england','brazil').
2010 Jul 02
2
how to save summary(lm) and anova (lm) in format?
Hi, folks, I would like to copy the output of summary(lm) and anova (lm) in R to my word file. But the output will be a mess if I just copy after I call summary and anova. ##################### x=rnorm(10) y=rnorm(10,mean=3) lm=lm(y~x) summary(lm) Call: lm(formula = y ~ x) Residuals: Min 1Q Median 3Q Max -1.278567 -0.312017 0.001938 0.297578 1.310113
2010 Jun 29
3
How to delete the replicate rows by summing up the numeric columns
Hi, folks, I am sorry that I did not state the problem correctly yesterday. Please let me address the problem by the following codes: first=c('u','b','e','k','j','c','u','f','c','e')
2011 Nov 07
1
close but no cigar
Hi Everyone: It turns out that there's still a small ( I hope ) problem. I'm close but that only counts in horse shoes and hand grenades. Here's my problem: When trying to load a package that I am writing, the load is looking for the packageDescription function in the utils package but not finding the utils package. I looked on cran and utils is not there which makes me think that it
2010 Jun 01
1
any doc to understand arima state space model?
I am trying to understand R arima function. Any pointers would be appreciated. Thank you, Shakira. [[alternative HTML version deleted]]
2004 Jul 15
2
[LLVMdev] Constants.cpp:368: error: `INT8_MAX' undeclared (firstuse this function)
On Thu, 15 Jul 2004 17:57:20 -0500 (CDT) Chris Lattner <sabre at nondot.org> wrote: > CPR would be really nice. There is also this ephemeral PPC support that > may or may not make it, but would be really awesome it if did. I would > also like to turn on some sort of interprocedural alias analysis by > default (for performance). CPR might make it in the next couple of weeks.
2009 Mar 31
1
error when going through Alan Lenarcic's package Tutorial
Hi Everyone: I've been going through Alan Lenarcic's package tutorial but when I did R CMD SHLIB Xdemo.cc Xdemo_main.cc -o Xdemo.dll I got the following error: XDemo_res.rc:15:38: warning: missing terminating " character XDemo_res.rc:23:34: warning: missing terminating ' character c:\mark\research\Rtools\MinGW\bin\windres.exe: XDemo_res.rc:16: syntax error
2011 Nov 06
2
still working on building R from source
Hi Everyone: Gavin's been so generous and patient that I figured I'd give him a break and send this snag to the list. When I do get this working, I will send an "How to build R from the tarball " instructions message to this list for posterity's sake ( and myself and anyone else who doesn't know how to build R from the tarball ). So, here's my latest snag: Gavin
2009 Mar 12
0
FW: Re: Writing xls - multiple sheets
Jorge was kind enough to point out that I made a mistake in referencing gabor's solution. See below. Thanks Jorge. -------- Begin forwarded message -------- Subject: Re: [R] Writing xls - multiple sheets Date: 3/12/2009 6:03:13 PM From: Jorge Ivan Velez To: markleeds@verizon.net Hi Mark, Yes, he did (as always), but it is not what Ferry needed. Here is Gabor's post:
2006 Jul 06
2
[Fwd: as.data.frame question]
>From: markleeds at verizon.net >Date: Thu Jul 06 13:16:42 CDT 2006 >To: markleeds at verizon.net >Subject: as.data.frame question >hi all : as a result of an lapply command, >i get the following output. > > >$AAA > 000106 000107 000108 > 5.5 6.5 3.0 > >$BBB > 000106 000107 000108 > 4 5 6 > >$CCC
2020 Jan 15
4
A bug understanding F relative to FALSE?
Hi all, Is the next behaviour suitable? identical(F,FALSE) ## [1] TRUE utils::getParseData(parse(text = "c(F,FALSE)", keep.so=rce = TRUE)) ## line1 col1 line2 col2 id parent token terminal text ## 14 1 1 1 10 14 0 expr FALSE ## 1 1 1 1 1 1 3 SYMBOL_FUNCTION_CALL TRUE c ## 3 1 1 1 1 3
2009 Apr 01
1
problems with package tutorial
Hi: Here's my revised attempt at explaining my problem. Hopefully it won't get sent out weirdly like it did earlier. ? The link to what I'm trying to follow is http://www.stat.columbia.edu/~gelman/stuff_for_blog/AlanRPackageTutorial.pdf ? I've been going through the tutorial but when I got to page 9 and did R CMD SHLIB Xdemo.cc Xdemo_main.cc -o Xdemo.dll I got