Displaying 20 results from an estimated 5000 matches similar to: "Using loops to run functions over a list of variables"
2009 Mar 31
3
'for Loop'
Hello,
I'm trying to create a for loop for a data set, I have a list of results in this data set and I want to take the 1st two add them together and divide by the mean of the 1st to, then do the same for the 3rd and 4th values in the list and so on and each time return a value for the calculation on each pair.
Any help would be appreciated.
Thanks,
Al
[[alternative HTML version
2009 Mar 27
2
Sorting problem
Hi, everyone,
I was trying to sort a data frame by two columns, one increasing, the other
decreasing and got an error.
"Error in FUN(left) : invalid argument to unary operator",
The command is "BA[order(BA[1],-BA[2]),]". BA is the data frame. It was
working if I used increasing on both columns.
Why the decreasing symbol "-" is not working here? Thanks.
--
Jun
2009 Apr 15
2
How to extract p-value into a table from a groups of t test
Hi,
I have run a groups of t test and obtained a list of the t-test results
(about 30). How do I extract p-values from the 30 t-test results and make a
table output? Thanks
Jun
Example t-test output:
============================
$Lambda_z
Welch Two Sample t-test
data: x[PA1.BS.DN$Onecode == 2] and x[PA1.BS.DN$Onecode == 3]
t = -0.1128, df = 33.635, p-value = 0.9109
alternative
2009 Aug 19
2
Contrasts within ANOVA frame (Repost)
Would like to try my luck to see if I can catch your eyes.
I was trying to do some contrasts within ANOVA. I searched the archive and
found a clue posted by Steffen Katzner
( http://tolstoy.newcastle.edu.au/R/help/06/01/19385.html)
I have three levels for a factor names "StdLot" and want to make three
comparisons, 1 vs 2, 1 vs 3 and 2 vs 3.
First,
2009 Aug 19
3
Fitting a logistic regression
Hello,
I have this data:
Time AMP
0 0.2000000
10 0.1958350
20 0.2914560
40 0.6763628
60 0.8494534
90 0.9874526
120 1.0477692
where AMP is the concentration of this metabolite with time. If you plot
the data, you can see that it could be fitted using a logistic
regression. For this purpose, I used this code:
AMP.nls <- nls(AMP~SSlogis(Time,Asym, xmid, scal), data
2009 Mar 08
1
R console misc questions
hi, all
I have two questions on using R console effectively (this is on Mac,
not sure if it applies to win platform):
First, I'd like to make the console font bigger, the default is too
small for my screen. There is a "Show Fonts" from Format menu where
you can adjust it, but it seems only for current session. Next time I
start R, I have to redo everything. My question is, is there
2009 Jul 30
1
package lattice can't be loeaded
I try to load the package lattice by library(lattice).
Although I have installed it through CRAN by internet as well as from a local directory using the zip-file, it can't be loaded into the editor.
Can anyone give advice, please.
I am using R 2.9.1 on Widows XP.
Thanks a lot,
Luba
[[alternative HTML version deleted]]
2009 Aug 19
3
a naive question
Hi, and my apologies for the following very naive question : I would like to
read a column of numbers in R and plot a histogram.
eg :
x<-read.table("txSTART");
y<-as.numeric(x);
and I do obtain the error : Error: (list) object cannot be coerced to type
'double'. Please could you let me know the way to fix it.
thanks,
bogdan
<r-help@r-project.org>
[[alternative
2009 Apr 03
2
how to sort and plot data?
hi,
Previously my email very simple and less information. Let say I have raw
data as below:-
user_id website time
20 google 0930
21 yahoo 0935
20 facebook 1000
25 facebook 1015
61 google 0940
60 yahoo 1050
40 friendster 1115
61 google 1200
40
2009 Aug 21
2
Problem with passing a string to subset
Dear R-users,
The following question bothered me for the whole afternoon: how can one
pass a string as the conditioning argument to subset? I tried plain
mystr, eval(mystr), expression(mystr), etc... I don't to be able to find
the correct syntax
> foo <- data.frame(a=1:10,b=10:1,c=rep(1:2,5))
> mystr<-"c==1"
> subset(foo,c==1)
a b c
1 1 10 1
3 3 8 1
5 5 6
2009 Sep 04
3
Using anova(f1, f2) to compare lmer models yields seemingly erroneous Chisq = 0, p = 1
Hello,
I am using R to analyze a large multilevel data set, using
lmer() to model my data, and using anova() to compare the fit of various
models. When I run two models, the output of each model is generated
correctly as far as I can tell (e.g. summary(f1) and summary(f2) for the
multilevel model output look perfectly reasonable), and in this case (see
below) predictor.1 explains vastly more
2009 Aug 05
3
import data into R
Thank you Gabor Grothendieck for your answer !!
i have charge the pachage but now i have this massage
read.table("c:/TOTAL.xls",h=T)
[1] ÐÏ.à..
<0 rows> (or 0-length row.names)
Warning messages:
1: In read.table("c:/TOTAL.xls", h = T) :
incomplete final line found by readTableHeader on 'c:/TOTAL.xls'
2: In if (!header) rlabp <- FALSE :
the condition has
2009 Mar 16
3
sort data frame columns according to a list
HI,
I have searched the R-help achive, trying to find a way to sort columns in a data frame according to a specific list, but not be able to find a general way to do it.
My data frame contains columns, with each one named from a sample ID, and each sample was measured in a specific time, generating one column of data, now I would like to sort the columns according to the time course, so I have
2009 Apr 18
4
Loop question
Hi everyone, I am trying to accomplish a small task that is giving me
quite a headache. I would like to automatically generate a series of
matrices and give them successive names. Here is what I thought at
first:
t1<-matrix(0, nrow=250, ncol=1)
for(i in 1:10){
t1[i]<-rnorm(250)
}
What I intended was that the loop would create 10 different matrices
with a single column of 250
2009 Apr 09
2
failed when merging two dataframes, why
Hi, R-listers,
Failed, when I tried to merge df1 and df2 by "codetot" in df1 and "codetoto"
in df2. I want to know the reason and how to merge them together. Data
frames and codes I have used were listed as followed. Thanks a lot in
advance.
df1:
popcode codetot p3need
BCPy01-01 BCPy01-01-1 100.0000
BCPy01-01 BCPy01-01-2 100.0000
BCPy01-01 BCPy01-01-3 100.0000
BCPy01-02
2010 Apr 16
6
bwplot puts the bars in the wrong place
Dear R-Help,
With the attached data set, I am still getting incorrect bwplots
> xyplot(gdf$tt~gdf$OnHour |gdf$Runway, data=gdf) # Is correct
> bwplot(gdf$tt~gdf$OnHour |gdf$Runway, data=gdf, horizontal=FALSE) #
Puts the boxes on the wrong x-axis values
# look especially at 0 and 3. How do I fix this?
What is happening?
Thanks,
Jim Rome
2010 May 07
1
How to pass value to an argument in a function which is an argument to the main function
Dear all,
I constructed this function called my.boxplot.stats by replacing fivnum()
with quantile() in function boxplot.stats(). So I can try different quantile
methods in bwplot(). The problem is I couldn't pass different values to the
"type" argument to my.boxplot.stats, which in turn is an argument in
bwplot(). Now I just have to manually change the "type" value in
2009 Mar 07
4
merge data frames with same column names of different lengths and missing values
Hello, I'm switching over from SAS to R and am having trouble merging data frames. The data frames have several columns with the same name, and each has a different number of rows. Some of the values are missing from cells with the same column names in each data frame. I had hoped that when I merged the dataframes, every column with the same name would be merged, with the value in a complete
2002 Jul 02
4
Samba 2.2.4 and PRINT$
Hi,
I'm having difficulty configuring Printing with Samba 2.2.4 and Windows
2000 clients.
The samba installations is running as a PDC against LDAP. All the
sharing of network file systems seem to be working perfectly..
I have a share
[printers]
path = /usr/spool/samba
guest ok = yes
printable = yes
browsable = no
guest ok = yes
writable =
2007 Apr 23
2
stringsAsFactor global option (was "character coerced to a factor")
--- Gabor Grothendieck <ggrothendieck at gmail.com>
wrote:
> Just one caveat. I personally would try to avoid
> using
> global options since it can cause conflicts when
> two different programs assume two different settings
> of the same global option and need to interact.
I see this argument often, and don't buy it. In any case, for this
particular option, the