[R] summarry.lm and NA values

2006-09-21 Thread r user
: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of r user Sent: Tuesday, August 15, 2006 7:01 AM To: rhelp Subject: [R] question re: summarry.lm and NA values Is there a way to get the following code to include NA values where the coefficients are NA? ((summary(reg

[R] getting sapply to skip columns with non-numeric data?

2006-08-17 Thread r user
getting s-apply to skip columns with non-numeric data? I have a dataframe “x” of w columns. Some columns are numeric, some are not. I wish to create a function to calculate the mean and standard deviation of each numeric column, and then “bind” the column mean and standard deviation to the

[R] question re: summarry.lm and NA values

2006-08-15 Thread r user
Is there a way to get the following code to include NA values where the coefficients are “NA”? ((summary(reg))$coefficients) explanation: Using a loop, I am running regressions on several “subsets” of “data1”. “reg - ( lm(lm(data1[,1] ~., data1[,2:l])) )” My regression has 10 independent

[R] Getting summary.lm to include data for coefficients that are NAs?

2006-08-11 Thread r user
Is there a way to get the following code to include liens where the coefficients are “NA”? ((summary(reg))$coefficients) explanation: Using a loop, I am running regressions on several “subsets” of “data1”. “reg - ( lm(lm(data1[,1] ~., data1[,2:l])) )” My regression has 10 independent

[R] basic question re lm()

2006-08-10 Thread r user
I am using R in a Windows environment. I have a basic question regarding lm(). I have a dataframe “data1” with ncol=w. I know that my dependent variable is in column1. Is there a way to write the regression formula so that I can use columns 2 thru w as my independent variables? e.g.

[R] average by group...

2006-05-30 Thread r user
I have a dataframe with 700,000 rows and 2 vectors (columns): “group” and “score”. I wish to calculate a third vector of length 70: the average score by group. Even though the avarge value will repeat, I wish to return the average for that particular group for each row. (I know I can do

[R] gc(), memory.size()

2006-05-05 Thread r user
Can someone please explain for me what the vcells and ncells “used” column means when I run gc()? gc() used (Mb) gc trigger (Mb) max used (Mb) Ncells 882296 23.6 13812157 368.9 19400892 518.1 Vcells 14811586 113.1 114763459 875.6 317464335 2422.1 (I read the help file ,

[R] function to check if an object is present, and if not, load it from my hard drive

2006-05-05 Thread r user
I want to check if an object (dataset, vector, etc) is “present”. If it is present, I will do nothing. If it is not present, I will load it from my hard drive. Is there function to determine if an object is present? __ R-help@stat.math.ethz.ch

[R] help converting code to a function

2006-05-05 Thread r user
I want to write a function that loads a data frame from my hard drive, and then creates a new dataframe that calculates the difference between column n and column n+4, and them saves this new dataframe to my hard drive, and finally, removes both the new and old data frame from memory.. Here is

[R] Determining the memory used by a dataset or vector?

2006-05-04 Thread r user
Is there a function that reports the amount of memory used by a dataset and/or vector? If I have a dataset with only 1 column, does it use more memory then the same data arranged as a vector? __ R-help@stat.math.ethz.ch mailing list

[R] converting code into a function - seperating a data frame with n columns into n individual vectors

2006-05-04 Thread r user
I have many very large dataframes with 20 columns each. In order to conserve memory, I wish to separate the data frame into 20 vectors, each named the name of the dataframe followed by .1,.2,.3….20. (For example purposes, one data frame is named “testa”.) e.g. testa.1, testa.2, testa.3 I have

[R] function to replace missing values with median value?

2006-05-03 Thread r user
I have a data set with ~10 variables (i.e. columns). I wrote this little function to replace missing values with zero. “ sz - function(x) { ifelse(is.na(x)==F,x,0) } “ Can anyone help with a function that replaces missing values with the median of the non-missing values?

[R] pros and cons of robust regression? (i.e. rlm vs lm)

2006-04-06 Thread r user
Can anyone comment or point me to a discussion of the pros and cons of robust regressions, vs. a more manual approach to trimming outliers and/or normalizing data used in regression analysis? __ R-help@stat.math.ethz.ch mailing list

[R] rowVars

2006-03-31 Thread r user
I am using the R 2.2.1 in a Windows XP environment. I have a dataframe with 12 columns and 1,000 rows. (Some of the rows have 1 or fewer values.) I am trying to use rowVars to calculate the variance of each row. I am getting the following message: “Error in na.remove.default(x) : length of

[R] calcualtign a trailing 12 column mean in a dataframe?

2006-03-29 Thread r user
I have a dataframe of 25 columns and 100,000 rows called “testdf”. I wish to build a new dataframe, with 14 columns and 100,000 rows. I wish the new dataframe to have the “trailing 12 column” mean. That is, I want column 1 of the new dataframe to have soemthing like: “(

[R] renaming dataframe1 using column names from dataframe2?

2006-03-17 Thread r user
I have a dataframe named “temp”, and another dataframe named “descriptions”. I wish to “rename” temp, and to “call” it the names of a certain column in the dataframe “descriptions”. Is there a good way to do this? A similar question: I am using a “for loop” to create several new dataframes.

[R] using a value in a column to lookup data in a certian column of a dataset?

2006-03-14 Thread r user
I have a dataset with 20 columns and ~600,000 rows. Column 1 has a number from 2-19. This number tells me, for each row, which column has the “applicable” data. (i.e. the data that I wish to use for each individual row) I want to create a vector that contains the data from the value in column

[R] vector math: calculating a rolling 12 row product?

2006-02-28 Thread r user
I have a dataframe of numeric values with 30 “rows” and 7 “columns”. For each column, beginning at “row” 12 and down to “row” 30, I wish to calculate the “rolling 12 row product”. I.e., within each column, I wish to multiply all the values in row 1:12, 2:13,…19:30. I wish to save the results as

[R] memory managment under Windows XP

2006-02-23 Thread r user
I am using R 2.2.1 in a Windowes XP environment. I work with very large datasets, and occassionally run out of memory. I have modified my boot.ini file to use the /3gb switch. I also run the following line after I launch R ( I am unsure if it is helpful). memory.limit(size = 4095) Please

[R] Conditional match?

2006-01-27 Thread r user
I have two datasets, big and small. s_date-c(‘2005-12-02’, ‘2005-12-01’, ‘2004-11-02’,’2002-10-05’,’2000-12-15’) s_id-c(‘a’,’a’,’b’,’c’,’d’) b_date- c(‘2005-12-31’, ‘2005-12-31’, ‘2004-12-31’,’2002-10-05’,’2001-10-31’,’1999-12-31’) b_id-c(‘a’,’b’,’c’,’d’,’e’,’c’)

[R] paste - eliminate spaces?

2006-01-25 Thread r user
I am trying to combine the value of a variable and text. e.g. I want “test1”, with no spaces. I try: h=1 paste(‘test’,1) But get: [1] test 1 (i.e. there is a space between “test’“ and “1”) Is there a way to eliminate the space? __

Re: [R] paste - eliminate spaces?

2006-01-25 Thread r user
I found the answer: add sep= to the paste command paste('test',1,sep=) --- r user [EMAIL PROTECTED] wrote: I am trying to combine the value of a variable and text. e.g. I want “test1”, with no spaces. I try: h=1 paste(‘test’,1) But get: [1] test 1 (i.e. there is a space

[R] importing a VERY LARGE database from Microsoft SQL into R

2006-01-24 Thread r user
I am using R 2.1.1 in a Windows Xp environment. I need to import a large database from Microsoft SQL into R. I am currently using the “sqlQuery” function/command. This works, but I sometimes run out of memory if my database is too big, or it take quite a long time for the data to import into R.

[R] Converting from a dataset to a single column

2006-01-23 Thread r user
I have a dataset of 3 “columns” and 5 “rows”. temp-data.frame(col1=c(5,10,14,56,7),col2=c(4,2,8,3,34),col3=c(28,4,52,34,67)) I wish to convert this to a single “column”, with column 1 on “top” and column 3 on “bottom”. i.e. 5 10 14 56 7 4 2 8 3 34 28 4 52 34 67 Are there any functions that do

[R] exporting dates into Microsoft SQL Server

2006-01-23 Thread r user
I am running R 2.1.1 in a Windows XP environment. I wish to use the sqlSave command to export a dataframe into Microsoft SQL. My dataframe is called temp and has 2 “columns”, “monthenddate” and “value”. Monthenddate is in 'POSIXct', format. (i.e. 'POSIXct', format: chr 1984-01-31 1984-01-31

[R] matrix logic

2006-01-10 Thread r user
I have 2 dataframes, each with 5 columns and 20 rows. They are called data1 and data2.I wish to create a third dataframe called data3, also with 5 columns and 20 rows. I want data3 to contains the values in data1 when the value in data1 is not NA. Otherwise it should contain the values in data2.

[R] matrix math

2006-01-04 Thread r user
I am using R 2.1.1 in an windows XP environment. I have 2 dataframes, temp1 and temp2. Each dataframe has 20 variables (“cocolumns) and 525 observations (“rows”). All variables are numeric. I want to create a new dataframe that also has 20 columns and 525 rows. The values

[R] matrix math

2006-01-04 Thread r user
I am using R 2.1.1 in an windows XP environment. I have 2 dataframes, temp1 and temp2. Each dataframe has 20 variables (“cocolumns) and 525 observations (“rows”). All variables are numeric. I want to create a new dataframe that also has 20 columns and 525 rows. The

[R] For loop gets exponentially slower as dataset gets larger...

2006-01-03 Thread r user
I am running R 2.1.1 in a Microsoft Windows XP environment. I have a matrix with three vectors (“columns”) and ~2 million “rows”. The three vectors are date_, id, and price. The data is ordered (sorted) by code and date_. (The matrix contains daily prices for several thousand

Re: [R] Compare rows of two matrices

2005-02-21 Thread R user
y - matrix( c(20, NA, NA, 45, 50, 19, 32, 101, 10, 22, NA, NA, 80, 49, 61, 190), ncol=4 ) x - matrix( c(20, NA, NA, NA, 50, 19, 32, 101, 10, 22, NA, NA, 80, 49, 61, 190), ncol=4 ) #Whereas x contains all NA´s from y plus some additional NA´s. #I want to find

Re: [R] Extracting a numeric prefix from a string

2005-01-31 Thread R user
list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- R user [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do

Re: [R] parameter couldn't be set in high-level plot() function

2005-01-25 Thread R user
at 15:50 +0100, R user wrote: Dear R users, I am using function bandplot from the gplots package. To my understanding (viewing the source of bandplot) it calls function plot (add = FALSE) with the same parameters (except for a few removed). I would like to give extra parameters 'xlab

[R] parameter couldn't be set in high-level plot() function

2005-01-24 Thread R user
Dear R users, I am using function bandplot from the gplots package. To my understanding (viewing the source of bandplot) it calls function plot (add = FALSE) with the same parameters (except for a few removed). I would like to give extra parameters 'xlab' and 'ylab' to function bandplot, but,

[R] 3d bar plot

2005-01-17 Thread R user
This graph - http://www.math.hope.edu/~tanis/dallas/images/disth36.gif is an example I found at http://www.math.hope.edu/~tanis/dallas/disth1.html created by Maple. Does anybody know how to create something similar in R? I have a feeling it could be possible using scatterplot3d (perhaps with

[R] evaluate expression on several dataframe columns

2004-12-20 Thread R user
Hi R-users, I have a collection of dataframes and know how to build a string that refers to it, in this example, name_infra_alg_inc. Then, I have a character string yval, which the user can select from a drop down list. It contains the column names of the dataframes.