Displaying 20 results from an estimated 3000 matches similar to: "simple maths question"
2008 Dec 06
1
assigning a new variable to multiple data frames
Dear R community,
I am trying to assign a new variable (named "new") to multiple dataframes
by a loop and do not succeed... Can you please help?
Thank you and best regards, Georg Ehret.
> c
V1 V2 V3 V4 V5 V6 V7 V8 V9 V10
1 1 11 21 31 41 51 61 71 81 91
2 2 12 22 32 42 52 62 72 82 92
3 3 13 23 33 43 53 63 73 83 93
4 4 14 24 34 44 54 64 74 84 94
5 5 15 25 35 45 55 65
2008 Dec 06
1
plotting several datasets with different scales into same plot
Dear Miss R,
I wish to plot three datasets on completely different scales into one
single plot. Until now I use a complicated procedure, converting the data of
the second and third set into coordinates of the first plot and then adding
an extra axis. Is there a way to do this more simply...?
Thanking you and wishing you all an excellent Sunday!
Cheers, Georg.
*************************
Georg
2008 Nov 22
1
applying an operation for several dataframes
Dear R community,
I am trying to apply a simple operation to several dataframes (e.g.
nrow) and cannot get the looping to work. My objective is to get an output
that indicates me the number of rows for every dataframe.
> c
V1 V2 V3 V4 V5 V6 V7 V8 V9 V10
1 1 11 21 31 41 51 61 71 81 91
2 2 12 22 32 42 52 62 72 82 92
3 3 13 23 33 43 53 63 73 83 93
4 4 14 24 34 44 54 64 74 84 94
5 5
2009 Jan 20
2
plotting points with two colors
Dear Miss R,
I am trying to plot a scatterplot in which the points (round) should
have two colors: half red and half blue (if you want: two half solid circles
put together. Can you please help me to realize this efficiently?
Thank you,
Best regards, Georg.
***************************************
Georg Ehret
Geneva University Hospital
Geneva, Switzerland
[[alternative HTML version deleted]]
2009 Sep 20
4
running many different regressions
Dear R community,
I have a dataframe with say 100 different variables. I wish to regress
variable 1 separately on every other variable (2-100) in a linear regression
using lm. There must be an easy way to do this without loops, but I have
difficulties figuring this out... Can you please help?
Thank you and best regards, Georg.
*****************************************
Georg Ehret
Johns Hopkins
2007 Jul 02
2
basics: changing the directory
Dear Ms. R,
I struggle with a very basic command for most of you: How to change the
working-directory by command-line?
Thank you!
Georg.
******************
Georg Ehret
Johns Hopkins University School of Medicine
Broadway Research Building, Room 572
733 N. Broadway
Baltimore, MD 21205
Phone: (410) 502-7530
Fax: (410) 502-7544
e-mail: georg@jhmi.edu
[[alternative HTML version deleted]]
2008 Apr 15
4
heavy graphs
Dear R community, I am creating large graphs with hundreds of
thousands of datapoints. My usual way for output was pdf, but now I am
getting file sizes of >30Mb that do not open well (or at all) in Adobe. Is
there a way to reduce the resolution or get rid of overlaying datapoints?
Any other idea is also warmly welcome!
Thank you and wishing you a good day!
Georg.
**********************
2008 Jun 26
2
density and jpeg
Dear R community, I am using densityplot (lattice package) for a large
dataset and wish to print it to a jpeg (the pdf is huge). R crashes
consistently. Am I doing it wrong or is densityplot incompatible with jpeg?
I work on a Mac, R 2.7.0.
> require(lattice)
> jpeg("test.jpeg")
> d[1:10]
[1] 0.700218 0.700175 0.700357 0.700847 0.698286 0.701520 0.698158 0.699300
0.698819
2008 Jan 07
3
two graphs
Dear R community,
I am plotting a histogram and would wish to display another variable of
the same dataset in a very narrow heatmap just below the x-axis. Never mind
the specifics of my task: How can I draw a second graph/image just below a
first graph/image?
Thank you!
Georg.
***************
Georg Ehret
JHU
Baltimore, MD 21043, USA
[[alternative HTML version deleted]]
2008 Jul 11
3
number of effective tests
Dear R community,
I am using 6 variables to test for an effect (by linear regression).
These 6 variables are strongly correlated among each other and I would like
to find out the number of independent test that I perform in this
calcuation. For this I calculated a matrix of correlation coefficients
between the variables (see below). But to find the rank of the table in R is
not the right
2008 Apr 01
2
using a variable in a subset of a dataframe
Dear R community, I am using a dataset and would like to define new
variables using a R variable:
e.g.
for (i in 1:10){
dataset$i<-something
}
But this is not the right way, I get only one variable in "dataset"...
How can I change this?
Thank you!
Georg.
************************
Georg Ehret
Johns Hopkins
Baltimore, MD
[[alternative HTML version deleted]]
2008 May 05
2
splitting a vector on comma
Dear R Usergroup,
I have the following vector and I would like to split it on ",".
How can I do this?
> u
[1]
"160798191,160802762,160813395,160816017,160817873,160824082,160825247,160826925,160834272,160836257,"
Thank you in advance!
With my best regards, Georg.
************************************
Georg Ehret
Baltimore
USA
[[alternative HTML version deleted]]
2010 Feb 24
3
"get" problem
Dear R communtiy,
I do not understand why this does not work...:
> betaS$SBP
[1] 0.03274 -0.04216 -0.08986 -0.45980 0.60320 -0.63070 -0.05682 0.20130
> t<-c("betaS$SBP")
> t
[1] "betaS$SBP"
> get(t)
Error in get(t) : object 'betaS$SBP' not found
[I am trying to use the variable "t" in a loop to call many different
objects, but the
2008 Jun 30
2
lm and NA
Dear R community, Can I please get some advice on the following: I wish
to obtain a list of residuals, padded by NAs for NAs in my source data. I
tried several options of "na.action", but did not succeed...
Example: I would like to get "0,0,0,0,NA,NA":
> a
[1] 1 2 3 4 NA 9
> b
[1] 3 4 5 6 7 NA
> lm(a~b)$residuals
1 2 3 4
0 0 0 0
>
2008 May 04
2
plotting pie-charts into a coordinate system
Dear R user group,
I wish to plot small pie-charts to specific coordinates in a e.g.
scatter-plot:
E.g.:
> plot(rnorm(100),rnorm(100))
> points(1,1,col="red",cex=4)
-> I wish to put pie(c(2,3)) at the position of the red circle...
How can I do this efficiently?
Thanking you and wishing you a wonderful Sunday!
Georg.
**************************
Georg Ehret
Johns Hopkins
2007 Nov 26
3
determine the number of digits printed into graph with "text(...)"
Dear R comunity,
I am printing a number in a graph using "text(...)" - see code
below: "fraction" is my number. I wish to print only two digits of the
number and struggle to do this... options(digit=3) does not work...
Thank you for your suggestions! Cheers, Georg.
**********************************
Georg Ehret
Johns Hopkins
Baltimore
2010 Apr 04
2
calculating an interaction statistic from stratified data
Dear R community,
I have data on beta&standard error (for the main effect of variable x),
stratified by sex for my dataset. I wish to calculate the sex-interaction
effect (as beta&se) from these two stratified datasets. Is there a package
to do this? If not, any advice how to do it manually?
Thank you very much and best regards, Georg.
************************
Georg Ehret, JHU,
2008 Mar 05
2
read.table
Dear R community, I encounter a problem reading data into a dataframe. See
attachment for the input. I use:
data<-read.table("test",fill=T,row.names=1)
When you look at "data" you can see that some lines of my input were
broken... I can avoid this problem by sorting the lines by length... Do I
have it wrong or is there a bug?
Thanks and wishing you a great remainder of
2009 Oct 28
2
regression on large file
Dear R community,
I have a fairly large file with variables in rows. Every variable
(thousands) needs to be regressed on a reference variable. The file is too
big to load into R (or R gets too slow having done it) and I do now read in
line by line with "scan" (see below) and write the results to out. Although
improved, this is still very slow... Can someone please help me and suggest
2008 Apr 06
1
basics on dataframes
Dear R community,
I am using a dataframe with lots of NAs and wish to create subsets from
that dataframe. In the example below I intend to create a subset with all
entries with V1>1. To my surprise the result also contains all entries with
V1=NA. I would wish to learn more why this is or what I do wrong. I know
that I can use the command "subset" and the NAs will not appear, but