data.frame

  1. A

    ].data.frame instead of ].data.table

    Is there a was to run ].data.frame instead of ].data.table when using package data.table? I ask because I get error "Error: cannot allocate vector of size 1.1 Mb" when running the below line of code on very large data and using ].data.table: dat2 = rowsum(dat[,cols,with=F], dat$id) ...but know...
  2. G

    how to reshape the data.frame from a square matrix to three column

    I have a data.frame like this: row.name a b c 1 1 4 7 2 2 5 8 3 3 6 9 and I want to reshape it like this rownamesnames1 names2 weight 1 a a 1 2 b a 2 3...
  3. G

    how to remove a row in the data.frame which contain a empty element

    I have a data.frame with many empty element, and I want to remove the row with a empty element. Is there a convient way to do this like the command na.omit. I create a data.frame like this dat <- data.frame(name = c("a","b","c", "", "h","k"), x2 = c(100,200, 300, 400, 500,600)) I can use the...
  4. R

    R: lines() and points() solution in multiple plots separated by groups

    I am relatively new to R and I am trying to do the following. I am looking for a way to generate single plots defined by group (based on the ID). My goal: Generally I am looking for a way to always plot row based points in the following pattern - starting point...
  5. K

    Need help converting data.frame into a vector of mode list

    Good day, I'm fairly new to R and still trying to get a grasp op its data-types as well as conversion between them. I need to convert a data frame generated by the RMySql package into a list of objects, so that I can use it in a shiny renderUI definition. I.e. given I have the...
  6. E

    Adding a new column in R data frame with values conditional on another column

    Suppose I have the data frame: table<- data.frame(population=c(100, 300, 5000, 2000, 900, 2500), habitat=c(1,2,3,4,5,6)) Now I want to add a new column table$size with the values 1 if population< 500, 2 if 500<=population<1000, 3 if 1000<=population<2000, 4 if 2000<=population<3000, 5 if...
  7. C

    Input data for a GAM

    Hi there, I am trying to use a GAM (with the mgcv package) to look at species abundance. I have created a data frame for input into the model but the model will not pick up the column headers when I create my function. This also spawns the error message 'object is not a matrix'. I have also...